21 :
Shape(std::string(
"unknown cylindre"))
109 bool findIntersection =
false;
112 for (
unsigned int i = 0; i <
mesh.size(); i++)
114 if (
mesh.at(i)->getIntersection(ray, currentInter))
116 if (tmin < 0 || currentInter.
t < tmin)
118 findIntersection =
true;
121 inter.
t = currentInter.
t;
126 return findIntersection;
146 points.push_back(O - Y - Z);
147 points.push_back(O + Y - Z);
148 points.push_back(O + Y + Z);
149 points.push_back(O - Y + Z);
151 points.push_back(O + X - Y - Z);
152 points.push_back(O + X + Y - Z);
153 points.push_back(O + X + Y + Z);
154 points.push_back(O + X - Y + Z);
168 for (
unsigned int i = 1; i <
mesh.size(); i++)
186 decimal lenght = v1.distance(v2);
188 unsigned int nbSamples = (
unsigned int)(lenght * density) + 1;
190 for (
unsigned int i = 0; i < nbSamples; i++)
194 v1 + v1v2 * choice + normale *
decimal(0.001);
196 samples.push_back(newSample);
std::pair< unsigned int, unsigned int > segment
vec3 pMax
Upper point of the BBox.
BBox Union(const BBox &b, const vec3 &p)
Union of a point and a BBox. A new BBox is created.
vec3 pMin
Lower point of the BBox.
std::string name
Each instantiated object may be named.
vector< vec3 > points
Array of points defining the mesh.
vector< Shape * > mesh
Cylinder mesh (array of triangles)
virtual bool sample(decimal density, std::vector< vec3 > &samples)
Uncommented cause not used:
Cylindre(Shape *_p1=NULL, Shape *_p2=NULL, std::vector< vec3 > *_vertices=NULL, unsigned int v1=0, unsigned int v2=1, decimal _epaisseur=0.2)
Constructors.
decimal angleOuverture
Opening angle.
Shape * p1
First shape of the diffraction edge represented by the Cylinder.
virtual bool getIntersection(Ray &ray, Intersection &inter)
Get the Intersection between a ray and this shape.
Shape * p2
Second shape of the diffraction edge represented by the Cylinder.
Repere localRepere
Local frame.
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...
vec3 getU() const
Get global coordinates of local axis U,V,W and origin O.
base class for shapes (Cylindre, Mesh, Sphere, Triangle,...)
BBox box
Bounding box of the shape.
std::vector< vec3 > * vertices
GlobalVertices of the scene.
Material * material
Pointer to material.
Material * getMaterial()
Return the pointed material.
virtual vec3 getNormal(const vec3 pos=vec3())
Get normal.
std::vector< unsigned int > localVertices
Index of the vertices used for this shape.
base_vec3< decimal > vec3