#include <Cylinder.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 | |
| Cylinder (const TinyVector< 3, real_t > &a, const TinyVector< 3, real_t > &b, const real_t &r) | |
| Cylinder (const Cylinder &C) | |
| ~Cylinder () | |
| 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 | |
| const TinyVector< 3, real_t > | __c1 |
| const TinyVector< 3, real_t > | __c2 |
| const TinyVector< 3, real_t > | __center |
| const real_t | __radius |
| const real_t | __radius2 |
| const real_t | __half_height |
| const TinyVector< 3, real_t > | __unaryVector |
Friends | |
| class | InfiniteCylinder |
| class | Plane |
| std::ostream & | operator<< (std::ostream &os, const Shape &shape) |
Definition at line 32 of file Cylinder.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 };
| Cylinder::Cylinder | ( | const TinyVector< 3, real_t > & | a, | |
| const TinyVector< 3, real_t > & | b, | |||
| const real_t & | r | |||
| ) |
Constructor
| a | first face center | |
| b | second face center | |
| r | radius |
Definition at line 26 of file Cylinder.cpp.
Referenced by __getCopy().
00029 : Shape(cylinder), 00030 __c1(a), __c2(b), 00031 __center(0.5*(a+b)), 00032 __radius (r), 00033 __radius2(r*r), 00034 __half_height(Norm(__center - __c1)), 00035 __unaryVector(1./(2.*__half_height)*(b-a)) 00036 { 00037 ; 00038 }
| Cylinder::Cylinder | ( | const Cylinder & | C | ) |
Copy constructor
| C | given Cylinder |
Definition at line 41 of file Cylinder.cpp.
00042 : Shape(C), 00043 __c1(C.__c1), 00044 __c2(C.__c2), 00045 __center(C.__center), 00046 __radius(C.__radius), 00047 __radius2(C.__radius2), 00048 __half_height(C.__half_height), 00049 __unaryVector(C.__unaryVector) 00050 { 00051 ; 00052 }
| Cylinder::~Cylinder | ( | ) | [inline] |
| bool Cylinder::__inShape | ( | const TinyVector< 3, real_t > & | x | ) | const [inline, protected, virtual] |
checks if a point is inside the Cylinder
| x | the point to check |
Implements Shape.
Definition at line 66 of file Cylinder.cpp.
References __center, __half_height, __radius2, and __unaryVector.
00067 { 00068 TinyVector<3, real_t> x = v-__center; 00069 00070 real_t ux = __unaryVector * x; 00071 TinyVector<3, real_t> normal (x - (ux * __unaryVector)); 00072 return ((std::abs(ux) < __half_height) && (normal * normal < __radius2)); 00073 }
| std::ostream & Cylinder::__put | ( | std::ostream & | os | ) | const [protected, virtual] |
Writes the Cylinder to a stream
| os | output stream |
Implements Shape.
Definition at line 55 of file Cylinder.cpp.
References __c1, __c2, __radius, Shape::__trans, and Shape::numberOfTransformations().
00056 { 00057 os << "cylinder {\n" << __c1 00058 << ", " << __c2 << ", " << __radius << '\n'; 00059 for (size_t i=0; i<numberOfTransformations(); i++) 00060 os << __trans[i]->povWrite() << '\n'; 00061 os << "}\n"; 00062 return os; 00063 }

| ReferenceCounting< Shape > Cylinder::__getCopy | ( | ) | const [protected, virtual] |
Get a copy of the Cylinder
Implements Shape.
Definition at line 76 of file Cylinder.cpp.
References Cylinder().
00077 { 00078 return new Cylinder(*this); 00079 }

| 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::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::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(), __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 }

friend class InfiniteCylinder [friend] |
Definition at line 36 of file Cylinder.hpp.
friend class Plane [friend] |
Definition at line 37 of file Cylinder.hpp.
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const Shape & | shape | |||
| ) | [friend, inherited] |
const TinyVector<3, real_t> Cylinder::__c1 [private] |
center of the upper face
Definition at line 39 of file Cylinder.hpp.
Referenced by __put(), and Plane::Plane().
const TinyVector<3, real_t> Cylinder::__c2 [private] |
center of the lower face
Definition at line 40 of file Cylinder.hpp.
Referenced by __put(), and Plane::Plane().
const TinyVector<3, real_t> Cylinder::__center [private] |
usefull vertex to determine the space inside the Cylinder
Definition at line 43 of file Cylinder.hpp.
Referenced by __inShape(), and Plane::Plane().
const real_t Cylinder::__radius [private] |
const real_t Cylinder::__radius2 [private] |
square of the radius of the Cylinder (since it is usefull very often, it is a good idea to store it).
Definition at line 48 of file Cylinder.hpp.
Referenced by __inShape().
const real_t Cylinder::__half_height [private] |
Half of the height of the cylinder. Usefull to detect the space inside the Cylinder
Definition at line 53 of file Cylinder.hpp.
Referenced by __inShape().
const TinyVector<3, real_t> Cylinder::__unaryVector [private] |
unary vector along the c1 c2 axis.
Definition at line 58 of file Cylinder.hpp.
Referenced by __inShape().
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(), __put(), Cube::__put(), Shape::getCopy(), Shape::inverseTransformation(), Shape::numberOfTransformations(), Shape::setTransformation(), Shape::setTransformationsList(), and Shape::transformationsList().
1.5.6