34#ifndef GBTRIFACEMESH3D_H
35#define GBTRIFACEMESH3D_H
128 return os << node.
x <<
"," << node.
y <<
"," << node.
z;
133 float x{ 0.0 },
y{ 0.0 },
z{ 0.0 };
215 std::vector<Vertex> &
nodes);
245 if (length > 1.E-10) {
246 length = 1.0f / length;
255 std::cerr <<
"GbTriFaceMesh3D::TriFace - calculateNormal: nx=ny=nz=0 -> should not happen "
256 <<
"(triangle likely has duplicate nodes or is a line) "
257 <<
"-> removeRedundantNodes" << std::endl;
368 void scale(
const double &
sx1,
const double &
sx2,
const double &
sx3)
override;
369 void rotate(
const double &alpha,
const double &beta,
const double &gamma)
override;
371 const double &beta,
const double &gamma);
372 void translate(
const double &x1,
const double &x2,
const double &x3)
override;
376 bool isPointInGbObject3D(
const double &x1,
const double &x2,
const double &x3,
int counter);
393 std::vector<std::string> *datanames =
NULL,
This Class provides basic 3D line objects.
This Interface provides basic 3D geometry objects methods.
This Class provides basic 3D point objects.
double calculateDistanceToPoint3D(const double &x1, const double &x2, const double &x3, std::vector< Vertex > &nodes)
float & getV1y(std::vector< Vertex > &nodes)
int operator[](int index)
Vertex & getNode(const int &i, std::vector< Vertex > &nodes)
float getMaxY(std::vector< Vertex > &nodes)
float & getV3z(std::vector< Vertex > &nodes)
float getMinX(std::vector< Vertex > &nodes)
float getX1Centroid(std::vector< Vertex > &nodes)
float & getV2x(std::vector< Vertex > &nodes)
float getMinY(std::vector< Vertex > &nodes)
const int & getIndexVertex2() const
void setNode(const int &i, const int &index)
const int & getIndexVertex1() const
double getArea(std::vector< Vertex > &nodes)
void calculateNormal(std::vector< Vertex > &nodes)
TriFace(const int &v1, const int &v2, const int &v3)
float & getV3x(std::vector< Vertex > &nodes)
float getX3Centroid(std::vector< Vertex > &nodes)
float getMinZ(std::vector< Vertex > &nodes)
float getMaxZ(std::vector< Vertex > &nodes)
float & getV3y(std::vector< Vertex > &nodes)
float getX2Centroid(std::vector< Vertex > &nodes)
float & getV1z(std::vector< Vertex > &nodes)
float & getV2y(std::vector< Vertex > &nodes)
const int & getIndexVertex3() const
float getMaxX(std::vector< Vertex > &nodes)
float & getV1x(std::vector< Vertex > &nodes)
float & getV2z(std::vector< Vertex > &nodes)
bool operator==(const Vertex &rhs)
Vertex(const float &x, const float &y, const float &z)
float & operator[](const int &i)
float operator[](const int &i) const
friend bool operator<(const Vertex &lhsVert, const Vertex &rhsVert)
friend std::ostream & operator<<(std::ostream &os, const Vertex &node)
KDTREE_SPLITAGORITHM kdtreeSplitAlg
double getX1Centroid() override
GbTriFaceMesh3D(std::string name, std::vector< Vertex > *nodes, std::vector< TriFace > *triangles, KDTREE_SPLITAGORITHM splitAlg=KDTREE_SAHPLIT, bool removeRedundantNodes=true)
kd_tree::Tree< double > * getKdTree()
double getX1Maximum() override
double getX1Minimum() override
std::multimap< Vertex *, TriFace * > relationVertTris
double getX2Maximum() override
std::vector< TriFace > * triangles
double getX3Centroid() override
bool buildVertTriRelationMap
kd_tree::Tree< double > * kdTree
KDTREE_SPLITAGORITHM getKdTreeSplitAlgorithm()
double getX3Minimum() override
std::vector< Vertex > * nodes
void setTransferViaFilename(bool transferViaFilename, std::string filename, double transX1, double transX2, double transX3)
double getX2Centroid() override
double getX2Minimum() override
double getX3Maximum() override
This Class provides basic 3D vector objects.
A class implements a tuple.
std::shared_ptr< T > SPtr
GbVector3D Cross(const GbVector3D &rkV) const
void rotate(const double &alpha, const double &beta, const double &gamma) override
virtual UbTuple< std::string, std::string > writeMesh(std::string filename, WbWriter *writer, bool writeNormals=false, std::vector< std::string > *datanames=NULL, std::vector< std::vector< double > > *nodedata=NULL)
void setKdTreeSplitAlgorithm(KDTREE_SPLITAGORITHM mode)
kd_tree::Tree< double > * ensureKdTree()
std::vector< Vertex > * getNodes()
void setCenterCoordinates(const double &x1, const double &x2, const double &x3) override
void scale(const double &sx1, const double &sx2, const double &sx3) override
UbTupleDouble6 calculateMomentOfInertia(double rhoP)
void readMeshFromSTLFileBinary(std::string filename, bool removeRedundantNodes)
std::string toString() override
~GbTriFaceMesh3D() override
void readMeshFromSTLFileASCII(std::string filename, bool removeRedundantNodes)
virtual bool isPointInGbObject3D(GbPoint3D *p)
void deleteRedundantNodes()
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
void rotateAroundPoint(const double &px1, const double &px2, const double &px3, const double &alpha, const double &beta, const double &gamma)
void writeMeshPly(const std::string &filename)
GbTriFaceMesh3D * clone() override
GbLine3D * createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2) override
std::vector< GbTriFaceMesh3D::TriFace * > getTrianglesForVertex(Vertex *vertex)
void translate(const double &x1, const double &x2, const double &x3) override
bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3) override
std::vector< TriFace > * getTriangles()
void addSurfaceTriangleSet(std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &triangles) override
UbTupleDouble3 calculateCenterOfGravity()
bool intersectLine(const double &p1_x1, const double &p1_x2, const double &p1_x3, const double &p2_x1, const double &p2_x2, const double &p2_x3)
UbTuple< double, double, double, double, double, double > UbTupleDouble6
const T & min(const T &a1, const T &a2)
const T & max(const T &a1, const T &a2)