Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRectangle.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #include "Tympan/core/logging.h"
17 #include "Tympan/core/defines.h"
22 #if TY_USE_IHM
25 #endif
26 #include "TYRectangle.h"
27 
30 
31 const int TYRectangle::_nbPts = 4;
32 
34 {
36 
37  static const float defaultLon = 1.0;
38  static const float defaultLarg = 1.0;
39 
40  setDimension(defaultLon, defaultLarg);
41 }
42 
44 {
45  *this = other;
46 }
47 
48 TYRectangle::TYRectangle(const TYPoint& pt0, const TYPoint& pt1, const TYPoint& pt2, const TYPoint& pt3)
49 {
51 
52  _pts[0] = pt0;
53  _pts[1] = pt1;
54  _pts[2] = pt2;
55  _pts[3] = pt3;
56 
57  // Calcul du plan sous jascent a la face
58  _plan = plan();
59 
60  // Calcul du rectangle englobant
61  OPoint3D pts[4];
62 
63  for (int i = 0; i < 4; i++)
64  {
65  pts[i] = _pts[i];
66  }
67  OPoint3D ptMin, ptMax;
68 
69  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
70 
71  _box._max = ptMax;
72  _box._min = ptMin;
73 
74  // Calcul de la normale
75  _normale = normal();
76 }
77 
78 TYRectangle::TYRectangle(const TYSegment& seg0, const TYSegment& seg1)
79 {
81 
82  _pts[0] = seg0._ptA;
83  _pts[1] = seg0._ptB;
84  _pts[2] = seg1._ptB;
85 
86  OVector3D vecPt0(_pts[0]);
87  OVector3D vecPt1(_pts[1]);
88  OVector3D vecPt2(_pts[2]);
89 
90  OVector3D vecBC = vecPt2 - vecPt1;
91  OVector3D vecPt3 = vecBC + vecPt0;
92 
93  _pts[3] = vecPt3;
94 
95  // Calcul du plan sous jascent a la face
96  _plan = plan();
97 
98  // Calcul du rectangle englobant
99  OPoint3D pts[4];
100 
101  for (int i = 0; i < 4; i++)
102  {
103  pts[i] = _pts[i];
104  }
105  OPoint3D ptMin, ptMax;
106 
107  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
108 
109  _box._max = ptMax;
110  _box._min = ptMin;
111 
112  // Calcul de la normale
113  _normale = normal();
114 }
115 
117 
119 {
120  _pts[0] = pt0;
121  _pts[1] = pt1;
122  _pts[2] = pt2;
123  _pts[3] = pt3;
124 
125  // Calcul du plan sous jascent a la face
126  _plan = plan();
127 
128  // Calcul du rectangle englobant
129  OPoint3D pts[4];
130 
131  for (int i = 0; i < 4; i++)
132  {
133  pts[i] = _pts[i];
134  }
135  OPoint3D ptMin, ptMax;
136 
137  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
138 
139  _box._max = ptMax;
140  _box._min = ptMin;
141 
142  // Calcul de la normale
143  _normale = normal();
144 
145  setIsGeometryModified(true);
146 }
147 
148 void TYRectangle::setDimension(float lon, float haut)
149 {
150  float demiLon = lon / 2.0;
151  float demiHaut = haut / 2.0;
152 
153  _pts[0].set(-demiLon, demiHaut, 0);
154  _pts[1].set(demiLon, demiHaut, 0);
155  _pts[2].set(demiLon, -demiHaut, 0);
156  _pts[3].set(-demiLon, -demiHaut, 0);
157 
158  // Calcul du plan sous jascent a la face
159  _plan = plan();
160 
161  // Calcul du rectangle englobant
162  OPoint3D pts[4];
163 
164  for (int i = 0; i < 4; i++)
165  {
166  pts[i] = _pts[i];
167  }
168  OPoint3D ptMin, ptMax;
169 
170  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
171 
172  _box._max = ptMax;
173  _box._min = ptMin;
174 
175  // Calcul de la normale
176  _normale = normal();
177 
178  setIsGeometryModified(true);
179 }
180 
181 void TYRectangle::setSize(float sizeX, float sizeY)
182 {
183  setDimension(sizeX, sizeY);
184 }
185 
186 void TYRectangle::getSize(float& sizeX, float& sizeY)
187 {
188  sizeX = getSizeX();
189  sizeY = getSizeY();
190 }
191 
193 {
194  return OVector3D(_pts[0], _pts[1]).norme();
195 }
196 
198 {
199  return OVector3D(_pts[1], _pts[2]).norme();
200 }
201 
202 double TYRectangle::getMinX() const
203 {
204  double minX = _pts[0]._x;
205  for (unsigned int i = 0; i < 3; ++i)
206  if (_pts[i + 1]._x < minX)
207  {
208  minX = _pts[i + 1]._x;
209  }
210 
211  return minX;
212 }
213 
214 double TYRectangle::getMinY() const
215 {
216  double minY = _pts[0]._y;
217  for (unsigned int i = 0; i < 3; ++i)
218  if (_pts[i + 1]._y < minY)
219  {
220  minY = _pts[i + 1]._y;
221  }
222 
223  return minY;
224 }
225 
226 double TYRectangle::getMaxY() const
227 {
228  double maxY = _pts[0]._y;
229  for (unsigned int i = 0; i < 3; ++i)
230  if (_pts[i + 1]._y > maxY)
231  {
232  maxY = _pts[i + 1]._y;
233  }
234 
235  return maxY;
236 }
237 
238 void TYRectangle::scale(float factorX, float factorY)
239 {
240  int i = 0;
241  for (i = 0; i < 4; i++)
242  {
243  _pts[i]._x *= factorX;
244  _pts[i]._y *= factorY;
245  }
246 
247  // Calcul du plan sous jascent a la face
248  _plan = plan();
249 
250  // Calcul du rectangle englobant
251  OPoint3D pts[4];
252 
253  for (i = 0; i < 4; i++)
254  {
255  pts[i] = _pts[i];
256  }
257  OPoint3D ptMin, ptMax;
258 
259  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
260 
261  _box._max = ptMax;
262  _box._min = ptMin;
263 
264  // Calcul de la normale
265  _normale = normal();
266 
267  setIsGeometryModified(true);
268 }
269 
271 {
272  double longueur = (_pts[2]._x - _pts[0]._x) * (_pts[2]._x - _pts[0]._x) +
273  (_pts[2]._y - _pts[0]._y) * (_pts[2]._y - _pts[0]._y) +
274  (_pts[2]._z - _pts[0]._z) * (_pts[2]._z - _pts[0]._z);
275  return sqrt(longueur);
276 }
277 
279 {
280  return sqrt(surface() / M_PI) * 2.0;
281 }
282 
283 bool TYRectangle::intersectRect(LPTYRectangle pRect, TYPoint originRect /* = TYPoint(0,0,0)*/,
284  TYPoint origin /* = TYPoint(0,0,0)*/)
285 {
286  int i = 0;
287 
288  TYTabPoint tabPtMid;
289  tabPtMid.push_back(TYSegment(_pts[0], _pts[1]).centreOf());
290  tabPtMid.push_back(TYSegment(_pts[1], _pts[2]).centreOf());
291  tabPtMid.push_back(TYSegment(_pts[2], _pts[3]).centreOf());
292  tabPtMid.push_back(TYSegment(_pts[3], _pts[0]).centreOf());
293 
294  for (i = 0; i < 4; i++)
295  {
296  if (((tabPtMid[i]._x + origin._x) < (pRect->_pts[2]._x + originRect._x)) &&
297  ((tabPtMid[i]._x + origin._x) > (pRect->_pts[3]._x + originRect._x)) &&
298  ((tabPtMid[i]._y + origin._y) > (pRect->_pts[2]._y + originRect._y)) &&
299  ((tabPtMid[i]._y + origin._y) < (pRect->_pts[0]._y + originRect._y)))
300  {
301  return true;
302  }
303  }
304 
305  for (i = 0; i < 4; i++)
306  {
307  if (((_pts[i]._x + origin._x) < (pRect->_pts[2]._x + originRect._x)) &&
308  ((_pts[i]._x + origin._x) > (pRect->_pts[3]._x + originRect._x)) &&
309  ((_pts[i]._y + origin._y) > (pRect->_pts[2]._y + originRect._y)) &&
310  ((_pts[i]._y + origin._y) < (pRect->_pts[0]._y + originRect._y)))
311  {
312  return true;
313  }
314  }
315 
316  tabPtMid.clear();
317 
318  tabPtMid.push_back(TYSegment(pRect->_pts[0], pRect->_pts[1]).centreOf());
319  tabPtMid.push_back(TYSegment(pRect->_pts[1], pRect->_pts[2]).centreOf());
320  tabPtMid.push_back(TYSegment(pRect->_pts[2], pRect->_pts[3]).centreOf());
321  tabPtMid.push_back(TYSegment(pRect->_pts[3], pRect->_pts[0]).centreOf());
322 
323  for (i = 0; i < 4; i++)
324  {
325  if (((tabPtMid[i]._x + originRect._x) < (_pts[2]._x + origin._x)) &&
326  ((tabPtMid[i]._x + originRect._x) > (_pts[3]._x + origin._x)) &&
327  ((tabPtMid[i]._y + originRect._y) > (_pts[2]._y + origin._y)) &&
328  ((tabPtMid[i]._y + originRect._y) < (_pts[0]._y + origin._y)))
329  {
330  return true;
331  }
332  }
333 
334  for (i = 0; i < 4; i++)
335  {
336  if (((pRect->_pts[i]._x + originRect._x) < (_pts[2]._x + origin._x)) &&
337  ((pRect->_pts[i]._x + originRect._x) > (_pts[3]._x + origin._x)) &&
338  ((pRect->_pts[i]._y + originRect._y) > (_pts[2]._y + origin._y)) &&
339  ((pRect->_pts[i]._y + originRect._y) < (_pts[0]._y + origin._y)))
340  {
341  return true;
342  }
343  }
344 
345  return false;
346 }
347 
349 {
350  if (this != &other)
351  {
352  TYElement::operator=(other);
353  for (int i = 0; i < 4; i++)
354  {
355  _pts[i] = other._pts[i];
356  }
357  }
358 
359  // Calcul du plan sous jascent a la face
360  _plan = plan();
361 
362  // Calcul du rectangle englobant
363  OPoint3D pts[4];
364 
365  for (int i = 0; i < 4; i++)
366  {
367  pts[i] = _pts[i];
368  }
369  OPoint3D ptMin, ptMax;
370 
371  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
372 
373  _box._max = ptMax;
374  _box._min = ptMin;
375 
376  // Calcul de la normale
377  _normale = normal();
378 
379  return *this;
380 }
381 
382 bool TYRectangle::operator==(const TYRectangle& other) const
383 {
384  if (this != &other)
385  {
386  if (TYElement::operator!=(other))
387  {
388  return false;
389  }
390  for (int i = 0; i < 4; i++)
391  if (_pts[i] != other._pts[i])
392  {
393  return false;
394  }
395  }
396  return true;
397 }
398 
399 bool TYRectangle::operator!=(const TYRectangle& other) const
400 {
401  return !operator==(other);
402 }
403 
404 bool TYRectangle::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
405 {
406  if (!TYElement::deepCopy(pOther, copyId))
407  {
408  return false;
409  }
410 
411  int i = 0;
412 
413  for (i = 0; i < 4; i++)
414  {
415  TYPoint pt;
416  pt.deepCopy(&((TYRectangle*)pOther)->_pts[i], copyId);
417  _pts[i] = pt;
418  }
419 
420  // Calcul du plan sous jascent a la face
421  _plan = plan();
422 
423  // Calcul du rectangle englobant
424  OPoint3D pts[4];
425 
426  for (i = 0; i < 4; i++)
427  {
428  pts[i] = _pts[i];
429  }
430  OPoint3D ptMin, ptMax;
431 
432  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
433 
434  _box._max = ptMax;
435  _box._min = ptMin;
436 
437  // Calcul de la normale
438  _normale = normal();
439 
440  return true;
441 }
442 
443 std::string TYRectangle::toString() const
444 {
445  std::string str = "TYRectangle";
446  for (int i = 0; i < 4; i++)
447  {
448  str += "\n\tPt" + intToStr(i) + "=" + _pts[i].toString();
449  }
450  return str;
451 }
452 
454 {
455  DOM_Element domNewElem = TYElement::toXML(domElement);
456 
457  _pts[0].toXML(domNewElem);
458  _pts[1].toXML(domNewElem);
459  _pts[2].toXML(domNewElem);
460  _pts[3].toXML(domNewElem);
461 
462  return domNewElem;
463 }
464 
466 {
467  TYElement::fromXML(domElement);
468 
469  int ptNb = 0;
470  unsigned int i = 0;
471  DOM_Element elemCur;
472 
473  QDomNodeList childs = domElement.childNodes();
474 
475  for (i = 0; i < childs.length(); i++)
476  {
477  elemCur = childs.item(i).toElement();
478 
479  if (ptNb < 4)
480  {
481  // Increment l'indice si le pt est trouve
482  _pts[ptNb].callFromXMLIfEqual(elemCur) ? ptNb++ : ptNb;
483  }
484  }
485 
486  // Calcul du plan sous jascent a la face
487  _plan = plan();
488 
489  // Calcul du rectangle englobant
490  OPoint3D pts[4];
491 
492  for (i = 0; i < 4; i++)
493  {
494  pts[i] = _pts[i];
495  }
496  OPoint3D ptMin, ptMax;
497 
498  OGeometrie::boundingBox(pts, _nbPts, ptMin, ptMax);
499 
500  _box._max = ptMax;
501  _box._min = ptMin;
502 
503  // Calcul de la normale
504  _normale = normal();
505 
506  return 1;
507 }
508 
509 double TYRectangle::surface() const
510 {
511  // Largeur x Longeur
512  TYSegment segLargeur(_pts[0], _pts[1]);
513  TYSegment segLongueur(_pts[1], _pts[2]);
514 
515  return (segLargeur.longueur() * segLongueur.longueur());
516 }
517 
519 {
520  // On calcul la normale avec les 3 1ers points
521  OVector3D vecPt0(_pts[0]);
522  OVector3D vecPt1(_pts[1]);
523  OVector3D vecPt2(_pts[2]);
524 
525  // On inverse le signe afin de respecter la convention definie
526  // pour le sens de rotation du numero des points (horaire)
527  return (vecPt0.normal(vecPt1, vecPt2) * (-1));
528  // return (vecPt0.normal(vecPt1, vecPt2));
529 }
530 
532 {
533  return OPlan(_pts[0], _pts[1], _pts[2]);
534 }
535 
537 {
538  TYTabPoint tab;
539 
540  for (int i = 0; i < 4; i++)
541  {
542  tab.push_back(_pts[i]);
543  }
544 
545  return tab;
546 }
547 
549 {
550  TYTabPoint tab;
551 
552  for (int i = 0; i < 4; i++)
553  {
554  tab.push_back(_pts[i]);
555  }
556  // Closing rectangle
557  tab.push_back(_pts[0]);
558  return tab;
559 }
560 
562 {
563  TYTabPoint3D tab;
564 
565  for (int i = 0; i < 4; i++)
566  {
567  tab.push_back(_pts[i]);
568  }
569 
570  return tab;
571 }
572 
574 {
575  return TYSurfaceInterface::intersects(pSurf, seg);
576 }
577 
578 int TYRectangle::intersects(const OSegment3D& seg, OPoint3D& pt) const
579 {
580  int res = INTERS_NULLE;
581 
582  // On cherche le pt d'intersection avec le plan
583  res = _plan.intersectsSegment(seg._ptA, seg._ptB, pt);
584 
585  if (res != INTERS_NULLE)
586  {
587  // Il faut ensuite tester si le point d'intersection trouve
588  // est inclu dans le rectangle
589  res = intersects(pt);
590  }
591 
592  return res;
593 }
594 
595 int TYRectangle::intersects(const OPoint3D& pt) const
596 {
597  int res = INTERS_NULLE;
598 
599  // Test
600 #if TY_USE_IHM
602  {
603 #else
605  {
606 #endif
607  res = INTERS_OUI;
608  }
609 
610  return res;
611 }
612 
614 {
615  // 4 points -> 4 plans possibles
616  OPlan plans[4];
617  int i = 0;
618  plans[0] = OPlan(_pts[0], _pts[1], _pts[2]);
619  plans[1] = OPlan(_pts[0], _pts[1], _pts[3]);
620  plans[2] = OPlan(_pts[0], _pts[2], _pts[3]);
621  plans[3] = OPlan(_pts[1], _pts[2], _pts[3]);
622 
623  // On arrondi avec la prise en compte du seuil de precision
624  for (i = 0; i < 4; i++)
625  {
626  plans[i]._a = ROUND(plans[i]._a / TYSEUILCONFONDUS);
627  plans[i]._b = ROUND(plans[i]._b / TYSEUILCONFONDUS);
628  plans[i]._c = ROUND(plans[i]._c / TYSEUILCONFONDUS);
629  plans[i]._d = ROUND(plans[i]._d / TYSEUILCONFONDUS);
630  }
631 
632  // Les plans doivent etre les memes
633  for (i = 0; i < 3; i++)
634  {
635  if (plans[i] != plans[i + 1])
636  {
637  return false;
638  }
639  }
640 
641  // 4 points -> 4 vecteurs
642  OVector3D vecs[4];
643  vecs[0] = OVector3D(_pts[0], _pts[1]);
644  vecs[1] = OVector3D(_pts[1], _pts[2]);
645  vecs[2] = OVector3D(_pts[2], _pts[3]);
646  vecs[3] = OVector3D(_pts[3], _pts[0]);
647 
648  // Les vecteurs doivent etre orthogonaux => produit scalaire nul
649  for (i = 0; i < 3; i++)
650  {
651  if (ABS(vecs[i].scalar(vecs[i + 1])) > TYSEUILCONFONDUS)
652  {
653  return false;
654  }
655  }
656 
657  return true;
658 }
659 
661 {
662  ORepere3D repere;
663 
664  repere._origin = _pts[3];
665  repere._vecI = OVector3D(_pts[3], _pts[2]);
666  repere._vecI.normalize();
667  repere._vecJ = OVector3D(_pts[3], _pts[0]);
668  repere._vecJ.normalize();
669  repere._vecK = normal();
670  repere._vecK.normalize();
671 
672  return repere;
673 }
674 
676 {
677  TYTabPoint tabpoints;
678 
679  for (int i = 0; i < 4; i++)
680  {
681  tabpoints.push_back(_pts[i]);
682  }
683 
684  return new TYPolygon(tabpoints);
685 }
686 
688 {
689  // inversion de deux points en diagonale
690  TYPoint tmp;
691  tmp = _pts[0];
692  _pts[0] = _pts[2];
693  _pts[2] = tmp;
694 
695  // Calcul de la normale
696  _normale = normal();
697 }
698 
699 void TYRectangle::exportMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
700  const TYGeometryNode& geonode) const
701 {
702  assert(points.size() == 0 && "Output arguments 'points' is expected to be initially empty");
703  assert(triangles.size() == 0 && "Output arguments 'triangles' is expected to be initially empty");
704 
705  // exports the point to the mesh, converting to global r/ frame
706  for (int i = 0; i < 4; ++i)
707  {
708  points.push_back(geonode.localToGlobal() * _pts[i]);
709  }
710  // exports triangle (0, 1, 2)
711  OTriangle tri(0, 1, 2);
712  // Use already converted to global r/ frame points
713  tri._p1 = 0;
714  tri._A = points[0];
715  tri._p2 = 3;
716  tri._B = points[3];
717  tri._p3 = 2;
718  tri._C = points[2];
719  triangles.push_back(tri);
720  // exports triangle (0, 2, 3)
721  tri._p1 = 0;
722  tri._A = points[0];
723  tri._p2 = 2;
724  tri._B = points[2];
725  tri._p3 = 1;
726  tri._C = points[1];
727  triangles.push_back(tri);
728 }
All base classes related to 3D manipulation.
#define TYSEUILCONFONDUS
Definition: 3d.h:47
int ROUND(double a)
Compute the rounded value of a number.
Definition: 3d.h:192
#define INTERS_OUI
The intersection exists.
Definition: 3d.h:33
double ABS(double a)
Return the absolute value.
Definition: 3d.h:67
#define INTERS_NULLE
No intersection.
Definition: 3d.h:35
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
std::deque< OPoint3D > TYTabPoint3D
Collection de OPoint3D.
Definition: TYDefines.h:403
Representation graphique d'un rectangle (fichier header)
outil IHM pour un rectangle (fichier header)
TY_EXTENSION_INST(TYRectangle)
TY_EXT_GRAPHIC_INST(TYRectangle)
OPoint3D _min
Minimal coordinates of the OBox.
Definition: 3d.h:1371
OPoint3D _max
Maximal coordinates of the OBox.
Definition: 3d.h:1372
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
static void boundingBox(OPoint3D *pts, int nbPts, OPoint3D &ptMin, OPoint3D &ptMax)
Computes the simple bounding box for a volume using min-max method.
Definition: 3d.cpp:1109
static bool pointInPolygonAngleSum(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using angle sum algorithm.
Definition: 3d.cpp:1016
static bool pointInPolygonRayCasting(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using ray casting algorithm.
Definition: 3d.cpp:1046
Plan defined by its equation : ax+by+cz+d=0.
Definition: plan.h:31
int intersectsSegment(const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec) const
Calculate the intersection of this plane with a segment defined by two points.
Definition: plan.cpp:141
double _a
The a parameter in the equation ax+by+cz+d=0.
Definition: plan.h:325
double _c
The c parameter in the equation ax+by+cz+d=0.
Definition: plan.h:329
double _d
The d parameter in the equation ax+by+cz+d=0.
Definition: plan.h:331
double _b
The b parameter in the equation ax+by+cz+d=0.
Definition: plan.h:327
The 3D point class.
Definition: 3d.h:487
virtual void set(double x, double y, double z)
Definition: 3d.cpp:381
virtual const char * getClassName() const
Definition: TYElement.h:249
3D frame with a point and 3 vectors.
Definition: 3d.h:1211
OVector3D _vecK
Vector K for the Z axis.
Definition: 3d.h:1285
OVector3D _vecJ
Vector J for the Y axis.
Definition: 3d.h:1283
OVector3D _vecI
Vector I for the X axis.
Definition: 3d.h:1281
OPoint3D _origin
The origin point.
Definition: 3d.h:1279
Class to define a segment.
Definition: 3d.h:1089
virtual double longueur() const
Return the segment length.
Definition: 3d.cpp:1238
virtual OPoint3D centreOf() const
Return the position of the segment middle.
Definition: 3d.cpp:1294
OPoint3D _ptA
Point A of the segment.
Definition: 3d.h:1201
OPoint3D _ptB
Point B of the segment.
Definition: 3d.h:1203
Triangle class.
Definition: triangle.h:28
OPoint3D _A
First OPoint3D.
Definition: triangle.h:53
int _p1
Index of the first OPoint3D _A.
Definition: triangle.h:49
int _p3
Index of the third OPoint3D _C.
Definition: triangle.h:51
OPoint3D _C
Third OPoint3D.
Definition: triangle.h:55
OPoint3D _B
Second OPoint3D.
Definition: triangle.h:54
int _p2
Index of the second OPoint3D _B.
Definition: triangle.h:50
The 3D vector class.
Definition: 3d.h:298
double norme() const
Computes the length of this vector.
Definition: 3d.cpp:215
OVector3D normal(const OVector3D &vector2, const OVector3D &vector3) const
Computes the normal with this vector and 2 others.
Definition: 3d.cpp:220
void normalize()
Normalizes this vector.
Definition: 3d.cpp:225
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYElement.cpp:307
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYElement.cpp:368
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
TYElement & operator=(const TYElement &other)
Definition: TYElement.cpp:265
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
Definition: TYElement.cpp:544
virtual int fromXML(DOM_Element domElement)
Definition: TYElement.cpp:381
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
OMatrix localToGlobal() const
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
virtual std::string toString() const
Definition: TYPoint.cpp:106
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYPoint.cpp:112
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYPoint.cpp:92
virtual void inverseNormale()
bool operator!=(const TYRectangle &other) const
Operateur !=.
ORepere3D getORepere3D() const
void setSize(float sizeX, float sizeY)
virtual ~TYRectangle()
virtual TYTabPoint getContourFerme(int n=-1) const
virtual DOM_Element toXML(DOM_Element &domElement)
float getSizeX()
bool isValid() const
virtual int intersects(const TYSurfaceInterface *pSurf, OSegment3D &seg) const
OVector3D _normale
Definition: TYRectangle.h:277
double getDiagSize()
double getMaxY() const
virtual OPlan plan() const
void scale(float factorX, float factorY)
void setDimension(float lon, float haut)
bool intersectRect(LPTYRectangle pRect, TYPoint originRect=TYPoint(0, 0, 0), TYPoint origin=TYPoint(0, 0, 0))
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
static const int _nbPts
Definition: TYRectangle.h:279
TYPoint _pts[4]
Sommets.
Definition: TYRectangle.h:274
virtual int fromXML(DOM_Element domElement)
double getMinX() const
TYPolygon * toPolygon() const
double getMinY() const
void set(TYPoint pt0, TYPoint pt1, TYPoint pt2, TYPoint pt3)
virtual TYTabPoint getContour(int n=-1) const
virtual std::string toString() const
bool operator==(const TYRectangle &other) const
Operateur ==.
double getCircleEqDiameter()
virtual OVector3D normal() const
void exportMesh(std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, const TYGeometryNode &geonode) const
Export the surface as a triangular mesh.
virtual TYTabPoint3D getOContour(int n=-1) const
virtual double surface() const
TYRectangle & operator=(const TYRectangle &other)
Operateur =.
float getSizeY()
void getSize(float &sizeX, float &sizeY)
virtual int intersects(const OPoint3D &pt) const =0
#define M_PI
Pi.
Definition: color.cpp:25
std::string intToStr(int val)
Definition: macros.h:158