55 this->consistent =
false;
56 x1min = x1max = x2min = x2max = x3min = x3max = 0.0;
75 this->consistent =
false;
76 x1min = x1max = x2min = x2max = x3min = x3max = 0.0;
81 cout <<
"Das Teil erzeugt seinen KnotenVector aus den Dreiecken ...\n Es sollte deleteRedundantNodes() aufgerufen "
100 this->triangles->push_back((*
tris)[
u]);
101 p1 = (*tris)[
u]->getPoint1();
102 p2 = (*tris)[
u]->getPoint2();
103 p3 = (*tris)[
u]->getPoint3();
104 points->push_back(p1);
105 points->push_back(p2);
106 points->push_back(
p3);
110 this->nodes = points;
116 this->consistent =
false;
117 x1min = x1max = x2min = x2max = x3min = x3max = 0.0;
124 if (name.size() == 0)
139 this->consistent =
false;
140 x1min = x1max = x2min = x2max = x3min = x3max = 0.0;
146 for (
unsigned u = 0;
u <
nodes->size();
u++)
165 for (
int u = 0;
u < (
int)this->triangles->size();
u++) {
167 p1 =
tri->getPoint1();
168 p2 =
tri->getPoint2();
169 p3 =
tri->getPoint3();
175 cout <<
"Nodes before deleting redundant:" << this->nodes->size() <<
endl;
178 std::map<GbPoint3D *, GbTriangle3D *>::iterator
mapIterator;
179 for (
int u = 0;
u < (
int)this->nodes->size();
u++) {
184 for (
int w =
u + 1;
w < (
int)this->nodes->size();
w++) {
189 if (
pA->equals(
pB)) {
195 p1 =
tri->getPoint1();
196 p2 =
tri->getPoint2();
197 p3 =
tri->getPoint3();
199 tri->setPoint(
pA, 0);
201 tri->setPoint(
pA, 1);
203 tri->setPoint(
pA, 2);
212 for (
int u = 0;
u < (
int)this->nodes->size();
u++) {
215 points->push_back(
pA);
218 this->nodes = points;
219 cout <<
"Nodes after deleting redundant:" << this->nodes->size() <<
endl;
223 for (
int u = 0;
u < (
int)this->triangles->size();
u++) {
225 p1 =
tri->getPoint1();
226 p2 =
tri->getPoint2();
227 p3 =
tri->getPoint3();
232 for (
int u = 0;
u < (
int)this->nodes->size();
u++) {
246 for (
int u = 0;
u < (
int)this->nodes->size();
u++) {
249 pt->setX2(
pt->getX2Coordinate() + x2);
250 pt->setX3(
pt->getX3Coordinate() + x3);
252 this->consistent =
false;
257 if (!this->consistent)
269 for (
int u = 0;
u < (
int)this->triangles->size();
u++) {
270 p1 = (*triangles)[
u]->getPoint1();
271 p2 = (*triangles)[
u]->getPoint2();
272 p3 = (*triangles)[
u]->getPoint3();
302 ss <<
"GbTriangularMesh3D[";
303 ss << (
int)this->triangles->size() <<
"-Triangles, " << (
int)this->nodes->size() <<
"-Nodes, "
304 << (
int)this->edges->size() <<
"-Edges" <<
endl;
337 if (!this->consistent)
339 return (0.5 * (this->x1min + this->x1max));
347 if (!this->consistent)
349 return (0.5 * (this->x2min + this->x2max));
357 if (!this->consistent)
359 return (0.5 * (this->x3min + this->x3max));
368 if (!this->consistent)
370 return (this->x1min);
378 if (!this->consistent)
380 return (this->x1max);
388 if (!this->consistent)
390 return (this->x2min);
398 if (!this->consistent)
400 return (this->x2max);
408 if (!this->consistent)
410 return (this->x3min);
418 if (!this->consistent)
420 return (this->x3max);
427 this->x1min = (*this->
nodes)[0]->getX1Coordinate();
428 this->x1max = (*this->
nodes)[0]->getX1Coordinate();
429 this->x2min = (*this->
nodes)[0]->getX2Coordinate();
430 this->x2max = (*this->
nodes)[0]->getX2Coordinate();
431 this->x3min = (*this->
nodes)[0]->getX3Coordinate();
432 this->x3max = (*this->
nodes)[0]->getX3Coordinate();
434 for (
int i = 1;
i < (
int)this->nodes->size();
i++) {
435 x1 = (*this->
nodes)[
i]->getX1Coordinate();
436 x2 = (*this->
nodes)[
i]->getX2Coordinate();
437 x3 = (*this->
nodes)[
i]->getX3Coordinate();
440 if (x1 > this->x1max)
444 if (x2 > this->x2max)
448 if (x3 > this->x3max)
451 this->consistent =
true;
461 for (
int i = 0;
i < (
int)this->triangles->size();
i++)
462 area += (*this->triangles)[
i]->getArea();
479 int size = (
int)this->triangles->size();
480 for (
int u = 0;
u < size;
u++) {
491 x3 =
p3->getX1Coordinate();
492 y3 =
p3->getX2Coordinate();
493 z3 =
p3->getX3Coordinate();
513 int size = (
int)this->triangles->size();
514 for (
int u = 0;
u < size;
u++) {
525 x3 =
p3->getX1Coordinate();
526 y3 =
p3->getX2Coordinate();
527 z3 =
p3->getX3Coordinate();
561 int size = (
int)this->triangles->size();
562 for (
int u = 0;
u < size;
u++) {
573 x3 =
p3->getX1Coordinate();
574 y3 =
p3->getX2Coordinate();
575 z3 =
p3->getX3Coordinate();
590 for (
int u = 0;
u < size;
u++) {
601 x3 =
p3->getX1Coordinate() - x1s;
602 y3 =
p3->getX2Coordinate() - x2s;
603 z3 =
p3->getX3Coordinate() - x3s;
608 xx = x1 * x1 + x2 * x2 + x3 * x3 + x1 * x2 + x2 * x3 + x3 * x1;
614 xy = 2.0 * (x1 *
y1 + x2 *
y2 + x3 *
y3) + x2 *
y3 + x3 *
y1 + x1 *
y2 + x3 *
y2 + x1 *
y3 + x2 *
y1;
616 zx = 2.0 * (
z1 * x1 +
z2 * x2 +
z3 * x3) +
z2 * x3 +
z3 * x1 +
z1 * x2 +
z3 * x2 +
z1 * x3 +
z2 * x1;
629 cout <<
"Volume:" <<
volume <<
"\n Traegheitsmomente:\n";
646 const double & ,
const double & )
708 const double & ,
const double & )
757 const double & ,
const double & )
784 const double & ,
const double & )
858 const double & ,
const double & )
927 const double & ,
const double & )
994 int size = (
int)this->triangles->size();
995 for (
int u = 0;
u < size;
u++) {
1066 int radius = (
int)(
bMin.Length() + 1) + 1;
1068 if (this->pointinobjecttest ==
HALFSPACE)
1072 (
int)
this->triangles->size());
1151 for (f = 0; f <
F; f++)
1153 if (
BoxTest((*this->triangles)[f], q,
r) ==
false)
1163 else if (
code ==
'f')
1169 else if (
code ==
'0') {
1190 double x,
y,
z,
w,
t;
1202 ray[0] = radius *
x;
1203 ray[1] = radius *
y;
1204 ray[2] = radius *
z;
1243 for (
i = 0;
i < 3;
i++)
1244 p[
i] = q[
i] +
t * (
r[
i] - q[
i]);
1246 if ((0.0 <
t) && (
t < 1.0))
1248 else if (
num == 0.0)
1280 for (
i = 0;
i < 3;
i++) {
1281 t = std::fabs(N[
i]);
1319 Tp[0][
j] =
T->getPoint1()->getX1Coordinate();
1320 Tp[1][
j] =
T->getPoint2()->getX1Coordinate();
1321 Tp[2][
j] =
T->getPoint3()->getX1Coordinate();
1325 Tp[0][
j] =
T->getPoint1()->getX2Coordinate();
1326 Tp[1][
j] =
T->getPoint2()->getX2Coordinate();
1327 Tp[2][
j] =
T->getPoint3()->getX2Coordinate();
1331 Tp[0][
j] =
T->getPoint1()->getX3Coordinate();
1332 Tp[1][
j] =
T->getPoint2()->getX3Coordinate();
1333 Tp[2][
j] =
T->getPoint3()->getX3Coordinate();
1375 area2 = (
b[0] - a[0]) * (
c[1] - a[1]) - (
c[0] - a[0]) * (
b[1] - a[1]);
1395 else if (
code ==
'q')
1397 else if (
code ==
'r')
1399 else if (
code ==
'p')
1401 else if (
code ==
'1')
1452 }
else if ((
vol0 == 0.0) && (
vol1 == 0.0) && (
vol2 == 0.0)) {
1453 std::cout <<
vol0 <<
" " <<
vol1 <<
" " <<
vol2 << std::endl;
1463 else if ((
vol0 == 0.) || (
vol1 == 0.) || (
vol2 == 0.)) {
1467 throw UbException(
UB_EXARGS,
"fprintf( stderr, Error 2 in SegTriCross\n ), exit(EXIT_FAILURE);");
1473 double ax, ay, az, bx, by, bz, cx, cy, cz,
dx,
dy,
dz;
1510 double minX1 =
triangle->getX1Minimum();
1511 double minX2 =
triangle->getX2Minimum();
1512 double minX3 =
triangle->getX3Minimum();
1514 double maxX1 =
triangle->getX1Maximum();
1515 double maxX2 =
triangle->getX2Maximum();
1516 double maxX3 =
triangle->getX3Maximum();
This Class provides basic 3D box objects.
This Class provides basic 3D line objects.
This Interface provides basic 3D geometry objects methods.
This Class provides basic 3D point objects.
double getX3Coordinate() const
double getX1Coordinate() const
void setX1(const double &x1)
double getX2Coordinate() const
This Class provides basic 3D triangle objects.
std::vector< GbTriangle3D * > * triangles
std::vector< GbPoint3D * > * nodes
std::vector< GbLine3D * > * edges
This Class provides basic 3D vector objects.
void setName(std::string name)
A class implements a tuple.
virtual std::string writeLines(const std::string &, std::vector< UbTupleFloat3 > &, std::vector< UbTupleInt2 > &)
virtual std::string writeTriangles(const std::string &, std::vector< UbTupleFloat3 > &, std::vector< UbTupleInt3 > &)
std::shared_ptr< T > SPtr
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
std::string toString() override
double getX2Maximum() override
void translate(const double &x1, const double &x2, const double &x3) override
std::vector< GbPoint3D * > * getNodesForRectangle(const double &p1x1, const double &p1x2, const double &p2x1, const double &p2x2)
char SegPlaneInt(GbTriangle3D *Tri, GbVector3D &q, GbVector3D &r, GbVector3D &p, int *m)
double getX1Maximum() override
bool isPointInObject3DRayCrossing(const double &xp, const double &yp, const double &zp, int radius, int numVertices, int numTriangles)
char InPlane(GbTriangle3D *T, int m, GbVector3D &q, GbVector3D &r, GbVector3D &p)
std::vector< GbPoint3D * > * getNodes()
bool isPointInObject3DHalfSpace(const double &xp, const double &yp, const double &zp)
double getX3Minimum() override
double getX3MaximumForRectangle(const double &p1x1, const double &p1x2, const double &p2x1, const double &p2x2)
double getX3RangeForRectangle(const double &p1x1, const double &p1x2, const double &p2x1, const double &p2x2)
double getX2Minimum() override
GbLine3D * createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2) override
double AreaSign(GbVector3D &a, GbVector3D &b, GbVector3D &c)
void rotate(const double &alpha, const double &beta, const double &gamma) override
double getX1Centroid() override
void deleteRedundantNodes()
UbTupleDouble3 calculateCenterOfGravity()
void writeMesh(std::string filename, WbWriter *writer, bool writeNormals=false)
double getX2Centroid() override
bool InPolyhedron(int F, GbVector3D &q, int radius)
void RandomRay(GbVector3D &ray, int radius)
int PlaneCoeff(GbTriangle3D *Tri, GbVector3D &Normal, double *D)
char SegTriCross(GbTriangle3D *T, GbVector3D &q, GbVector3D &r)
double getVolumeForRectangle(const double &p1x1, const double &p1x2, const double &p2x1, const double &p2x2)
UbTupleDouble6 calculateMomentOfInertia(double rhoP)
bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3) override
std::vector< GbTriangle3D * > * getTriangles()
std::vector< GbTriangle3D * > * getTrianglesForRectangle(const double &p1x1, const double &p1x2, const double &p2x1, const double &p2x2)
double getX1Minimum() override
double VolumeSign(GbVector3D &a, GbVector3D &b, GbVector3D &c, GbVector3D &d)
char InTri3D(GbTriangle3D *T, int m, GbVector3D &p)
double getX3MinimumForRectangle(const double &p1x1, const double &p1x2, const double &p2x1, const double &p2x2)
char SegTriInt(GbTriangle3D *Tri, GbVector3D &q, GbVector3D &r, GbVector3D &p)
~GbTriangularMesh3D() override
char InTri2D(GbVector3D Tp[3], GbVector3D &pp)
double getX3Maximum() override
bool BoxTest(GbTriangle3D *triangle, GbVector3D &PointQ, GbVector3D &PointR)
GbVector3D Add(GbVector3D &vector)
double Dot(const GbVector3D &rkV) const
double getX3Centroid() override
UbTuple< double, double, double, double, double, double > UbTupleDouble6
UbTuple< T1 > makeUbTuple(T1 const &a1)
bool zero(const T &value)