37 static const float defaultLon = 1.0;
38 static const float defaultLarg = 1.0;
63 for (
int i = 0; i < 4; i++)
101 for (
int i = 0; i < 4; i++)
131 for (
int i = 0; i < 4; i++)
150 float demiLon = lon / 2.0;
151 float demiHaut = haut / 2.0;
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);
164 for (
int i = 0; i < 4; i++)
205 for (
unsigned int i = 0; i < 3; ++i)
206 if (
_pts[i + 1]._x < minX)
217 for (
unsigned int i = 0; i < 3; ++i)
218 if (
_pts[i + 1]._y < minY)
229 for (
unsigned int i = 0; i < 3; ++i)
230 if (
_pts[i + 1]._y > maxY)
241 for (i = 0; i < 4; i++)
253 for (i = 0; i < 4; i++)
275 return sqrt(longueur);
294 for (i = 0; i < 4; i++)
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)))
305 for (i = 0; i < 4; i++)
307 if (((
_pts[i]._x + origin.
_x) < (pRect->
_pts[2].
_x + originRect.
_x)) &&
323 for (i = 0; i < 4; i++)
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)))
334 for (i = 0; i < 4; i++)
353 for (
int i = 0; i < 4; i++)
365 for (
int i = 0; i < 4; i++)
386 if (TYElement::operator!=(other))
390 for (
int i = 0; i < 4; i++)
413 for (i = 0; i < 4; i++)
426 for (i = 0; i < 4; i++)
445 std::string str =
"TYRectangle";
446 for (
int i = 0; i < 4; i++)
473 QDomNodeList childs = domElement.childNodes();
475 for (i = 0; i < childs.length(); i++)
477 elemCur = childs.item(i).toElement();
492 for (i = 0; i < 4; i++)
527 return (vecPt0.
normal(vecPt1, vecPt2) * (-1));
540 for (
int i = 0; i < 4; i++)
542 tab.push_back(
_pts[i]);
552 for (
int i = 0; i < 4; i++)
554 tab.push_back(
_pts[i]);
557 tab.push_back(
_pts[0]);
565 for (
int i = 0; i < 4; i++)
567 tab.push_back(
_pts[i]);
624 for (i = 0; i < 4; i++)
633 for (i = 0; i < 3; i++)
635 if (plans[i] != plans[i + 1])
649 for (i = 0; i < 3; i++)
679 for (
int i = 0; i < 4; i++)
681 tabpoints.push_back(
_pts[i]);
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");
706 for (
int i = 0; i < 4; ++i)
719 triangles.push_back(tri);
727 triangles.push_back(tri);
All base classes related to 3D manipulation.
int ROUND(double a)
Compute the rounded value of a number.
#define INTERS_OUI
The intersection exists.
double ABS(double a)
Return the absolute value.
#define INTERS_NULLE
No intersection.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
std::deque< OPoint3D > TYTabPoint3D
Collection de OPoint3D.
Representation graphique d'un rectangle (fichier header)
TY_EXTENSION_INST(TYRectangle)
TY_EXT_GRAPHIC_INST(TYRectangle)
OPoint3D _min
Minimal coordinates of the OBox.
OPoint3D _max
Maximal coordinates of the OBox.
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
static void boundingBox(OPoint3D *pts, int nbPts, OPoint3D &ptMin, OPoint3D &ptMax)
Computes the simple bounding box for a volume using min-max method.
static bool pointInPolygonAngleSum(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using angle sum algorithm.
static bool pointInPolygonRayCasting(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using ray casting algorithm.
Plan defined by its equation : ax+by+cz+d=0.
int intersectsSegment(const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec) const
Calculate the intersection of this plane with a segment defined by two points.
double _a
The a parameter in the equation ax+by+cz+d=0.
double _c
The c parameter in the equation ax+by+cz+d=0.
double _d
The d parameter in the equation ax+by+cz+d=0.
double _b
The b parameter in the equation ax+by+cz+d=0.
virtual void set(double x, double y, double z)
virtual const char * getClassName() const
3D frame with a point and 3 vectors.
OVector3D _vecK
Vector K for the Z axis.
OVector3D _vecJ
Vector J for the Y axis.
OVector3D _vecI
Vector I for the X axis.
OPoint3D _origin
The origin point.
Class to define a segment.
virtual double longueur() const
Return the segment length.
virtual OPoint3D centreOf() const
Return the position of the segment middle.
OPoint3D _ptA
Point A of the segment.
OPoint3D _ptB
Point B of the segment.
OPoint3D _A
First OPoint3D.
int _p1
Index of the first OPoint3D _A.
int _p3
Index of the third OPoint3D _C.
OPoint3D _C
Third OPoint3D.
OPoint3D _B
Second OPoint3D.
int _p2
Index of the second OPoint3D _B.
double norme() const
Computes the length of this vector.
OVector3D normal(const OVector3D &vector2, const OVector3D &vector3) const
Computes the normal with this vector and 2 others.
void normalize()
Normalizes this vector.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual DOM_Element toXML(DOM_Element &domElement)
QString _name
Nom courant de l'element.
TYElement & operator=(const TYElement &other)
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
virtual int fromXML(DOM_Element domElement)
virtual void setIsGeometryModified(bool isModified)
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
virtual DOM_Element toXML(DOM_Element &domElement)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual void inverseNormale()
bool operator!=(const TYRectangle &other) const
Operateur !=.
ORepere3D getORepere3D() const
void setSize(float sizeX, float sizeY)
virtual TYTabPoint getContourFerme(int n=-1) const
virtual DOM_Element toXML(DOM_Element &domElement)
virtual int intersects(const TYSurfaceInterface *pSurf, OSegment3D &seg) 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)
virtual int fromXML(DOM_Element domElement)
TYPolygon * toPolygon() 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 =.
void getSize(float &sizeX, float &sizeY)
virtual int intersects(const OPoint3D &pt) const =0
std::string intToStr(int val)