Boundingboxes should be ready.
Next step (later) would be to properly use them other than group to lower the number of intersection calculation per ray.
This commit is contained in:
@@ -43,4 +43,28 @@ Tuple Tuple::cross(const Tuple &b) const
|
||||
Tuple Tuple::reflect(const Tuple &normal)
|
||||
{
|
||||
return *this - normal * 2 * this->dot(normal);
|
||||
}
|
||||
|
||||
void Tuple::fixPoint()
|
||||
{
|
||||
if (isnan(this->x) || isnan(this->y) || isnan(this->z))
|
||||
{
|
||||
/* w is probably broken, so fix it */
|
||||
this->w = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Tuple::fixVector()
|
||||
{
|
||||
|
||||
if (isnan(this->x) || isnan(this->y) || isnan(this->z))
|
||||
{
|
||||
/* w is probably broken, so fix it */
|
||||
this->w = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Tuple::isRepresentable()
|
||||
{
|
||||
return !(isnan(this->x) || isnan(this->y) || isnan(this->z));
|
||||
}
|
||||
Reference in New Issue
Block a user