VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GbTriangle3D.cpp
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
33//=======================================================================================
34#include <GbCuboid3D.h>
35#include <GbLine3D.h>
36#include <GbSystem3D.h>
37#include <GbTriangle3D.h>
38
40
41using namespace std;
42
44{
45 this->init();
46 this->consistent = false;
47}
48/*======================================================================*/
49/*
50 * Creates an empty 2D triangle with the specified points.
51 * @param point1 the 1st point
52 * @param point2 the 2nd point
53 * @param point3 the 3nd point
54 */
56{
57 this->init();
58 this->points[0] = point1;
59 this->points[1] = point2;
60 this->points[2] = point3;
61
62 this->calculateNormal();
63 this->consistent = false;
64
65 this->points[0]->addObserver(this);
66 this->points[1]->addObserver(this);
67 this->points[2]->addObserver(this);
68
69 // this.po = new PointObserver(this);
70 // this.points[0].addObserver(this.po);
71 // this.points[1].addObserver(this.po);
72 // this.points[2].addObserver(this.po);
73}
74/*======================================================================*/
75/*
76 * Creates a 3D triangle as clone of the specified 2D triangle.
77 * @param triangle the 3D triangle to be cloned
78 */
80{
81 this->init();
82 this->points[0] = triangle->points[0]->clone();
83 this->points[1] = triangle->points[1]->clone();
84 this->points[2] = triangle->points[2]->clone();
85
86 this->consistent = false;
87 this->calculateNormal();
88 this->calculateValues();
89}
90/*======================================================================*/
92{
93 if (this->points[0])
94 this->points[0]->removeObserver(this);
95 if (this->points[1])
96 this->points[1]->removeObserver(this);
97 if (this->points[2])
98 this->points[2]->removeObserver(this);
99}
100/*======================================================================*/
102{
103 if (points[0]) {
104 delete points[0];
105 points[0] = NULL;
106 }
107 if (points[1]) {
108 delete points[1];
109 points[1] = NULL;
110 }
111 if (points[2]) {
112 delete points[2];
113 points[2] = NULL;
114 }
115}
116
117/*======================================================================*/
118/* Methoden */
119/* */
120/*
121 * Creates a 3D triangle as clone of this 3D triangle.
122 */
124/*======================================================================*/
125/*
126 * Returns the number of times this 2D triangle contains the specified point.
127 * @param point the point
128 * @return the number of times this 2D triangle contains the specified point
129 */
131{
132 int n = 0;
133 for (int i = 0; i < 3; i++)
134 if (this->points[i]->equals(point))
135 n++;
136 return (n);
137}
138/*======================================================================*/
139/*
140 * Returns the number of times this 2D triangle contains a point equal to the specified point.
141 * @param point the point
142 * @return the number of times this 2D triangle contains a point equal to the specified point
143 */
145{
146 int n = 0;
147 for (int i = 0; i < 3; i++)
148 if (this->points[i]->equals(point))
149 n++;
150 return (n);
151}
152/*======================================================================*/
153/*
154 * Returns the specified point.
155 * @param index the index (must be 0, 1, or 2)
156 * @return the specified point
157 * @exception ArrayIndexOutOfBoundsException if the specified index is not valid
158 */
160{
162 throw UbException(UB_EXARGS, "invalid index specified: ");
163 return ((this->points[index]));
164}
165/*======================================================================*/
167{
169 p[0] = *(points[0]);
170 p[1] = *(points[1]);
171 p[2] = *(points[2]);
172 return p;
173 //
174 // vector<GbPoint3D> p(3);// = new vector<GbPoint3D*>;
175 // p.resize(3);//, NULL);
176 // p[0] = this->points[0];
177 // p[1] = this->points[1];
178 // p[2] = this->points[2];
179 // return(p);
180}
181/*======================================================================*/
182/*
183 * Returns the area of this triangle.
184 * The area is positive for positive ordered points, otherwise negative.
185 * @return the area of this triangle
186 */
188{
189 if (!this->consistent)
190 this->calculateValues();
191 // throw UbException(UB_EXARGS,"not correct calculated ...");
192 return (this->area);
193}
194/*
195 * Returns the centroid x1 coordinate of this triangle.
196 * @return the centroid x1 coordinate of this triangle
197 */
199{
200 if (!this->consistent)
201 this->calculateValues();
202 return (this->x1s);
203}
204/*
205 * Returns the minimum x1 coordinate of this triangle.
206 * @return the minimum x1 coordinate of this triangle
207 */
209{
210 if (!this->consistent)
211 this->calculateValues();
212 return (this->x1min);
213}
214/*
215 * Returns the maximum x1 coordinate of this triangle.
216 * @return the maximum x1 coordinate of this triangle
217 */
219{
220 if (!this->consistent)
221 this->calculateValues();
222 return (this->x1max);
223}
224/*
225 * Returns the centroid x2 coordinate of this triangle.
226 * @return the centroid x2 coordinate of this triangle
227 */
229{
230 if (!this->consistent)
231 this->calculateValues();
232 return (this->x2s);
233}
234/*
235 * Returns the minimum x2 coordinate of this triangle.
236 * @return the minimum x2 coordinate of this triangle
237 */
239{
240 if (!this->consistent)
241 this->calculateValues();
242 return (this->x2min);
243}
244/*
245 * Returns the maximum x2 coordinate of this triangle.
246 * @return the maximum x2 coordinate of this triangle
247 */
249{
250 if (!this->consistent)
251 this->calculateValues();
252 return (this->x2max);
253}
255{
256 if (!this->consistent)
257 this->calculateValues();
258 return (this->x3s);
259}
261{
262 if (!this->consistent)
263 this->calculateValues();
264 return (this->x3min);
265}
267{
268 if (!this->consistent)
269 this->calculateValues();
270 return (this->x3max);
271}
272
273/*
274 * Sets the specified point.
275 * @param point the point
276 * @param index the index (must be 0, 1, or 2)
277 * @exception ArrayIndexOutOfBoundsException if the specified index is not valid
278 */
280{
282 throw UbException(UB_EXARGS, "invalid index specified: ");
283 this->points[index] = point;
284 this->consistent = false;
285 this->calculateNormal();
286}
287
288/*
289 * Returns the surface triangle set with new nodes !!!
290 * @returns the surface triangle set with new nodes !!!
291 */
293{
294 vector<GbTriangle3D *> triangles;
295
296 triangles.push_back(
298
299 return triangles;
300}
301
302/*
303 * Returns the string representation of the triangle
304 * @returns the string representation of the triangle
305 */
306
308{
310 ss << "GbTriangle3D[area=";
311 ss << this->getArea();
312
313 ss << ", x1s=" << this->x1s;
314 ss << ", x2s=" << this->x2s;
315 ss << ", x3s=" << this->x3s;
316 ss << ", x1min=" << this->x1min;
317 ss << ", x1max=" << this->x1max;
318 ss << ", x2min=" << this->x2min;
319 ss << ", x2max=" << this->x2max;
320 ss << ", x3min=" << this->x3min;
321 ss << ", x3max=" << this->x3max;
322 ss << ", points1=" << this->points[0]->toString();
323 ss << ", points2=" << this->points[1]->toString();
324 ss << ", points3=" << this->points[2]->toString();
325 ss << "]";
326 return ((ss.str()).c_str());
327}
328/*======================================================================*/
329double GbTriangle3D::getIntersectionRaytraceFactor(const double &x1, const double &x2, const double &x3,
330 const double &rx1, const double &rx2, const double &rx3)
331{
332 // e1 = v1 - v0
333 double e1x1 = this->points[1]->x1 - this->points[0]->x1;
334 double e1x2 = this->points[1]->x2 - this->points[0]->x2;
335 double e1x3 = this->points[1]->x3 - this->points[0]->x3;
336
337 // e2 = v2 - v0
338 double e2x1 = this->points[2]->x1 - this->points[0]->x1;
339 double e2x2 = this->points[2]->x2 - this->points[0]->x2;
340 double e2x3 = this->points[2]->x3 - this->points[0]->x3;
341
342 // p = d x e2
343 double px1 = rx2 * e2x3 - rx3 * e2x2;
344 double px2 = rx3 * e2x1 - rx1 * e2x3;
345 double px3 = rx1 * e2x2 - rx2 * e2x1;
346
347 // a = e1 dot p
348 double a = e1x1 * px1 + e1x2 * px2 + e1x3 * px3;
349 if (fabs(a) < 1.E-10)
350 return -1.0;
351 double f = 1.0 / a;
352
353 // s = o - v0
354 double sx1 = x1 - this->points[0]->x1;
355 double sx2 = x2 - this->points[0]->x2;
356 double sx3 = x3 - this->points[0]->x3;
357
358 // u = f * ( s dot p)
359 double u = f * (sx1 * px1 + sx2 * px2 + sx3 * px3);
360 if (u < -1.E-10 || u > 1.0 + 1.E-10)
361 return -1.0;
362
363 // q = s x e1
364 double qx1 = sx2 * e1x3 - sx3 * e1x2;
365 double qx2 = sx3 * e1x1 - sx1 * e1x3;
366 double qx3 = sx1 * e1x2 - sx2 * e1x1;
367
368 // v = f*(e2 dot q)
369 double v = f * (rx1 * qx1 + rx2 * qx2 + rx3 * qx3);
370 if (v < -1.E-10 || (u + v) > 1.0 + 1.E-10)
371 return -1.0;
372
373 // t = f * (e2 dot q)
374 return f * (e2x1 * qx1 + e2x2 * qx2 + e2x3 * qx3);
375}
376
377/*===========================================================*/
378
380{
382 if (!result)
383 return NULL;
384
385 return new GbLine3D(result, new GbPoint3D(point2));
386
387 // return GbSystem::createClipLine3D(point1, point2,
388 // p1->getX1Coordinate(),p1->getX2Coordinate(),p1->getX3Coordinate(),
389 // p2->getX1Coordinate(),p2->getX2Coordinate(),p2->getX3Coordinate() );
390}
391
392// von Navodit ...
393/*===========================================================*/
398/*===========================================================*/
400{
403 GbVector3D direction = Point2 - Point1;
404 GbVector3D GbPoint3D1(this->getPoint1()->x1, this->getPoint1()->x2, this->getPoint1()->x3);
405 GbVector3D GbPoint3D2(this->getPoint2()->x1, this->getPoint2()->x2, this->getPoint2()->x3);
406 GbVector3D GbPoint3D3(this->getPoint3()->x1, this->getPoint3()->x2, this->getPoint3()->x3);
411 GbVector3D Normal = V2V1V3V1;
412
413 double d = -Normal.Dot(GbPoint3D1);
414 double denom = Normal.Dot(direction);
415
416 if (ub_math::zero(denom))
417 return NULL; // line does not intersect the plane of the triangle !
418 else {
419 double mu = -1. * (d + Point1.Dot(Normal)) / denom; // mu = -(d+ Normal.Point1)/denom
420
421 // GbVector3D p1 = Point2-Point1;
422 // GbVector3D p2 = p1*mu;
423 // GbVector3D p3 = Point1+p2;
425
426 if (mu < 0.0 || mu > 1.0)
427 return NULL; // Point of intersection of line and plane does not lie on the triangle
428 else {
429 // Test whether Point lies inside the triangle or not
430 bool test = true;
434 GbVector3D ab = a.Cross(b);
435 GbVector3D bc = b.Cross(c);
436 GbVector3D ca = c.Cross(a);
437 GbVector3D Q1 = ab * 0.5;
438 GbVector3D Q2 = bc * 0.5;
439 GbVector3D Q3 = ca * 0.5;
440 GbVector3D Q1Q2 = Q1 + Q2;
441 GbVector3D Q = Q1Q2 + Q3;
442
443 if (ub_math::less(Q.Dot(Q1), 0.0))
444 test = false;
445 if (ub_math::less(Q.Dot(Q2), 0.0))
446 test = false;
447 if (ub_math::less(Q.Dot(Q3), 0.0))
448 test = false;
449
450 if (test == true)
451 return (new GbPoint3D(point.X1(), point.X2(), point.X3()));
452 else
453 return NULL;
454 }
455 }
456}
457
467/*=======================================================================*/
468double GbTriangle3D::calculateDistanceToPoint3D(const double &x1, const double &x2, const double &x3)
469{
470 //
471 // throw UbException(UB_EXARGS,"Ich glaub GbTriangle3D::calculateDistanceToPoint3D(...) kann man so nicht
472 // nehmen,jedenfalls nicht fuer die q's");
473 cout << "??? ch glaub GbTriangle3D::calculateDistanceToPoint3D(...) kann man so nicht nehmen,jedenfalls nicht fuer "
474 "die q's"
475 << endl;
476 GbVector3D P0(x1, x2, x3);
477 GbVector3D P1(this->points[0]->x1, this->points[0]->x2, this->points[0]->x3);
478 GbVector3D P2(this->points[1]->x1, this->points[1]->x2, this->points[1]->x3);
479 GbVector3D P3(this->points[2]->x1, this->points[2]->x2, this->points[2]->x3);
480
481 // Determine normal to triangle
482 GbVector3D Normal = (P1 - P2).Cross(P1 - P3);
483 double alpha = ub_math::ACos((P1 - P0).Dot(Normal) / ((P1 - P0).Length() * Normal.Length()));
484
485 double P0P0dash = (P0 - P1).Length() * cos(alpha);
486 Normal.Normalize();
487 GbVector3D Projection = Normal * (-P0P0dash);
488
490
491 // Check if point P0dash lies within the triangle P1P2P3.
492 bool test = false;
493 if (((P1 - P0).Cross(P2 - P0)).Dot(Normal) > 0)
494 test = true;
495 if (((P2 - P0).Cross(P3 - P0)).Dot(Normal) > 0)
496 test = true;
497 if (((P3 - P0).Cross(P1 - P0)).Dot(Normal) > 0)
498 test = true;
499
500 if (test == true)
501 return (P0 - P0dash).Length();
502 else
503 // Determine the distance of point P0 from all edges and vertices and return the minimum distance
504 {
505 double dP0P1 = (P0 - P1).Length(); // Distance of Point P0 from Point P1
506 double dP0P2 = (P0 - P2).Length(); // Distance of Point P0 from Point P2
507 double dP0P3 = (P0 - P3).Length(); // Distance of Point P0 from Point P3
508
509 GbVector3D MP1P2 = P2 - P1; // Direction vector for line P1P2
510 GbVector3D MP2P3 = P3 - P2; // Direction vector for line P2P3
511 GbVector3D MP3P1 = P1 - P3; // Direction vector for line P3P1
512
513 double tP1P2 = MP1P2.Dot(P0 - P1) / MP1P2.Dot(MP1P2);
514 double tP2P3 = MP2P3.Dot(P0 - P2) / MP2P3.Dot(MP2P3);
515 double tP3P1 = MP3P1.Dot(P0 - P3) / MP3P1.Dot(MP3P1);
516
517 double dP1P2 = (P0 - (P1 + (MP1P2 * tP1P2))).Length(); // Distance of Point P0 from line P1P2
518 double dP2P3 = (P0 - (P2 + (MP2P3 * tP2P3))).Length(); // Distance of Point P0 from line P2P3
519 double dP3P1 = (P0 - (P3 + (MP3P1 * tP3P1))).Length(); // Distance of Point P0 from line P3P1
520
521 double distanceP0[6]; // Array to store all the distances from Point P0
522 distanceP0[0] = dP0P1;
523 distanceP0[1] = dP0P2;
524 distanceP0[2] = dP0P3;
525 distanceP0[3] = dP1P2;
526 distanceP0[4] = dP2P3;
527 distanceP0[5] = dP3P1;
528
529 double d = 0.0;
530 // Find the minimum distance from Point P0
531 for (int i = 0; i < 6; i++) {
532 if (distanceP0[i] < d)
533 d = distanceP0[i];
534 }
535 return d;
536 }
537}
544double GbTriangle3D::calculateNormalizedDistanceToPoint3D(const double &x1, const double &y1, const double &z1,
545 const double &x2, const double &y2, const double &z2)
546{
547 // face* pf
548 double xa, xb, xc, ya, yb, yc, za, zb, zc;
549 // double xp, yp, zp;
550 double tt = 0, xi = 0, eta = 0;
551 double zaehler, nenner;
552 double wurzel3 = sqrt(3.);
553
554 // Weltkoordinaten der Dreiecke
555 xa = this->points[0]->x1;
556 xb = this->points[1]->x1;
557 xc = this->points[2]->x1;
558
559 ya = this->points[0]->x2;
560 yb = this->points[1]->x2;
561 yc = this->points[2]->x2;
562
563 za = this->points[0]->x3;
564 zb = this->points[1]->x3;
565 zc = this->points[2]->x3;
566
567 // Shape-Funktionen zum Berechnen der Schnittpunkte
568 zaehler = static_cast<double>(((-1.0 * zc + zb) * ya + (yc - 1.0 * yb) * za + zc * yb - 1.0 * zb * yc) * x1 +
569 ((-1.0 * zb + zc) * xa + (xb - 1.0 * xc) * za - 1.0 * xb * zc + xc * zb) * y1 +
570 ((-1.0 * yc + yb) * xa + (-1.0 * xb + xc) * ya - 1.0 * xc * yb + xb * yc) * z1 +
571 ((-1.0 * zc + zb) * ya + (yc - 1.0 * yb) * za + zc * yb - 1.0 * zb * yc) * x2 +
572 ((-1.0 * zb + zc) * xa + (xb - 1.0 * xc) * za - 1.0 * xb * zc + xc * zb) * y2 +
573 ((-1.0 * yc + yb) * xa + (-1.0 * xb + xc) * ya - 1.0 * xc * yb + xb * yc) * z2 +
574 (2.0 * zb * yc - 2.0 * zc * yb) * xa + (2.0 * xb * zc - 2.0 * xc * zb) * ya +
575 (-2.0 * xb * yc + 2.0 * xc * yb) * za);
576 nenner = static_cast<double>((((-1.0 * zc + zb) * ya + (yc - 1.0 * yb) * za + zc * yb - 1.0 * zb * yc) * x1 +
577 ((-1.0 * zb + zc) * xa + (xb - 1.0 * xc) * za - 1.0 * xb * zc + xc * zb) * y1 +
578 ((-1.0 * yc + yb) * xa + (-1.0 * xb + xc) * ya - 1.0 * xc * yb + xb * yc) * z1 +
579 ((-1.0 * zb + zc) * ya + (-1.0 * yc + yb) * za - 1.0 * zc * yb + zb * yc) * x2 +
580 ((-1.0 * zc + zb) * xa + (-1.0 * xb + xc) * za + xb * zc - 1.0 * xc * zb) * y2 +
581 ((yc - 1.0 * yb) * xa + (xb - 1.0 * xc) * ya + xc * yb - 1.0 * xb * yc) * z2));
582 if (ub_math::greater(nenner, 0.0))
583 tt = zaehler / nenner;
584 else
585 tt = -999.;
586
587 zaehler = static_cast<double>(((-2.0 * zc + za + zb) * y2 + (-1.0 * yb - 1.0 * ya + 2.0 * yc) * z2 + zc * ya -
588 1.0 * zb * yc + zc * yb - 1.0 * za * yc) *
589 x1 +
590 ((-1.0 * za + 2.0 * zc - 1.0 * zb) * x2 + (xa - 2.0 * xc + xb) * z2 - 1.0 * xa * zc -
591 1.0 * xb * zc + xc * za + xc * zb) *
592 y1 +
593 ((-2.0 * yc + ya + yb) * x2 + (-1.0 * xa - 1.0 * xb + 2.0 * xc) * y2 - 1.0 * xc * yb +
594 xa * yc + xb * yc - 1.0 * xc * ya) *
595 z1 +
596 (zb * yc - 1.0 * zc * ya - 1.0 * zc * yb + za * yc) * x2 +
597 (-1.0 * xc * za + xb * zc + xa * zc - 1.0 * xc * zb) * y2 +
598 (xc * yb - 1.0 * xa * yc - 1.0 * xb * yc + xc * ya) * z2);
599 nenner = static_cast<double>((((zc - 1.0 * zb) * ya + (yb - 1.0 * yc) * za + zb * yc - 1.0 * zc * yb) * x1 +
600 ((zb - 1.0 * zc) * xa + (xc - 1.0 * xb) * za - 1.0 * xc * zb + xb * zc) * y1 +
601 ((-1.0 * yb + yc) * xa + (xb - 1.0 * xc) * ya - 1.0 * xb * yc + xc * yb) * z1 +
602 ((zb - 1.0 * zc) * ya + (-1.0 * yb + yc) * za + zc * yb - 1.0 * zb * yc) * x2 +
603 ((zc - 1.0 * zb) * xa + (xb - 1.0 * xc) * za - 1.0 * xb * zc + xc * zb) * y2 +
604 ((yb - 1.0 * yc) * xa + (xc - 1.0 * xb) * ya + xb * yc - 1.0 * xc * yb) * z2));
605 if (ub_math::greater(nenner, 0.0))
606 xi = zaehler / nenner;
607 else
608 xi = -999.;
609
610 zaehler = static_cast<double>(((za - 1.0 * zb) * y2 + (-1.0 * ya + yb) * z2 - 1.0 * za * yb + zb * ya) * x1 +
611 ((-1.0 * za + zb) * x2 + (xa - 1.0 * xb) * z2 - 1.0 * xa * zb + xb * za) * y1 +
612 ((ya - 1.0 * yb) * x2 + (xb - 1.0 * xa) * y2 + xa * yb - 1.0 * xb * ya) * z1 +
613 (-1.0 * zb * ya + za * yb) * x2 + (-1.0 * xb * za + xa * zb) * y2 +
614 (-1.0 * xa * yb + xb * ya) * z2);
615 nenner = static_cast<double>((((zc - 1.0 * zb) * ya + (yb - 1.0 * yc) * za + zb * yc - 1.0 * zc * yb) * x1 +
616 ((zb - 1.0 * zc) * xa + (xc - 1.0 * xb) * za - 1.0 * xc * zb + xb * zc) * y1 +
617 ((-1.0 * yb + yc) * xa + (xb - 1.0 * xc) * ya - 1.0 * xb * yc + xc * yb) * z1 +
618 ((zb - 1.0 * zc) * ya + (-1.0 * yb + yc) * za + zc * yb - 1.0 * zb * yc) * x2 +
619 ((zc - 1.0 * zb) * xa + (xb - 1.0 * xc) * za - 1.0 * xb * zc + xc * zb) * y2 +
620 ((yb - 1.0 * yc) * xa + (xc - 1.0 * xb) * ya + xb * yc - 1.0 * xc * yb) * z2));
621 if (ub_math::greater(nenner, 0.0))
622 eta = static_cast<double>((zaehler / nenner) * wurzel3 * -1.);
623 else
624 eta = -999.;
625
626 if (tt >= -1.0 - ub_math::Epsilon<double>::val() && tt <= 1.0) {
627 if (xi >= -1.0 + eta / wurzel3 - ub_math::Epsilon<double>::val() &&
630 /*xp = x1*(0.5-tt/2)+x2*(0.5+tt/2);
631 yp = y1*(0.5-tt/2)+y2*(0.5+tt/2);
632 zp = z1*(0.5-tt/2)+z2*(0.5+tt/2);*/
633 return static_cast<double>((sqrt(pow((x1 * (0.5 - tt / 2) + x2 * (0.5 + tt / 2)) - x1, 2) +
634 pow((y1 * (0.5 - tt / 2) + y2 * (0.5 + tt / 2)) - y1, 2) +
635 pow((z1 * (0.5 - tt / 2) + z2 * (0.5 + tt / 2)) - z1, 2))));
636 }
637 }
638 }
639 return (-999.);
640}
641/*
642 * Returns true if the specified 2D point lies within (or on the border of) this 2D triangle.
643 * @param point the 2D point to check
644 * @return true if the specified 2D point lies within (or on the border of) this 2D triangle
645 */
646bool GbTriangle3D::enclosesPoint2D(double x1, double x2)
647{
648 int i = 0;
649 // Punkt(x1,x2) liegt auf einem der Eckpunkte
650 if (x1 == this->getPoint(0)->getX1Coordinate() && x2 == this->getPoint(0)->getX2Coordinate())
651 return true;
652 if (x1 == this->getPoint(1)->getX1Coordinate() && x2 == this->getPoint(1)->getX2Coordinate())
653 return true;
654 if (x1 == this->getPoint(2)->getX1Coordinate() && x2 == this->getPoint(2)->getX2Coordinate())
655 return true;
656
657 // Erste Grade aus dem zu pruefenden Punkt(x,y) und einem zweiten Punkt(x+0.333,y+2.333)
658 GbPoint3D p1;
659 p1.setX1(x1);
660 p1.setX2(x2);
661 p1.setX3(0.0);
662 GbPoint3D p2;
663 p2.setX1(x1 + 0.333);
664 p2.setX2(x2 + 3.333);
665 p2.setX3(0.0);
666 // Punkte des Dreiecks auf 2D reduziert
668 dp1.setX1(this->getPoint(0)->getX1Coordinate());
669 dp1.setX2(this->getPoint(0)->getX2Coordinate());
670 dp1.setX3(0.0);
672 dp2.setX1(this->getPoint(1)->getX1Coordinate());
673 dp2.setX2(this->getPoint(1)->getX2Coordinate());
674 dp2.setX3(0.0);
676 dp3.setX1(this->getPoint(2)->getX1Coordinate());
677 dp3.setX2(this->getPoint(2)->getX2Coordinate());
678 dp3.setX3(0.0);
679 // ueberpruefen, ob der Punkt(x,y) innerhalt der Boundingbox des Dreiecks liegt
682 // ueberpruefen, ob der Punkt innerhalb des Dreiecks liegt
684 if (dummy != NULL) {
685 if (dummy->getX1Coordinate() == p1.getX1Coordinate() && dummy->getX2Coordinate() == p1.getX2Coordinate()) {
686 delete dummy;
687 return true;
688 } else if (dummy->getX1Coordinate() > p1.getX1Coordinate()) {
689 i++;
690 } else {
691 i--;
692 }
693 }
694 if (dummy)
695 delete dummy;
696
698 if (dummy != NULL) {
699 if (dummy->getX1Coordinate() == p1.getX1Coordinate() && dummy->getX2Coordinate() == p1.getX2Coordinate()) {
700 if (dummy)
701 delete dummy;
702 return true;
703 } else if (dummy->getX1Coordinate() > p1.getX1Coordinate()) {
704 i++;
705 } else {
706 i--;
707 }
708 }
709 if (dummy)
710 delete dummy;
711
713 if (dummy != NULL) {
714 if (dummy->getX1Coordinate() == p1.getX1Coordinate() && dummy->getX2Coordinate() == p1.getX2Coordinate()) {
715 if (dummy)
716 delete dummy;
717 return true;
718 } else if (dummy->getX1Coordinate() > p1.getX1Coordinate()) {
719 i++;
720 } else {
721 i--;
722 }
723 }
724 if (dummy)
725 delete dummy;
726 }
727 if (i == -1)
728 return true;
729 if (i == 1)
730 return true;
731
732 return false;
733}
734
736//* Returns a new 2D polygon clipped by the specified 2D rectangle (result may be null!).
737//* @param rectangle the 2D rectangle
738//* @return a new 2D polygon clipped by the specified 2D rectangle
739//*/
741{
743 cube->getPoint1()->getX2Coordinate(), cube->getPoint1()->getX3Coordinate(),
744 cube->getPoint2()->getX1Coordinate(), cube->getPoint2()->getX2Coordinate(),
745 cube->getPoint2()->getX3Coordinate()));
746}
748//* Returns a new 2D polygon clipped by the specified 2D rectangle (result may be null!).
749//* @param p1 the 1st point of the rectangle
750//* @param p2 the 2nd point of the rectangle
751//* @return a new 2D polygon clipped by the specified 2D rectangle
752//*/
753// public GbPolygon2D createClippedPolygon2D(GbPoint2D p1, GbPoint2D p2)
754//{
755// return(GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2));
756//}
757/*
758 * Returns a new 2D polygon clipped by the specified 2D rectangle (result may be null!).
759 * @param p1x1 the 1st x1 coordinate of the rectangle
760 * @param p1x2 the 1st x2 coordinate of the rectangle
761 * @param p2x1 the 2nd x1 coordinate of the rectangle
762 * @param p2x2 the 2nd x2 coordinate of the rectangle
763 * @return a new 2D polygon clipped by the specified 2D rectangle
764 */
765GbPolygon3D *GbTriangle3D::createClippedPolygon3D(const double &p1x1, const double &p1x2, const double &p1x3,
766 const double &p2x1, const double &p2x2, const double &p2x3)
767{
768 return (gb_system_3d::clipPolygon3D(this->getPoints(), p1x1, p1x2, p1x3, p2x1, p2x2, p2x3));
769}
770
771/*
772 * Returns true if the specified 2D rectangle lies completely within this 2D triangle.
773 * @param rectangle the 2D rectangle to check
774 * @return true if the specified 2D rectangle lies completely within this 2D triangle
775 */
776// bool enclosesRectangle2D(GbRectangle2D *rectangle)
777//{
778// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, rectangle.p1.x1, rectangle.p1.x2, rectangle.p2.x1,
779// rectangle.p2.x2); return(p!=null && GbSystem.equal(Math.abs(p.getArea()), rectangle.getArea()));
780//}
781/*
782 * Returns true if the specified 2D rectangle lies completely within this 2D triangle.
783 * @param p1 the 1st point of the rectangle to check
784 * @param p2 the 2nd point of the rectangle to check triangle
785 * @return true if the specified 2D rectangle lies completely within this 2D
786 */
787// public boolean enclosesRectangle2D(GbPoint2D p1, GbPoint2D p2)
788//{
789// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2);
790// return(p!=null && GbSystem.equal(Math.abs(p.getArea()), Math.abs((p1.x1-p2.x1)*(p1.x2-p2.x2))));
791//}
792/*
793 * Returns true if the specified 2D rectangle lies completely within this 2D triangle.
794 * @param p1x1 the 1st x1 coordinate of the rectangle to check
795 * @param p1x2 the 1st x2 coordinate of the rectangle to check
796 * @param p2x1 the 2nd x1 coordinate of the rectangle to check
797 * @param p2x2 the 2nd x2 coordinate of the rectangle to check
798 * @return true if the specified 2D rectangle lies completely within this 2D triangle
799 */
800// public boolean enclosesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2)
801//{
802// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1x1, p1x2, p2x1, p2x2);
803// return(p!=null && GbSystem.equal(Math.abs(p.getArea()), Math.abs((p1x1-p2x1)*(p1x2-p2x2))));
804//}
805
806/*
807 * Returns true if the specified 2D rectangle is crossed by this 2D triangle.
808 * @param rectangle the 2D rectangle to check
809 * @return true if the specified 2D rectangle is crossed by this 2D triangle
810 */
811// public boolean crossesRectangle2D(GbRectangle2D rectangle)
812//{
813// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, rectangle.p1.x1, rectangle.p1.x2, rectangle.p2.x1,
814// rectangle.p2.x2); return(p!=null && GbSystem.inOpenInterval(Math.abs(p.getArea()), 0.0, rectangle.getArea()));
815//}
816/*
817 * Returns true if the specified 2D rectangle is crossed by this 2D triangle.
818 * @param p1 the 1st point of the rectangle to check
819 * @param p2 the 2nd point of the rectangle to check
820 * @return true if the specified 2D rectangle is crossed by this 2D triangle
821 */
822// public boolean crossesRectangle2D(GbPoint2D p1, GbPoint2D p2)
823//{
824// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2);
825// return(p!=null && GbSystem.inOpenInterval(Math.abs(p.getArea()), 0.0, Math.abs((p1.x1-p2.x1)*(p1.x2-p2.x2))));
826//}
827/*
828 * Returns true if the specified 2D rectangle is crossed by this 2D triangle.
829 * @param p1x1 the 1st x1 coordinate of the rectangle to check
830 * @param p1x2 the 1st x2 coordinate of the rectangle to check
831 * @param p2x1 the 2nd x1 coordinate of the rectangle to check
832 * @param p2x2 the 2nd x2 coordinate of the rectangle to check
833 * @return true if the specified 2D rectangle is crossed by this 2D triangle
834 */
835// public boolean crossesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2)
836//{
837// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1x1, p1x2, p2x1, p2x2);
838// return(p!=null && GbSystem.inOpenInterval(Math.abs(p.getArea()), 0.0, Math.abs((p1x1-p2x1)*(p1x2-p2x2))));
839//}
840
841/*
842 * Returns true if the specified 2D rectangle lies (at least partly) within this 2D triangle.
843 * @param rectangle the 2D rectangle to check
844 * @return true if the specified 2D rectangle lies (at least partly) within this 2D triangle
845 */
846// public boolean enclosesOrCrossesRectangle2D(GbRectangle2D rectangle)
847//{
848// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, rectangle.p1.x1, rectangle.p1.x2, rectangle.p2.x1,
849// rectangle.p2.x2); return(p!=null && GbSystem.greater(Math.abs(p.getArea()), 0.0));
850//}
851/*
852 * Returns true if the specified 2D rectangle lies (at least partly) within this 2D triangle.
853 * @param p1 the 1st point of the rectangle to check
854 * @param p2 the 2nd point of the rectangle to check
855 * @return true if the specified 2D rectangle lies (at least partly) within this 2D triangle
856 */
857// public boolean enclosesOrCrossesRectangle2D(GbPoint2D p1, GbPoint2D p2)
858//{
859// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2);
860// return(p!=null && GbSystem.greater(Math.abs(p.getArea()), 0.0));
861//}
862/*
863 * Returns true if the specified 2D rectangle lies (at least partly) within this 2D triangle.
864 * @param p1x1 the 1st x1 coordinate of the rectangle to check
865 * @param p1x2 the 1st x2 coordinate of the rectangle to check
866 * @param p2x1 the 2nd x1 coordinate of the rectangle to check
867 * @param p2x2 the 2nd x2 coordinate of the rectangle to check
868 * @return true if the specified 2D rectangle lies (at least partly) within this 2D triangle
869 */
870// public boolean enclosesOrCrossesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2)
871//{
872// GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1x1, p1x2, p2x1, p2x2);
873// return(p!=null && GbSystem.greater(Math.abs(p.getArea()), 0.0));
874//}
875/*======================================================================*/
876
877/*======================================================================*/
878/* Private Methoden */
879/* */
881{
882 this->x1min = this->points[0]->x1;
883 this->x1max = this->points[0]->x1;
884 this->x2min = this->points[0]->x2;
885 this->x2max = this->points[0]->x2;
886 this->x3min = this->points[0]->x3;
887 this->x3max = this->points[0]->x3;
888
889 if (this->points[1]->x1 < this->x1min)
890 this->x1min = this->points[1]->x1;
891 if (this->points[1]->x1 > this->x1max)
892 this->x1max = this->points[1]->x1;
893 if (this->points[1]->x2 < this->x2min)
894 this->x2min = this->points[1]->x2;
895 if (this->points[1]->x2 > this->x2max)
896 this->x2max = this->points[1]->x2;
897 if (this->points[1]->x3 < this->x3min)
898 this->x3min = this->points[1]->x3;
899 if (this->points[1]->x3 > this->x3max)
900 this->x3max = this->points[1]->x3;
901
902 if (this->points[2]->x1 < this->x1min)
903 this->x1min = this->points[2]->x1;
904 if (this->points[2]->x1 > this->x1max)
905 this->x1max = this->points[2]->x1;
906 if (this->points[2]->x2 < this->x2min)
907 this->x2min = this->points[2]->x2;
908 if (this->points[2]->x2 > this->x2max)
909 this->x2max = this->points[2]->x2;
910 if (this->points[2]->x3 < this->x3min)
911 this->x3min = this->points[2]->x3;
912 if (this->points[2]->x3 > this->x3max)
913 this->x3max = this->points[2]->x3;
914
915 this->x1s = (this->points[0]->x1 + this->points[1]->x1 + this->points[2]->x1) / 3.0;
916 this->x2s = (this->points[0]->x2 + this->points[1]->x2 + this->points[2]->x2) / 3.0;
917 this->x3s = (this->points[0]->x3 + this->points[1]->x3 + this->points[2]->x3) / 3.0;
918
919 GbVector3D A(points[0]->x1, points[0]->x2, points[0]->x3);
920 GbVector3D B(points[1]->x1, points[1]->x2, points[1]->x3);
921 GbVector3D C(points[2]->x1, points[2]->x2, points[2]->x3);
922 GbVector3D AB = B - A;
923 GbVector3D AC = C - A;
924 GbVector3D N = AB.Cross(AC);
925 this->area = 0.5 * N.Length();
926 this->consistent = true;
927}
928/*======================================================================*/
929
930/*======================================================================*/
932{
933 this->calculateNormal();
934 return normal;
935}
936/*======================================================================*/
937void GbTriangle3D::init()
938{
939 x1s = 0.0;
940 x2s = 0.0;
941 x3s = 0.0;
942 x1min = 0.0;
943 x1max = 0.0;
944 x2min = 0.0;
945 x2max = 0.0;
946 area = 0.0;
947 consistent = false;
948 points.resize(3, NULL);
949}
950/*=======================================================*/
952{
953 GbPoint3D *&a = points[0];
954 GbPoint3D *&b = points[1];
955 GbPoint3D *&c = points[2];
956 normal[0] = (c->getX3Coordinate() - a->getX3Coordinate()) * (b->getX2Coordinate() - a->getX2Coordinate()) -
957 (b->getX3Coordinate() - a->getX3Coordinate()) * (c->getX2Coordinate() - a->getX2Coordinate());
958 normal[1] = (b->getX3Coordinate() - a->getX3Coordinate()) * (c->getX1Coordinate() - a->getX1Coordinate()) -
959 (b->getX1Coordinate() - a->getX1Coordinate()) * (c->getX3Coordinate() - a->getX3Coordinate());
960 normal[2] = (b->getX1Coordinate() - a->getX1Coordinate()) * (c->getX2Coordinate() - a->getX2Coordinate()) -
961 (b->getX2Coordinate() - a->getX2Coordinate()) * (c->getX1Coordinate() - a->getX1Coordinate());
963}
964/*=======================================================*/
965// toDo:
967{
968 GbVector3D Point1(this->getPoint1()->getX1Coordinate(), this->getPoint1()->getX2Coordinate(),
969 this->getPoint1()->getX3Coordinate());
970 GbVector3D Point2(this->getPoint2()->getX1Coordinate(), this->getPoint2()->getX2Coordinate(),
971 this->getPoint2()->getX3Coordinate());
972 GbVector3D Point3(this->getPoint3()->getX1Coordinate(), this->getPoint3()->getX2Coordinate(),
973 this->getPoint3()->getX3Coordinate());
974
978 double fA00 = kEdge0.SquaredLength();
979 double fA01 = kEdge0.Dot(kEdge1);
980 double fA11 = kEdge1.SquaredLength();
981 double fB0 = kDiff.Dot(kEdge0);
982 double fB1 = kDiff.Dot(kEdge1);
983 double fC = kDiff.SquaredLength();
984 double fDet = fabs(fA00 * fA11 - fA01 * fA01);
985 double fS = fA01 * fB1 - fA11 * fB0;
986 double fT = fA01 * fB0 - fA00 * fB1;
987 double fSqrDistance;
988
989 if (fS + fT <= fDet) {
990 if (fS < (double)0.0) {
991 if (fT < (double)0.0) // region 4
992 {
993 if (fB0 < (double)0.0) {
994 fT = (double)0.0;
995 if (-fB0 >= fA00) {
996 fS = (double)1.0;
997 fSqrDistance = fA00 + ((double)2.0) * fB0 + fC;
998 } else {
999 fS = -fB0 / fA00;
1000 fSqrDistance = fB0 * fS + fC;
1001 }
1002 } else {
1003 fS = (double)0.0;
1004 if (fB1 >= (double)0.0) {
1005 fT = (double)0.0;
1006 fSqrDistance = fC;
1007 } else if (-fB1 >= fA11) {
1008 fT = (double)1.0;
1009 fSqrDistance = fA11 + ((double)2.0) * fB1 + fC;
1010 } else {
1011 fT = -fB1 / fA11;
1012 fSqrDistance = fB1 * fT + fC;
1013 }
1014 }
1015 } else // region 3
1016 {
1017 fS = (double)0.0;
1018 if (fB1 >= (double)0.0) {
1019 fT = (double)0.0;
1020 fSqrDistance = fC;
1021 } else if (-fB1 >= fA11) {
1022 fT = (double)1.0;
1023 fSqrDistance = fA11 + ((double)2.0) * fB1 + fC;
1024 } else {
1025 fT = -fB1 / fA11;
1026 fSqrDistance = fB1 * fT + fC;
1027 }
1028 }
1029 } else if (fT < (double)0.0) // region 5
1030 {
1031 fT = (double)0.0;
1032 if (fB0 >= (double)0.0) {
1033 fS = (double)0.0;
1034 fSqrDistance = fC;
1035 } else if (-fB0 >= fA00) {
1036 fS = (double)1.0;
1037 fSqrDistance = fA00 + ((double)2.0) * fB0 + fC;
1038 } else {
1039 fS = -fB0 / fA00;
1040 fSqrDistance = fB0 * fS + fC;
1041 }
1042 } else // region 0
1043 {
1044 // minimum at interior point
1045 double fInvDet = ((double)1.0) / fDet;
1046 fS *= fInvDet;
1047 fT *= fInvDet;
1048 fSqrDistance = fS * (fA00 * fS + fA01 * fT + ((double)2.0) * fB0) +
1049 fT * (fA01 * fS + fA11 * fT + ((double)2.0) * fB1) + fC;
1050 }
1051 } else {
1052 double fTmp0, fTmp1, fNumer, fDenom;
1053
1054 if (fS < (double)0.0) // region 2
1055 {
1056 fTmp0 = fA01 + fB0;
1057 fTmp1 = fA11 + fB1;
1058 if (fTmp1 > fTmp0) {
1059 fNumer = fTmp1 - fTmp0;
1060 fDenom = fA00 - 2.0f * fA01 + fA11;
1061 if (fNumer >= fDenom) {
1062 fS = (double)1.0;
1063 fT = (double)0.0;
1064 fSqrDistance = fA00 + ((double)2.0) * fB0 + fC;
1065 } else {
1066 fS = fNumer / fDenom;
1067 fT = (double)1.0 - fS;
1068 fSqrDistance = fS * (fA00 * fS + fA01 * fT + 2.0f * fB0) +
1069 fT * (fA01 * fS + fA11 * fT + ((double)2.0) * fB1) + fC;
1070 }
1071 } else {
1072 fS = (double)0.0;
1073 if (fTmp1 <= (double)0.0) {
1074 fT = (double)1.0;
1075 fSqrDistance = fA11 + ((double)2.0) * fB1 + fC;
1076 } else if (fB1 >= (double)0.0) {
1077 fT = (double)0.0;
1078 fSqrDistance = fC;
1079 } else {
1080 fT = -fB1 / fA11;
1081 fSqrDistance = fB1 * fT + fC;
1082 }
1083 }
1084 } else if (fT < (double)0.0) // region 6
1085 {
1086 fTmp0 = fA01 + fB1;
1087 fTmp1 = fA00 + fB0;
1088 if (fTmp1 > fTmp0) {
1089 fNumer = fTmp1 - fTmp0;
1090 fDenom = fA00 - ((double)2.0) * fA01 + fA11;
1091 if (fNumer >= fDenom) {
1092 fT = (double)1.0;
1093 fS = (double)0.0;
1094 fSqrDistance = fA11 + ((double)2.0) * fB1 + fC;
1095 } else {
1096 fT = fNumer / fDenom;
1097 fS = (double)1.0 - fT;
1098 fSqrDistance = fS * (fA00 * fS + fA01 * fT + ((double)2.0) * fB0) +
1099 fT * (fA01 * fS + fA11 * fT + ((double)2.0) * fB1) + fC;
1100 }
1101 } else {
1102 fT = (double)0.0;
1103 if (fTmp1 <= (double)0.0) {
1104 fS = (double)1.0;
1105 fSqrDistance = fA00 + ((double)2.0) * fB0 + fC;
1106 } else if (fB0 >= (double)0.0) {
1107 fS = (double)0.0;
1108 fSqrDistance = fC;
1109 } else {
1110 fS = -fB0 / fA00;
1111 fSqrDistance = fB0 * fS + fC;
1112 }
1113 }
1114 } else // region 1
1115 {
1116 fNumer = fA11 + fB1 - fA01 - fB0;
1117 if (fNumer <= (double)0.0) {
1118 fS = (double)0.0;
1119 fT = (double)1.0;
1120 fSqrDistance = fA11 + ((double)2.0) * fB1 + fC;
1121 } else {
1122 fDenom = fA00 - 2.0f * fA01 + fA11;
1123 if (fNumer >= fDenom) {
1124 fS = (double)1.0;
1125 fT = (double)0.0;
1126 fSqrDistance = fA00 + ((double)2.0) * fB0 + fC;
1127 } else {
1128 fS = fNumer / fDenom;
1129 fT = (double)1.0 - fS;
1130 fSqrDistance = fS * (fA00 * fS + fA01 * fT + ((double)2.0) * fB0) +
1131 fT * (fA01 * fS + fA11 * fT + ((double)2.0) * fB1) + fC;
1132 }
1133 }
1134 }
1135 }
1136
1137 // account for numerical round-off error
1138 if (fSqrDistance < (double)0.0) {
1139 fSqrDistance = (double)0.0;
1140 }
1141 /*
1142 m_kClosestPoint0 = punct;
1143 m_kClosestPoint1 = m_rkTriangle.V[0] + fS*kEdge0 + fT*kEdge1;
1144 m_afTriangleBary[1] = fS;
1145 m_afTriangleBary[2] = fT;
1146 m_afTriangleBary[0] = (double)1.0 - fS - fT;
1147 */
1148 return sqrt(fSqrDistance);
1149}
1150
This Class provides basic 3D box objects.
Definition GbCuboid3D.h:53
GbPoint3D * getPoint1()
Definition GbCuboid3D.h:65
This Class provides basic 3D line objects.
Definition GbLine3D.h:59
GbPoint3D * getPoint1()
Definition GbLine3D.h:95
GbPoint3D * getPoint2()
Definition GbLine3D.h:96
This Class provides basic 3D point objects.
Definition GbPoint3D.h:49
void setX2(const double &x2)
Definition GbPoint3D.h:71
double x1
Definition GbPoint3D.h:121
double getX3Coordinate() const
Definition GbPoint3D.h:84
void setX3(const double &x3)
Definition GbPoint3D.h:76
double getX1Coordinate() const
Definition GbPoint3D.h:82
void setX1(const double &x1)
Definition GbPoint3D.h:66
double getX2Coordinate() const
Definition GbPoint3D.h:83
This Class provides basic 3D polygon objects.
Definition GbPolygon3D.h:53
This Class provides basic 3D triangle objects.
std::vector< GbPoint3D * > points
GbPoint3D * getPoint2()
GbPoint3D * getPoint1()
GbPoint3D * getPoint3()
GbVector3D normal
This Class provides basic 3D vector objects.
Definition GbVector3D.h:47
std::shared_ptr< T > SPtr
GbVector3D Cross(const GbVector3D &rkV) const
double getX1Maximum() override
int contains(GbPoint3D *point)
double calculateDistanceToPoint3D(GbPoint3D *point)
~GbTriangle3D() override
GbVector3D getNormal()
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
double SquaredLength() const
double Length() const
double getX3Minimum() override
GbPoint3D * getPoint(const int &index)
double getDistanceFromPoint(GbVector3D punct)
void setPoint(GbPoint3D *point, int index)
double getX1Centroid() override
void calculateNormal()
GbLine3D * createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2) override
double getX2Maximum() override
double getX2Centroid() override
GbTriangle3D * clone() override
double getX1Minimum() override
std::string toString() override
GbPolygon3D * createClippedPolygon3D(GbCuboid3D *cube)
double calculateNormalizedDistanceToPoint3D(const double &x1, const double &y1, const double &z1, const double &x2, const double &y2, const double &z2)
bool enclosesPoint2D(double x1, double x2)
double getX3Maximum() override
int containsEqual(GbPoint3D *point)
virtual void calculateValues()
GbPoint3D * calculateIntersectionPoints3D(GbLine3D *line)
double getIntersectionRaytraceFactor(const double &x1, const double &x2, const double &x3, const double &rx1, const double &rx2, const double &rx3) override
std::vector< GbPoint3D > getPoints()
double getX3Centroid() override
double Normalize()
double Dot(const GbVector3D &rkV) const
double getX2Minimum() override
#define UB_EXARGS
Definition UbException.h:73
GbPoint3D * calculateIntersectionPoint3D(GbPoint3D &p11, GbPoint3D &p12, GbPoint3D &p21, GbPoint3D &p22)
GbPolygon3D * clipPolygon3D(std::vector< GbPoint3D > points, double x11, double x12, double x13, double x21, double x22, double x23)
bool greater(const T1 &value, const T2 &reference)
Definition UbMath.h:216
T ACos(const T &fValue)
Definition UbMath.h:255
bool zero(const T &value)
Definition UbMath.h:139
bool less(const T1 &value, const T2 &reference)
Definition UbMath.h:202