40 m_bbox.
Set(
SFVEC3F( aCenterPoint.x - aRadius, aCenterPoint.y - aRadius, aZmin ),
41 SFVEC3F( aCenterPoint.x + aRadius, aCenterPoint.y + aRadius, aZmax ) );
54 const double p_dot_p = OCx_Start * OCx_Start + OCy_Start * OCy_Start;
56 const double a = (double)aRay.
m_Dir.x * (
double)aRay.
m_Dir.x +
58 const double b = (double)aRay.
m_Dir.x * (
double)OCx_Start +
59 (double)aRay.
m_Dir.y * (
double)OCy_Start;
62 const float delta = (float) ( b * b - a * c );
64 bool hitResult =
false;
66 if(
delta > FLT_EPSILON )
68 const float inv_a = 1.0 / a;
70 const float sdelta = sqrtf(
delta );
71 const float t = (-b - sdelta) * inv_a;
85 const float t1 = (-b + sdelta) * inv_a;
124 const double p_dot_p = OCx_Start * OCx_Start + OCy_Start * OCy_Start;
126 const double a = (double)aRay.
m_Dir.x * (
double)aRay.
m_Dir.x +
128 const double b = (double)aRay.
m_Dir.x * (
double)OCx_Start +
129 (double)aRay.
m_Dir.y * (
double)OCy_Start;
132 const float delta = (float) ( b * b - a * c );
134 if(
delta > FLT_EPSILON )
136 const float inv_a = 1.0 / a;
138 const float sdelta = sqrtf(
delta );
139 const float t = ( -b - sdelta ) * inv_a;
144 if( t < aMaxDistance )
148 const float t1 = ( -b + sdelta ) * inv_a;
153 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