41 m_bbox.
Set(
SFVEC3F( aCenterPoint.x - aRadius, aCenterPoint.y - aRadius, aZmin ),
42 SFVEC3F( aCenterPoint.x + aRadius, aCenterPoint.y + aRadius, aZmax ) );
55 const double p_dot_p = OCx_Start * OCx_Start + OCy_Start * OCy_Start;
57 const double a = (double)aRay.
m_Dir.x * (
double)aRay.
m_Dir.x +
59 const double b = (double)aRay.
m_Dir.x * (
double)OCx_Start +
60 (double)aRay.
m_Dir.y * (
double)OCy_Start;
63 const float delta = (float) ( b * b - a * c );
65 bool hitResult =
false;
67 if(
delta > FLT_EPSILON )
69 const float inv_a = 1.0 / a;
71 const float sdelta = sqrtf(
delta );
72 const float t = (-b - sdelta) * inv_a;
86 const float t1 = (-b + sdelta) * inv_a;
125 const double p_dot_p = OCx_Start * OCx_Start + OCy_Start * OCy_Start;
127 const double a = (double)aRay.
m_Dir.x * (
double)aRay.
m_Dir.x +
129 const double b = (double)aRay.
m_Dir.x * (
double)OCx_Start +
130 (double)aRay.
m_Dir.y * (
double)OCy_Start;
133 const float delta = (float) ( b * b - a * c );
135 if(
delta > FLT_EPSILON )
137 const float inv_a = 1.0 / a;
139 const float sdelta = sqrtf(
delta );
140 const float t = ( -b - sdelta ) * inv_a;
145 if( t < aMaxDistance )
149 const float t1 = ( -b + sdelta ) * inv_a;
154 if( t1 < aMaxDistance )
Defines math related functions.
bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const override
bool IntersectP(const RAY &aRay, float aMaxDistance) const override
bool Intersects(const BBOX_3D &aBBox) const override
CYLINDER(SFVEC2F aCenterPoint, float aZmin, float aZmax, float aRadius)
SFVEC3F GetDiffuseColor(const HITINFO &aHitInfo) const override
void Generate(SFVEC3F &aNormal, const RAY &aRay, const HITINFO &aHitInfo) const
const MATERIAL * m_material
Manage a bounding box defined by two SFVEC3F min max points.
void ScaleNextUp()
Scale a bounding box to the next float representation making it larger.
SFVEC3F GetCenter() const
Return the center point of the bounding box.
const SFVEC3F & Min() const
Return the minimum vertex pointer.
const SFVEC3F & Max() const
Return the maximum vertex pointer.
void Set(const SFVEC3F &aPbMin, const SFVEC3F &aPbMax)
Set bounding box with new parameters.
bool Intersects(const BBOX_3D &aBBox) const
Test if a bounding box intersects this box.
Stores the hit information of a ray with a point on the surface of a object.
float m_tHit
( 4) distance
const OBJECT_3D * pHitObject
( 4) Object that was hitted
SFVEC3F m_HitNormal
(12) normal at the hit point
SFVEC3F m_HitPoint
(12) hit position
SFVEC3F at(float t) const