KiCad PCB EDA Suite
CROUNDSEG Class Reference

#include <croundseg.h>

Inheritance diagram for CROUNDSEG:
COBJECT

Public Member Functions

 CROUNDSEG (const CROUNDSEGMENT2D &aSeg2D, float aZmin, float aZmax)
 Constructor CROUNDSEG. More...
 
void SetColor (SFVEC3F aObjColor)
 
bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const override
 Functions Intersect. More...
 
bool IntersectP (const RAY &aRay, float aMaxDistance) const override
 Functions Intersect for shadow test. More...
 
bool Intersects (const CBBOX &aBBox) const override
 Function Intersects. More...
 
SFVEC3F GetDiffuseColor (const HITINFO &aHitInfo) const override
 
void SetMaterial (const CMATERIAL *aMaterial)
 
const CMATERIALGetMaterial () const
 
const CBBOXGetBBox () const
 
const SFVEC3FGetCentroid () const
 

Protected Attributes

CBBOX m_bbox
 
SFVEC3F m_centroid
 
OBJECT3D_TYPE m_obj_type
 
const CMATERIALm_material
 

Private Attributes

RAYSEG2D m_segment
 
SFVEC3F m_center_left
 
SFVEC3F m_center_right
 
SFVEC3F m_plane_dir_left
 
SFVEC3F m_plane_dir_right
 
float m_radius
 
float m_radius_squared
 
float m_inv_radius
 
float m_seglen_over_two_squared
 
SFVEC3F m_diffusecolor
 

Detailed Description

Definition at line 39 of file croundseg.h.

Constructor & Destructor Documentation

CROUNDSEG::CROUNDSEG ( const CROUNDSEGMENT2D aSeg2D,
float  aZmin,
float  aZmax 
)

Constructor CROUNDSEG.

Definition at line 32 of file croundseg.cpp.

References CBBOX::GetCenter(), CROUNDSEGMENT2D::GetRadius(), COBJECT::m_bbox, m_center_left, m_center_right, COBJECT::m_centroid, RAYSEG2D::m_Dir, RAYSEG2D::m_End, m_inv_radius, RAYSEG2D::m_Length, m_plane_dir_left, m_plane_dir_right, m_radius, m_radius_squared, m_seglen_over_two_squared, m_segment, RAYSEG2D::m_Start, CBBOX::Max(), CBBOX::Min(), CBBOX::Reset(), CBBOX::ScaleNextUp(), and CBBOX::Set().

35  m_segment( aSeg2D.m_segment )
36 {
37  m_radius = aSeg2D.GetRadius();
39  m_inv_radius = 1.0f / m_radius;
40 
43 
44  m_bbox.Reset();
45 
47  SFVEC3F( m_segment.m_End.x, m_segment.m_End.y, aZmax) );
48 
49  m_bbox.Set( m_bbox.Min() - SFVEC3F( m_radius, m_radius, 0.0f ),
50  m_bbox.Max() + SFVEC3F( m_radius, m_radius, 0.0f ) );
51 
54 
57 
59  (m_segment.m_Length / 2.0f);
60 }
SFVEC3F m_centroid
Definition: cobject.h:54
const SFVEC3F & Min() const
Function Min return the minimun vertex pointer.
Definition: cbbox.h:205
SFVEC3F m_plane_dir_left
Definition: croundseg.h:61
CBBOX m_bbox
Definition: cobject.h:53
SFVEC2F m_Dir
Definition: ray.h:91
void Set(const SFVEC3F &aPbMin, const SFVEC3F &aPbMax)
Function Set Set bounding box with new parameters.
Definition: cbbox.cpp:67
RAYSEG2D m_segment
Definition: croundseg.h:57
float GetRadius() const
COBJECT(OBJECT3D_TYPE aObjType)
Definition: cobject.cpp:38
float m_seglen_over_two_squared
Definition: croundseg.h:67
SFVEC3F m_plane_dir_right
Definition: croundseg.h:62
float m_Length
Definition: ray.h:93
SFVEC3F m_center_left
Definition: croundseg.h:59
SFVEC2F m_End
Definition: ray.h:89
const SFVEC3F & Max() const
Function Max return the maximum vertex pointer.
Definition: cbbox.h:212
void ScaleNextUp()
Function ScaleNextUp scales a bounding box to the next float representation making it larger...
Definition: cbbox.cpp:206
SFVEC3F GetCenter() const
Function GetCenter return the center point of the bounding box.
Definition: cbbox.cpp:135
float m_radius_squared
Definition: croundseg.h:65
SFVEC2F m_Start
Definition: ray.h:88
float m_radius
Definition: croundseg.h:64
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
float m_inv_radius
Definition: croundseg.h:66
SFVEC3F m_center_right
Definition: croundseg.h:60
void Reset()
Function Reset reset the bounding box to zero and de-initialized it.
Definition: cbbox.cpp:98

Member Function Documentation

const CBBOX& COBJECT::GetBBox ( ) const
inlineinherited

Definition at line 94 of file cobject.h.

References COBJECT::m_bbox.

Referenced by CGENERICCONTAINER::Add(), and CBVH_PBRT::Intersect().

94 { return m_bbox; }
CBBOX m_bbox
Definition: cobject.h:53
const SFVEC3F& COBJECT::GetCentroid ( ) const
inlineinherited

Definition at line 96 of file cobject.h.

References COBJECT::m_centroid.

96 { return m_centroid; }
SFVEC3F m_centroid
Definition: cobject.h:54
SFVEC3F CROUNDSEG::GetDiffuseColor ( const HITINFO aHitInfo) const
overridevirtual

Implements COBJECT.

Definition at line 444 of file croundseg.cpp.

References m_diffusecolor.

445 {
446  (void)aHitInfo; // unused
447 
448  return m_diffusecolor;
449 }
SFVEC3F m_diffusecolor
Definition: croundseg.h:69
const CMATERIAL* COBJECT::GetMaterial ( ) const
inlineinherited

Definition at line 63 of file cobject.h.

References COBJECT::m_material.

Referenced by CBVH_PBRT::IntersectP(), and C3D_RENDER_RAYTRACING::shadeHit().

63 { return m_material; }
const CMATERIAL * m_material
Definition: cobject.h:56
bool CROUNDSEG::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
overridevirtual

Functions Intersect.

Intersect

Parameters
aRay
aHitInfo
Returns
TRUE if the aRay intersects the object

Implements COBJECT.

Definition at line 63 of file croundseg.cpp.

References RAY::at(), RAYSEG2D::DistanceToPointSquared(), COBJECT::m_bbox, m_center_left, m_center_right, RAY::m_Dir, RAY::m_dirIsNeg, RAYSEG2D::m_End, HITINFO::m_HitNormal, HITINFO::m_HitPoint, m_inv_radius, RAY::m_InvDir, COBJECT::m_material, RAY::m_Origin, m_plane_dir_left, m_plane_dir_right, m_radius_squared, m_seglen_over_two_squared, m_segment, RAYSEG2D::m_Start, HITINFO::m_tHit, CBBOX::Max(), CBBOX::Min(), CMATERIAL::PerturbeNormal(), and HITINFO::pHitObject.

64 {
65  // Top / Botton plane
66  // /////////////////////////////////////////////////////////////////////////
67  float zPlanePos = aRay.m_dirIsNeg[2]? m_bbox.Max().z : m_bbox.Min().z;
68 
69  float tPlane = ( zPlanePos - aRay.m_Origin.z) * aRay.m_InvDir.z;
70 
71  if( ( tPlane >= aHitInfo.m_tHit ) || ( tPlane < FLT_EPSILON ) )
72  return false; // Early exit
73 
74  SFVEC2F planeHitPoint2d( aRay.m_Origin.x + aRay.m_Dir.x * tPlane,
75  aRay.m_Origin.y + aRay.m_Dir.y * tPlane );
76 
77  float dSquared = m_segment.DistanceToPointSquared( planeHitPoint2d );
78 
79  if( dSquared <= m_radius_squared )
80  {
81  if( tPlane < aHitInfo.m_tHit )
82  {
83  aHitInfo.m_tHit = tPlane;
84  aHitInfo.m_HitPoint = SFVEC3F( planeHitPoint2d.x,
85  planeHitPoint2d.y,
86  aRay.m_Origin.z + aRay.m_Dir.z * tPlane );
87  aHitInfo.m_HitNormal = SFVEC3F( 0.0f,
88  0.0f,
89  aRay.m_dirIsNeg[2]? 1.0f: -1.0f );
90  aHitInfo.pHitObject = this;
91 
92  m_material->PerturbeNormal( aHitInfo.m_HitNormal, aRay, aHitInfo );
93 
94  return true;
95  }
96 
97  return false;
98  }
99 
100  // Test LEFT / RIGHT plane
101  // /////////////////////////////////////////////////////////////////////////
102  float normal_dot_ray = glm::dot( m_plane_dir_right, aRay.m_Dir );
103 
104  if( normal_dot_ray < 0.0f ) // If the dot is neg, the it hits the plane
105  {
106  const float n_dot_ray_origin = glm::dot( m_plane_dir_right,
107  m_center_right - aRay.m_Origin );
108  const float t = n_dot_ray_origin / normal_dot_ray;
109 
110  if( t > 0.0f )
111  {
112  const SFVEC3F hitP = aRay.at( t );
113 
114  const SFVEC3F v = hitP - m_center_right;
115  const float len = glm::dot( v, v );
116 
117  if( (len <= m_seglen_over_two_squared) &&
118  (hitP.z >= m_bbox.Min().z) &&
119  (hitP.z <= m_bbox.Max().z) )
120  {
121  if( t < aHitInfo.m_tHit )
122  {
123  aHitInfo.m_tHit = t;
124  aHitInfo.m_HitPoint = hitP;
125  aHitInfo.m_HitNormal = SFVEC3F( m_plane_dir_right.x,
127  0.0f );
128  aHitInfo.pHitObject = this;
129 
130  m_material->PerturbeNormal( aHitInfo.m_HitNormal, aRay, aHitInfo );
131 
132  return true;
133  }
134 
135  return false;
136  }
137  }
138  }
139  else
140  {
141  normal_dot_ray = glm::dot( m_plane_dir_left, aRay.m_Dir );
142 
143  if( normal_dot_ray < 0.0f ) // If the dot is neg, the it hits the plane
144  {
145  const float n_dot_ray_origin = glm::dot( m_plane_dir_left,
146  m_center_left - aRay.m_Origin );
147  const float t = n_dot_ray_origin / normal_dot_ray;
148 
149  if( t > 0.0f )
150  {
151  const SFVEC3F hitP = aRay.at( t );
152 
153  const SFVEC3F v = hitP - m_center_left;
154  const float len = glm::dot( v, v );
155 
156  if( (len <= m_seglen_over_two_squared) &&
157  (hitP.z >= m_bbox.Min().z) &&
158  (hitP.z <= m_bbox.Max().z) )
159  {
160  if( t < aHitInfo.m_tHit )
161  {
162  aHitInfo.m_tHit = t;
163  aHitInfo.m_HitPoint = hitP;
164  aHitInfo.m_HitNormal = SFVEC3F( m_plane_dir_left.x,
166  0.0f );
167  aHitInfo.pHitObject = this;
168 
169  m_material->PerturbeNormal( aHitInfo.m_HitNormal, aRay, aHitInfo );
170 
171  return true;
172  }
173 
174  return false;
175  }
176  }
177  }
178  }
179 
180  // Based on:
181  // http://www.cs.utah.edu/~lha/Code%206620%20/Ray4/Cylinder.cpp
182 
183  // Ray-sphere intersection: geometric
184  // /////////////////////////////////////////////////////////////////////////
185 
186  const double OCx_Start = aRay.m_Origin.x - m_segment.m_Start.x;
187  const double OCy_Start = aRay.m_Origin.y - m_segment.m_Start.y;
188 
189  const double p_dot_p_Start = OCx_Start * OCx_Start + OCy_Start * OCy_Start;
190 
191  const double a = (double)aRay.m_Dir.x * (double)aRay.m_Dir.x +
192  (double)aRay.m_Dir.y * (double)aRay.m_Dir.y;
193 
194  const double b_Start = (double)aRay.m_Dir.x * (double)OCx_Start +
195  (double)aRay.m_Dir.y * (double)OCy_Start;
196 
197  const double c_Start = p_dot_p_Start - m_radius_squared;
198 
199  const float delta_Start = (float)(b_Start * b_Start - a * c_Start);
200 
201  if( delta_Start > FLT_EPSILON )
202  {
203  const float sdelta = sqrtf( delta_Start );
204  const float t = (-b_Start - sdelta) / a;
205  const float z = aRay.m_Origin.z + t * aRay.m_Dir.z;
206 
207  if( (z >= m_bbox.Min().z) &&
208  (z <= m_bbox.Max().z) )
209  {
210  if( t < aHitInfo.m_tHit )
211  {
212  aHitInfo.m_tHit = t;
213  aHitInfo.m_HitPoint = aRay.at( t );
214 
215  const SFVEC2F hitPoint2D = SFVEC2F( aHitInfo.m_HitPoint.x,
216  aHitInfo.m_HitPoint.y );
217 
218  aHitInfo.m_HitNormal = SFVEC3F(
219  (hitPoint2D.x - m_segment.m_Start.x) * m_inv_radius,
220  (hitPoint2D.y - m_segment.m_Start.y) * m_inv_radius,
221  0.0f );
222 
223  aHitInfo.pHitObject = this;
224 
225  m_material->PerturbeNormal( aHitInfo.m_HitNormal, aRay, aHitInfo );
226 
227  return true;
228  }
229 
230  return false;
231  }
232  }
233 
234  const double OCx_End = aRay.m_Origin.x - m_segment.m_End.x;
235  const double OCy_End = aRay.m_Origin.y - m_segment.m_End.y;
236 
237  const double p_dot_p_End = OCx_End * OCx_End + OCy_End * OCy_End;
238 
239  const double b_End = (double)aRay.m_Dir.x * (double)OCx_End +
240  (double)aRay.m_Dir.y * (double)OCy_End;
241 
242  const double c_End = p_dot_p_End - m_radius_squared;
243 
244  const float delta_End = (float)(b_End * b_End - a * c_End);
245 
246  if( delta_End > FLT_EPSILON )
247  {
248  const float sdelta = sqrtf( delta_End );
249  const float t = (-b_End - sdelta) / a;
250  const float z = aRay.m_Origin.z + t * aRay.m_Dir.z;
251 
252  if( (z >= m_bbox.Min().z) &&
253  (z <= m_bbox.Max().z) )
254  {
255  if( t < aHitInfo.m_tHit )
256  {
257  aHitInfo.m_tHit = t;
258  aHitInfo.m_HitPoint = aRay.at( t );
259 
260  const SFVEC2F hitPoint2D = SFVEC2F( aHitInfo.m_HitPoint.x,
261  aHitInfo.m_HitPoint.y );
262 
263  aHitInfo.m_HitNormal = SFVEC3F(
264  (hitPoint2D.x - m_segment.m_End.x) * m_inv_radius,
265  (hitPoint2D.y - m_segment.m_End.y) * m_inv_radius,
266  0.0f );
267  aHitInfo.pHitObject = this;
268 
269  m_material->PerturbeNormal( aHitInfo.m_HitNormal, aRay, aHitInfo );
270 
271  return true;
272  }
273 
274  return false;
275  }
276  }
277 
278  return false;
279 }
float DistanceToPointSquared(const SFVEC2F &aPoint) const
Definition: ray.cpp:323
const SFVEC3F & Min() const
Function Min return the minimun vertex pointer.
Definition: cbbox.h:205
SFVEC3F at(float t) const
Definition: ray.h:65
SFVEC3F m_plane_dir_left
Definition: croundseg.h:61
CBBOX m_bbox
Definition: cobject.h:53
const CMATERIAL * m_material
Definition: cobject.h:56
float m_tHit
( 4) distance
Definition: hitinfo.h:43
RAYSEG2D m_segment
Definition: croundseg.h:57
SFVEC3F m_InvDir
Definition: ray.h:51
SFVEC3F m_HitPoint
(12) hit position
Definition: hitinfo.h:49
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
void PerturbeNormal(SFVEC3F &aNormal, const RAY &aRay, const HITINFO &aHitInfo) const
Definition: cmaterial.cpp:88
float m_seglen_over_two_squared
Definition: croundseg.h:67
SFVEC3F m_plane_dir_right
Definition: croundseg.h:62
unsigned int m_dirIsNeg[3]
Definition: ray.h:56
SFVEC3F m_center_left
Definition: croundseg.h:59
SFVEC2F m_End
Definition: ray.h:89
const SFVEC3F & Max() const
Function Max return the maximum vertex pointer.
Definition: cbbox.h:212
const COBJECT * pHitObject
( 4) Object that was hitted
Definition: hitinfo.h:45
SFVEC3F m_Dir
Definition: ray.h:48
SFVEC3F m_Origin
Definition: ray.h:45
float m_radius_squared
Definition: croundseg.h:65
SFVEC2F m_Start
Definition: ray.h:88
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
float m_inv_radius
Definition: croundseg.h:66
SFVEC3F m_center_right
Definition: croundseg.h:60
SFVEC3F m_HitNormal
(12) normal at the hit point
Definition: hitinfo.h:42
bool CROUNDSEG::IntersectP ( const RAY aRay,
float  aMaxDistance 
) const
overridevirtual

Functions Intersect for shadow test.

Intersect

Parameters
aRay
aDistance- max distance of the test
Returns
TRUE if the aRay intersects the object

Implements COBJECT.

Definition at line 282 of file croundseg.cpp.

References RAY::at(), RAYSEG2D::DistanceToPointSquared(), COBJECT::m_bbox, m_center_left, m_center_right, RAY::m_Dir, RAY::m_dirIsNeg, RAYSEG2D::m_End, RAY::m_InvDir, RAY::m_Origin, m_plane_dir_left, m_plane_dir_right, m_radius_squared, m_seglen_over_two_squared, m_segment, RAYSEG2D::m_Start, CBBOX::Max(), and CBBOX::Min().

283 {
284  // Top / Botton plane
285  // /////////////////////////////////////////////////////////////////////////
286  const float zPlanePos = aRay.m_dirIsNeg[2]? m_bbox.Max().z : m_bbox.Min().z;
287 
288  const float tPlane = ( zPlanePos - aRay.m_Origin.z) * aRay.m_InvDir.z;
289 
290  if( ( tPlane >= aMaxDistance) || ( tPlane < FLT_EPSILON ) )
291  return false; // Early exit
292 
293  const SFVEC2F planeHitPoint2d( aRay.m_Origin.x + aRay.m_Dir.x * tPlane,
294  aRay.m_Origin.y + aRay.m_Dir.y * tPlane );
295 
296  const float dSquared = m_segment.DistanceToPointSquared( planeHitPoint2d );
297 
298  if( dSquared <= m_radius_squared )
299  {
300  if( tPlane < aMaxDistance )
301  return true;
302 
303  return false;
304  }
305 
306  // Since the IntersectP is used for shadows, we are simplifying the test
307  // intersection and only consider the top/bottom plane of the segment
308  return false;
309 #if 0
310  // Test LEFT / RIGHT plane
311  // /////////////////////////////////////////////////////////////////////////
312  float normal_dot_ray = glm::dot( m_plane_dir_right, aRay.m_Dir );
313 
314  if( normal_dot_ray < 0.0f ) // If the dot is neg, the it hits the plane
315  {
316  float n_dot_ray_origin = glm::dot( m_plane_dir_right,
317  m_center_right - aRay.m_Origin );
318  float t = n_dot_ray_origin / normal_dot_ray;
319 
320  if( t > 0.0f )
321  {
322  SFVEC3F hitP = aRay.at( t );
323 
324  SFVEC3F v = hitP - m_center_right;
325  float len = glm::dot( v, v );
326 
327  if( (len <= m_seglen_over_two_squared) &&
328  (hitP.z >= m_bbox.Min().z) && (hitP.z <= m_bbox.Max().z) )
329  {
330  if( t < aMaxDistance )
331  return true;
332 
333  return false;
334  }
335  }
336  }
337  else
338  {
339  normal_dot_ray = glm::dot( m_plane_dir_left, aRay.m_Dir );
340 
341  if( normal_dot_ray < 0.0f ) // If the dot is neg, the it hits the plane
342  {
343  const float n_dot_ray_origin = glm::dot( m_plane_dir_left,
344  m_center_left - aRay.m_Origin );
345  const float t = n_dot_ray_origin / normal_dot_ray;
346 
347  if( t > 0.0f )
348  {
349  SFVEC3F hitP = aRay.at( t );
350 
351  SFVEC3F v = hitP - m_center_left;
352  float len = glm::dot( v, v );
353 
354  if( (len <= m_seglen_over_two_squared) &&
355  (hitP.z >= m_bbox.Min().z) && (hitP.z <= m_bbox.Max().z) )
356  {
357  if( t < aMaxDistance )
358  return true;
359 
360  return false;
361  }
362  }
363  }
364  }
365 
366  // Based on:
367  // http://www.cs.utah.edu/~lha/Code%206620%20/Ray4/Cylinder.cpp
368 
369  // Ray-sphere intersection: geometric
370  // /////////////////////////////////////////////////////////////////////////
371 
372  double OCx_Start = aRay.m_Origin.x - m_segment.m_Start.x;
373  double OCy_Start = aRay.m_Origin.y - m_segment.m_Start.y;
374 
375  double p_dot_p_Start = OCx_Start * OCx_Start + OCy_Start * OCy_Start;
376 
377  double a = (double)aRay.m_Dir.x * (double)aRay.m_Dir.x +
378  (double)aRay.m_Dir.y * (double)aRay.m_Dir.y;
379 
380  double b_Start = (double)aRay.m_Dir.x * (double)OCx_Start +
381  (double)aRay.m_Dir.y * (double)OCy_Start;
382 
383  double c_Start = p_dot_p_Start - m_radius_squared;
384 
385  float delta_Start = (float)(b_Start * b_Start - a * c_Start);
386 
387  if( delta_Start > FLT_EPSILON )
388  {
389  float sdelta = sqrtf( delta_Start );
390  float t = (-b_Start - sdelta) / a;
391  float z = aRay.m_Origin.z + t * aRay.m_Dir.z;
392 
393  if( (z >= m_bbox.Min().z) &&
394  (z <= m_bbox.Max().z) )
395  {
396  if( t < aMaxDistance )
397  return true;
398 
399  return false;
400  }
401  }
402 
403  double OCx_End = aRay.m_Origin.x - m_segment.m_End.x;
404  double OCy_End = aRay.m_Origin.y - m_segment.m_End.y;
405 
406  double p_dot_p_End = OCx_End * OCx_End + OCy_End * OCy_End;
407 
408 
409  double b_End = (double)aRay.m_Dir.x * (double)OCx_End +
410  (double)aRay.m_Dir.y * (double)OCy_End;
411 
412  double c_End = p_dot_p_End - m_radius_squared;
413 
414  float delta_End = (float)(b_End * b_End - a * c_End);
415 
416  if( delta_End > FLT_EPSILON )
417  {
418  float sdelta = sqrtf( delta_End );
419  float t = (-b_End - sdelta) / a;
420  float z = aRay.m_Origin.z + t * aRay.m_Dir.z;
421 
422  if( (z >= m_bbox.Min().z) &&
423  (z <= m_bbox.Max().z) )
424  {
425  if( t < aMaxDistance )
426  return true;
427 
428  return false;
429  }
430  }
431 
432  return false;
433 #endif
434 }
float DistanceToPointSquared(const SFVEC2F &aPoint) const
Definition: ray.cpp:323
const SFVEC3F & Min() const
Function Min return the minimun vertex pointer.
Definition: cbbox.h:205
SFVEC3F at(float t) const
Definition: ray.h:65
SFVEC3F m_plane_dir_left
Definition: croundseg.h:61
CBBOX m_bbox
Definition: cobject.h:53
RAYSEG2D m_segment
Definition: croundseg.h:57
SFVEC3F m_InvDir
Definition: ray.h:51
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
float m_seglen_over_two_squared
Definition: croundseg.h:67
SFVEC3F m_plane_dir_right
Definition: croundseg.h:62
unsigned int m_dirIsNeg[3]
Definition: ray.h:56
SFVEC3F m_center_left
Definition: croundseg.h:59
SFVEC2F m_End
Definition: ray.h:89
const SFVEC3F & Max() const
Function Max return the maximum vertex pointer.
Definition: cbbox.h:212
SFVEC3F m_Dir
Definition: ray.h:48
SFVEC3F m_Origin
Definition: ray.h:45
float m_radius_squared
Definition: croundseg.h:65
SFVEC2F m_Start
Definition: ray.h:88
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
SFVEC3F m_center_right
Definition: croundseg.h:60
bool CROUNDSEG::Intersects ( const CBBOX aBBox) const
overridevirtual

Function Intersects.

Intersects - a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅) It intersects if the result intersection is not null

Parameters
aBBox
Returns

TODO: improove

Implements COBJECT.

Definition at line 437 of file croundseg.cpp.

References CBBOX::Intersects(), and COBJECT::m_bbox.

438 {
440  return m_bbox.Intersects( aBBox );
441 }
bool Intersects(const CBBOX &aBBox) const
Function Intersects test if a bounding box intersects this box.
Definition: cbbox.cpp:230
CBBOX m_bbox
Definition: cobject.h:53
void CROUNDSEG::SetColor ( SFVEC3F  aObjColor)
inline

Definition at line 48 of file croundseg.h.

References m_diffusecolor.

Referenced by C3D_RENDER_RAYTRACING::create_3d_object_from().

48 { m_diffusecolor = aObjColor; }
SFVEC3F m_diffusecolor
Definition: croundseg.h:69
void COBJECT::SetMaterial ( const CMATERIAL aMaterial)
inlineinherited

Member Data Documentation

SFVEC3F CROUNDSEG::m_center_left
private

Definition at line 59 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().

SFVEC3F CROUNDSEG::m_center_right
private

Definition at line 60 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().

SFVEC3F CROUNDSEG::m_diffusecolor
private

Definition at line 69 of file croundseg.h.

Referenced by GetDiffuseColor(), and SetColor().

float CROUNDSEG::m_inv_radius
private

Definition at line 66 of file croundseg.h.

Referenced by CROUNDSEG(), and Intersect().

OBJECT3D_TYPE COBJECT::m_obj_type
protectedinherited

Definition at line 55 of file cobject.h.

Referenced by COBJECT::COBJECT().

SFVEC3F CROUNDSEG::m_plane_dir_left
private

Definition at line 61 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().

SFVEC3F CROUNDSEG::m_plane_dir_right
private

Definition at line 62 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().

float CROUNDSEG::m_radius
private

Definition at line 64 of file croundseg.h.

Referenced by CROUNDSEG().

float CROUNDSEG::m_radius_squared
private

Definition at line 65 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().

float CROUNDSEG::m_seglen_over_two_squared
private

Definition at line 67 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().

RAYSEG2D CROUNDSEG::m_segment
private

Definition at line 57 of file croundseg.h.

Referenced by CROUNDSEG(), Intersect(), and IntersectP().


The documentation for this class was generated from the following files: