40 if (
count < 3)
return false;
53 "failed (cloudViewer said: '%1'")
54 .arg(QString::fromStdString(errorStr)));
58 unsigned numberOfTriangles = mesh.
size();
61 if (numberOfTriangles == 0)
return false;
64 unsigned vertCount = 2 *
count;
66 unsigned faceCount = 2 * numberOfTriangles + 2 *
count;
68 unsigned faceNormCount = 2 +
count;
70 if (!
init(vertCount,
false, faceCount, faceNormCount)) {
86 for (
unsigned i = 0; i <
count; ++i) {
102 const int* _triIndexes = triIndexes;
103 for (
unsigned i = 0; i < numberOfTriangles; ++i, _triIndexes += 3) {
104 addTriangle(_triIndexes[0] * 2, _triIndexes[2] * 2,
107 addTriangle(_triIndexes[0] * 2 + 1, _triIndexes[1] * 2 + 1,
108 _triIndexes[2] * 2 + 1);
115 for (
unsigned i = 0; i <
count; ++i) {
116 unsigned iNext = ((i + 1) %
count);
129 assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));
130 if (dataVersion < 21) {
138 QDataStream outStream(&out);
143 for (
unsigned i = 0; i <
m_profile.size(); ++i) {
152 return std::max(
static_cast<short>(21),
165 QDataStream inStream(&in);
169 inStream >> vertCount;
173 for (
unsigned i = 0; i <
m_profile.size(); ++i) {
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
CloudViewerScene::LightingProfile profile
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
void addElement(const Type &value)
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
short minimumFileVersion_MeOnly() const override
PointCoordinateType m_height
Extrusion thickness.
std::vector< CCVector2 > m_profile
Profile.
ccExtru(const std::vector< CCVector2 > &profile, PointCoordinateType height, const ccGLMatrix *transMat=0, QString name=QString("Extrusion"))
Default constructor.
virtual bool buildUp() override
Builds primitive.
virtual ccGenericPrimitive * clone() const override
Clones primitive.
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
Float version of ccGLMatrixTpl.
Generic primitive interface.
bool init(unsigned vertCount, bool vertNormals, unsigned faceCount, unsigned faceNormCount)
Inits internal structures.
virtual bool updateRepresentation()
Updates internal representation (as a mesh)
ccGenericPrimitive * finishCloneJob(ccGenericPrimitive *primitive) const
Finished 'clone' job (vertices color, etc.)
ccPointCloud * vertices()
Returns vertices.
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
ccGLMatrix m_transformation
Associated transformation (applied to vertices)
short minimumFileVersion_MeOnly() const override
NormsIndexesTableType * m_triNormals
Per-triangle normals.
void addTriangle(unsigned i1, unsigned i2, unsigned i3)
Adds a triangle to the mesh.
void addTriangleNormalIndexes(int i1, int i2, int i3)
Adds a triplet of normal indexes for next triangle.
static CompressedNormType GetNormIndex(const PointCoordinateType N[])
Returns the compressed index corresponding to a normal vector.
virtual QString getName() const
Returns object name.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
static void CoordsFromDataStream(QDataStream &stream, int flags, PointCoordinateType *out, unsigned count=1)
A class to compute and handle a Delaunay 2D mesh on a subset of points.
virtual unsigned size() const override
Returns the number of triangles.
virtual bool buildMesh(const std::vector< CCVector2 > &points2D, std::size_t pointCountToUse, std::string &outputErrorStr)
Build the Delaunay mesh on top a set of 2D points.
int * getTriangleVertIndexesArray()
Returns triangles indexes array (pointer to)
void addPoint(const CCVector3 &P)
Adds a 3D point to the database.