#include <Plane.hpp>


Public Types | |
| enum | ShapeType { sphere = 1, cylinder = 2, cone = 3, cube = 4, plane = 5, torus = 6, union_ = 7, difference = 8, intersection = 9, not_ = 10, infiniteCylinder = 11, infiniteCone = 12, analytic = 13 } |
| typedef std::vector < ConstReferenceCounting < Transform > > | TransformationsList |
Public Member Functions | |
| Plane (const Vertex &normal, const real_t &distance) | |
| Plane (const Cube &c, const size_t &faceNumber) | |
| Plane (const Cylinder &c, const size_t &faceNumber) | |
| Plane (const Cone &c, const size_t &faceNumber) | |
| Plane (const Plane &P) | |
| ~Plane () | |
| ReferenceCounting< Shape > | getCopy () const |
| const TransformationsList & | transformationsList () const |
| void | setTransformationsList (const TransformationsList &l) |
| bool | inside (const TinyVector< 3, real_t > &x) const |
| const ShapeType & | type () const |
| size_t | numberOfTransformations () const |
| void | setTransformation (const Transform &t) |
| TinyVector< 3, real_t > | inverseTransformation (const size_t &i, const TinyVector< 3, real_t > &x) const |
| void | parseTransform (const parsetrans &trans) |
Protected Member Functions | |
| bool | __inShape (const TinyVector< 3, real_t > &x) const |
| std::ostream & | __put (std::ostream &os) const |
| ReferenceCounting< Shape > | __getCopy () const |
Protected Attributes | |
| const ShapeType | __type |
| TransformationsList | __trans |
Private Attributes | |
| TinyVector< 3, real_t > | __normal |
| real_t | __distance |
| TinyVector< 3, real_t > | __unitNormal |
| TinyVector< 3, real_t > | __origine |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Shape &shape) |
Definition at line 37 of file Plane.hpp.
typedef std::vector<ConstReferenceCounting<Transform> > Shape::TransformationsList [inherited] |
enum Shape::ShapeType [inherited] |
This is the list of identifiers used for shapes. Identifiers are mean to be explicit ...
| sphere | |
| cylinder | |
| cone | |
| cube | |
| plane | |
| torus | |
| union_ | |
| difference | |
| intersection | |
| not_ | |
| infiniteCylinder | |
| infiniteCone | |
| analytic |
Definition at line 45 of file Shape.hpp.
00045 { 00046 sphere = 1, 00047 cylinder = 2, 00048 cone = 3, 00049 cube = 4, 00050 plane = 5, 00051 torus = 6, 00052 union_ = 7, 00053 difference = 8, 00054 intersection = 9, 00055 not_ =10, 00056 infiniteCylinder=11, 00057 infiniteCone =12, 00058 analytic =13 00059 };
| Plane::Plane | ( | const Vertex & | normal, | |
| const real_t & | distance | |||
| ) |
Constructor
| normal | normal to the plane | |
| distance | distance to the origine |
Definition at line 143 of file Plane.cpp.
Referenced by __getCopy().
00145 : Shape(plane), 00146 __normal(normal), 00147 __distance(distance), 00148 __unitNormal(1./Norm(__normal)*__normal), 00149 __origine(distance*__unitNormal) 00150 { 00151 ; 00152 }
| Plane::Plane | ( | const Cube & | c, | |
| const size_t & | faceNumber | |||
| ) |
Constructs the plane corresponding to a given face number of a cube
| c | the given cube | |
| faceNumber | the face number |
Definition at line 33 of file Plane.cpp.
References __distance, __normal, __origine, __unitNormal, Cube::higherCorner(), Cube::lowerCorner(), Shape::setTransformationsList(), Shape::transformationsList(), and ErrorHandler::unexpected.
00035 : Shape(Shape::plane) 00036 { 00037 switch(faceNumber) { 00038 case 0: { 00039 __unitNormal = __normal = TinyVector<3, real_t>(-1,0,0); 00040 __distance = -c.lowerCorner(0); 00041 __origine = __distance*__unitNormal; 00042 break; 00043 } 00044 case 1: { 00045 __unitNormal = __normal = TinyVector<3, real_t>(0,-1,0); 00046 __distance = -c.lowerCorner(1); 00047 __origine = __distance*__unitNormal; 00048 break; 00049 } 00050 case 2: { 00051 __unitNormal = __normal = TinyVector<3, real_t>(0,0,-1); 00052 __distance = -c.lowerCorner(2); 00053 __origine = __distance*__unitNormal; 00054 break; 00055 } 00056 case 3: { 00057 __unitNormal = __normal = TinyVector<3, real_t>(1,0,0); 00058 __distance = c.higherCorner(0); 00059 __origine = __distance*__unitNormal; 00060 break; 00061 } 00062 case 4: { 00063 __unitNormal = __normal = TinyVector<3, real_t>(0,1,0); 00064 __distance = c.higherCorner(1); 00065 __origine = __distance*__unitNormal; 00066 break; 00067 } 00068 case 5: { 00069 __unitNormal = __normal = TinyVector<3, real_t>(0,0,1); 00070 __distance = c.higherCorner(2); 00071 __origine = __distance*__unitNormal; 00072 break; 00073 } 00074 default: { 00075 throw ErrorHandler(__FILE__,__LINE__, 00076 "not implemented", 00077 ErrorHandler::unexpected); 00078 } 00079 } 00080 this->setTransformationsList(c.transformationsList()); 00081 }

| Plane::Plane | ( | const Cylinder & | c, | |
| const size_t & | faceNumber | |||
| ) |
Constructs the plane corresponding to a given face number of a cylinder
| c | the given cylinder | |
| faceNumber | the face number |
Definition at line 84 of file Plane.cpp.
References Cylinder::__c1, Cylinder::__c2, Cylinder::__center, __distance, __normal, __origine, __unitNormal, Shape::setTransformationsList(), Shape::transformationsList(), and ErrorHandler::unexpected.
00086 : Shape(Shape::plane) 00087 { 00088 switch(faceNumber) { 00089 case 0: { 00090 TinyVector<3, real_t> x = c.__c1 - c.__center; 00091 __unitNormal = __normal = (1./Norm(x)) * x; 00092 __origine = c.__c1; 00093 __distance = __unitNormal*__origine; 00094 break; 00095 } 00096 case 1: { 00097 TinyVector<3, real_t> x = c.__c2 - c.__center; 00098 __unitNormal = __normal = (1./Norm(x)) * x; 00099 __origine = c.__c2; 00100 __distance = __unitNormal*__origine; 00101 break; 00102 } 00103 default: { 00104 throw ErrorHandler(__FILE__,__LINE__, 00105 "not implemented", 00106 ErrorHandler::unexpected); 00107 } 00108 } 00109 this->setTransformationsList(c.transformationsList()); 00110 }

| Plane::Plane | ( | const Cone & | c, | |
| const size_t & | faceNumber | |||
| ) |
Constructs the plane corresponding to a given face number of a cone
| c | the given cone | |
| faceNumber | the face number |
Definition at line 114 of file Plane.cpp.
References Cone::__center1, Cone::__center2, __distance, __normal, __origine, __unitNormal, Shape::setTransformationsList(), Shape::transformationsList(), and ErrorHandler::unexpected.
00116 : Shape(Shape::plane) 00117 { 00118 switch(faceNumber) { 00119 case 0: { 00120 TinyVector<3, real_t> x = c.__center1 - c.__center2; 00121 __unitNormal = __normal = (1./Norm(x)) * x; 00122 __origine = c.__center1; 00123 __distance = __unitNormal*__origine; 00124 break; 00125 } 00126 case 1: { 00127 TinyVector<3, real_t> x = c.__center2 - c.__center1; 00128 __unitNormal = __normal = (1./Norm(x)) * x; 00129 __origine = c.__center2; 00130 __distance = __unitNormal*__origine; 00131 break; 00132 } 00133 default: { 00134 throw ErrorHandler(__FILE__,__LINE__, 00135 "not implemented", 00136 ErrorHandler::unexpected); 00137 } 00138 } 00139 this->setTransformationsList(c.transformationsList()); 00140 }

| Plane::Plane | ( | const Plane & | P | ) |
Copy constructor
| P | given plane |
Definition at line 155 of file Plane.cpp.
00156 : Shape(P), 00157 __normal(P.__normal), 00158 __distance(P.__distance), 00159 __unitNormal(P.__unitNormal), 00160 __origine(P.__origine) 00161 { 00162 ; 00163 }
| Plane::~Plane | ( | ) | [inline] |
| bool Plane::__inShape | ( | const TinyVector< 3, real_t > & | x | ) | const [protected, virtual] |
Checks if a point is inside the shape
| x | point to check |
Implements Shape.
Definition at line 26 of file Plane.cpp.
References __origine, and __unitNormal.
00027 { 00028 const real_t d = __unitNormal * (p-__origine) ; 00029 return (d < 0); // __unitNormal is exterior 00030 }
| std::ostream & Plane::__put | ( | std::ostream & | os | ) | const [protected, virtual] |
Writes the Plane to a stream
| os | given stream |
Implements Shape.
Definition at line 166 of file Plane.cpp.
References __distance, and __normal.
00167 { 00168 s << "plane {\n" << __normal << ',' << __distance << "\n}\n"; 00169 return s; 00170 }
| ReferenceCounting< Shape > Plane::__getCopy | ( | ) | const [protected, virtual] |
| ReferenceCounting<Shape> Shape::getCopy | ( | ) | const [inline, inherited] |
Creates a copy of the shape
Definition at line 100 of file Shape.hpp.
References Shape::__getCopy(), Shape::__trans, and Shape::transformationsList().
00101 { 00102 ReferenceCounting<Shape> shape = this->__getCopy(); 00103 TransformationsList transformationsList; 00104 for (TransformationsList::const_iterator i=__trans.begin(); 00105 i != __trans.end(); ++i) { 00106 const ConstReferenceCounting<Transform>& t = *i; 00107 transformationsList.push_back(t->getCopy()); 00108 } 00109 shape->setTransformationsList(transformationsList); 00110 00111 return shape; 00112 }

| const TransformationsList& Shape::transformationsList | ( | ) | const [inline, inherited] |
read only Access to the transformation lists
Definition at line 119 of file Shape.hpp.
References Shape::__trans.
Referenced by SurfaceMeshGenerator::Internals::__generateMesh(), Shape::getCopy(), InfiniteCone::InfiniteCone(), InfiniteCylinder::InfiniteCylinder(), ObjectTransformer::operator()(), and Plane().
00120 { 00121 return __trans; 00122 }
| void Shape::setTransformationsList | ( | const TransformationsList & | l | ) | [inline, inherited] |
sets the transformation list
Definition at line 128 of file Shape.hpp.
References Shape::__trans.
Referenced by InfiniteCone::InfiniteCone(), InfiniteCylinder::InfiniteCylinder(), and Plane().
00129 { 00130 __trans = l; 00131 }
| bool Shape::inside | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, inherited] |
Checks if a point is in the shape
| x | the point |
Definition at line 140 of file Shape.hpp.
References Shape::__inShape(), Shape::inverseTransformation(), and Shape::numberOfTransformations().
Referenced by SurfaceMeshGenerator::Internals::__createSurface(), SurfaceMeshGenerator::Internals::__createTrianglesIntersection(), ConformTransformationQ1Hexahedron::__inside(), and SurfaceMeshGenerator::Internals::__splitEdge().
00141 { 00142 TinyVector<3,real_t> X = x; 00143 for (size_t i = numberOfTransformations()-1; i<numberOfTransformations(); --i) 00144 X = inverseTransformation(i, X); 00145 return this->__inShape(X); 00146 }

| const ShapeType& Shape::type | ( | ) | const [inline, inherited] |
Read only access to the type of the shape
Definition at line 153 of file Shape.hpp.
References Shape::__type.
Referenced by Domain::__buildReferenceAssociation().
00154 { 00155 return __type; 00156 }
| size_t Shape::numberOfTransformations | ( | ) | const [inline, inherited] |
Gets the number of transformations applied to the shape
Definition at line 163 of file Shape.hpp.
References Shape::__trans.
Referenced by Union::__put(), Sphere::__put(), Not::__put(), Intersection::__put(), Difference::__put(), Cylinder::__put(), Cube::__put(), and Shape::inside().
00164 { 00165 return __trans.size(); 00166 }
| void Shape::setTransformation | ( | const Transform & | t | ) | [inherited] |
Adds a transformation to the shape
| t | given transformation |
Definition at line 30 of file Shape.cpp.
References Shape::__trans, and Transform::getCopy().
Referenced by Shape::parseTransform().
00031 { 00032 __trans.push_back(T.getCopy()); 00033 }

| TinyVector<3, real_t> Shape::inverseTransformation | ( | const size_t & | i, | |
| const TinyVector< 3, real_t > & | x | |||
| ) | const [inline, inherited] |
Applies inverse of transformation i to the point x.
| i | number of the transformation | |
| x | the point to inverse |
Definition at line 183 of file Shape.hpp.
References Shape::__trans.
Referenced by Shape::inside().
00185 { 00186 return __trans[i]->inverse(x); 00187 }
| void Shape::parseTransform | ( | const parsetrans & | trans | ) | [inherited] |
Builds the transformations vector using informations stored in trans.
| trans | transformation parser |
Definition at line 41 of file Shape.cpp.
References parsetrans::mat, matrix, parsetrans::number, rotation, scale, Shape::setTransformation(), translation, ErrorHandler::unexpected, and parsetrans::vect.
00042 { 00043 for (int i=0; i<trans.number ; i++) { 00044 switch (trans.type[i]) { 00045 case matrix: { 00046 TransformMatrix M(trans.mat); 00047 this->setTransformation(M); 00048 break; 00049 } 00050 case rotation: { 00051 TinyVector<3> v( trans.vect[0][i], 00052 trans.vect[1][i], 00053 trans.vect[2][i]); 00054 Rotation R(v); 00055 this->setTransformation(R); 00056 break; 00057 } 00058 case translation: { 00059 TinyVector<3> v( trans.vect[0][i], 00060 trans.vect[1][i], 00061 trans.vect[2][i]); 00062 Translation T(v); 00063 this->setTransformation(T); 00064 break; 00065 } 00066 case scale: { 00067 TinyVector<3> v( trans.vect[0][i], 00068 trans.vect[1][i], 00069 trans.vect[2][i]); 00070 Scale S(v); 00071 this->setTransformation(S); 00072 break; 00073 } 00074 default: { 00075 throw ErrorHandler(__FILE__,__LINE__, 00076 "unknown transformation", 00077 ErrorHandler::unexpected); 00078 } 00079 } 00080 } 00081 }

| std::ostream& operator<< | ( | std::ostream & | os, | |
| const Shape & | shape | |||
| ) | [friend, inherited] |
TinyVector<3, real_t> Plane::__normal [private] |
real_t Plane::__distance [private] |
TinyVector<3, real_t> Plane::__unitNormal [private] |
unit normal to the plane
Definition at line 47 of file Plane.hpp.
Referenced by __inShape(), and Plane().
TinyVector<3, real_t> Plane::__origine [private] |
normal projection of the origine
Definition at line 50 of file Plane.hpp.
Referenced by __inShape(), and Plane().
const ShapeType Shape::__type [protected, inherited] |
TransformationsList Shape::__trans [protected, inherited] |
Stores transformation set
Definition at line 66 of file Shape.hpp.
Referenced by Union::__put(), Sphere::__put(), Not::__put(), Intersection::__put(), Difference::__put(), Cylinder::__put(), Cube::__put(), Shape::getCopy(), Shape::inverseTransformation(), Shape::numberOfTransformations(), Shape::setTransformation(), Shape::setTransformationsList(), and Shape::transformationsList().
1.5.6