Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRectangle.h
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 /*
17  *
18  */
19 
20 #ifndef __TY_RECTANGLE__
21 #define __TY_RECTANGLE__
22 
24 #include "TYPoint.h"
25 #include "TYRepere.h"
26 #include "TYPolygon.h"
27 #include "TYSurfaceInterface.h"
28 
33 {
37 
38  // Methodes
39 public:
43  TYRectangle();
47  TYRectangle(const TYRectangle& other);
48 
64  TYRectangle(const TYPoint& pt0, const TYPoint& pt1, const TYPoint& pt2, const TYPoint& pt3);
65 
82  TYRectangle(const TYSegment& seg0, const TYSegment& seg1);
83 
87  virtual ~TYRectangle();
88 
97  void set(TYPoint pt0, TYPoint pt1, TYPoint pt2, TYPoint pt3);
98 
106  void setDimension(float lon, float haut);
107 
116  void setSize(float sizeX, float sizeY);
123  void getSize(float& sizeX, float& sizeY);
129  float getSizeX();
135  float getSizeY();
136 
140  double getMinX() const;
141 
145  double getMinY() const;
146 
150  double getMaxY() const;
151 
156  double getDiagSize();
157 
162  double getCircleEqDiameter();
163 
170  void scale(float factorX, float factorY);
176  void scale(float factor)
177  {
178  scale(factor, factor);
179  }
180 
190  bool intersectRect(LPTYRectangle pRect, TYPoint originRect = TYPoint(0, 0, 0),
191  TYPoint origin = TYPoint(0, 0, 0));
192 
194  TYRectangle& operator=(const TYRectangle& other);
196  bool operator==(const TYRectangle& other) const;
198  bool operator!=(const TYRectangle& other) const;
199 
208  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
209 
210  virtual std::string toString() const;
211 
212  virtual DOM_Element toXML(DOM_Element& domElement);
213  virtual int fromXML(DOM_Element domElement);
214 
215  virtual double surface() const;
216  virtual OVector3D normal() const;
217  virtual OPlan plan() const;
218  virtual TYTabPoint getContour(int n = -1) const;
219  virtual TYTabPoint getContourFerme(int n = -1) const;
220  virtual TYTabPoint3D getOContour(int n = -1) const;
221  virtual int intersects(const TYSurfaceInterface* pSurf, OSegment3D& seg) const;
222  virtual int intersects(const OSegment3D& seg, OPoint3D& pt) const;
223  virtual int intersects(const OPoint3D& pt) const;
224 
233  bool isValid() const;
234 
238  ORepere3D getORepere3D() const;
239 
247  TYPolygon* toPolygon() const;
248 
252  virtual const OPlan& getPlan() const
253  {
254  return _plan;
255  }
256 
257  virtual void inverseNormale();
258 
268  void exportMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
269  const TYGeometryNode& geonode) const;
270 
271  // Membres
272 public:
278 
279  static const int _nbPts;
280 };
281 
282 #endif // __TY_RECTANGLE__
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
#define TY_EXT_GRAPHIC_DECL_ONLY(classname)
Definition: TYElement.h:432
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
The box class.
Definition: 3d.h:1294
Plan defined by its equation : ax+by+cz+d=0.
Definition: plan.h:31
The 3D point class.
Definition: 3d.h:487
3D frame with a point and 3 vectors.
Definition: 3d.h:1211
Class to define a segment.
Definition: 3d.h:1089
The 3D vector class.
Definition: 3d.h:298
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 const OPlan & getPlan() const
Definition: TYRectangle.h:252
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
void scale(float factor)
Definition: TYRectangle.h:176
TYRectangle & operator=(const TYRectangle &other)
Operateur =.
float getSizeY()
void getSize(float &sizeX, float &sizeY)