ComplexGeoData.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _AppComplexGeoData_h_
00025 #define _AppComplexGeoData_h_
00026
00027 #include <Base/Placement.h>
00028 #include <Base/Persistence.h>
00029 #include <Base/Handle.h>
00030 #include <Base/Matrix.h>
00031 #include <Base/BoundBox.h>
00032 #include <Base/Rotation.h>
00033
00034 #ifdef __GNUC__
00035 # include <stdint.h>
00036 #endif
00037
00038
00039 namespace Data
00040 {
00041
00046 class AppExport Segment: public Base::BaseClass
00047 {
00048 TYPESYSTEM_HEADER();
00049
00050 public:
00051 virtual std::string getName() const=0;
00052 };
00053
00054
00057 class AppExport ComplexGeoData: public Base::Persistence, public Base::Handled
00058 {
00059 TYPESYSTEM_HEADER();
00060
00061 public:
00062 struct Line {uint32_t I1; uint32_t I2;};
00063 struct Facet {uint32_t I1; uint32_t I2; uint32_t I3;};
00064
00066 ComplexGeoData(void);
00068 virtual ~ComplexGeoData();
00069
00076 virtual std::vector<const char*> getElementTypes(void) const=0;
00077 virtual unsigned long countSubElements(const char* Type) const=0;
00079 virtual Segment* getSubElement(const char* Type, unsigned long) const=0;
00081 virtual Segment* getSubElementByName(const char* Name) const;
00083 virtual void getLinesFromSubelement(
00084 const Segment*,
00085 std::vector<Base::Vector3d> &Points,
00086 std::vector<Line> &lines) const {}
00088 virtual void getFacesFromSubelement(
00089 const Segment*,
00090 std::vector<Base::Vector3d> &Points,
00091 std::vector<Base::Vector3d> &PointNormals,
00092 std::vector<Facet> &faces) const {}
00094
00098 void applyTransform(const Base::Matrix4D& rclTrf);
00100 void applyTranslation(const Base::Vector3d&);
00102 void applyRotation(const Base::Rotation&);
00106 void setPlacement(const Base::Placement& rclPlacement);
00110 Base::Placement getPlacement() const;
00115 virtual void setTransform(const Base::Matrix4D& rclTrf)=0;
00120 virtual Base::Matrix4D getTransform(void) const = 0;
00122
00125
00126 virtual void transformGeometry(const Base::Matrix4D &rclMat) = 0;
00128
00131
00132 virtual Base::BoundBox3d getBoundBox(void)const=0;
00134 virtual Base::Vector3d getPointFromLineIntersection(
00135 const Base::Vector3f& Base,
00136 const Base::Vector3f& Dir) const
00137 { return Base::Vector3d(); }
00139 virtual void getPoints(std::vector<Base::Vector3d> &Points,
00140 float Accuracy, uint16_t flags=0) const {};
00142 virtual void getLines(std::vector<Base::Vector3d> &Points,std::vector<Line> &lines,
00143 float Accuracy, uint16_t flags=0) const {};
00145 virtual void getFaces(std::vector<Base::Vector3d> &Points,std::vector<Facet> &faces,
00146 float Accuracy, uint16_t flags=0) const {};
00148
00149 protected:
00150
00152 inline Base::Vector3d transformToOutside(const Base::Vector3f& vec) const
00153 {
00154 return getTransform() * Base::Vector3d(vec.x,vec.y,vec.z);
00155 }
00156
00158 inline Base::Vector3f transformToInside(const Base::Vector3d& vec) const
00159 {
00160 Base::Matrix4D tmpM(getTransform());
00161 tmpM.inverse();
00162 Base::Vector3d tmp = tmpM * vec;
00163 return Base::Vector3f((float)tmp.x,(float)tmp.y,(float)tmp.z);
00164 }
00165
00166
00167 };
00168
00169 }
00170
00171
00172 #endif