Add vector reflection via a normal vector.
This commit is contained in:
@@ -33,4 +33,9 @@ Tuple Tuple::cross(const Tuple &b) const
|
||||
this->z * b.x - this->x * b.z,
|
||||
this->x * b.y - this->y * b.x,
|
||||
0);
|
||||
}
|
||||
|
||||
Tuple Tuple::reflect(const Tuple &normal)
|
||||
{
|
||||
return *this - normal * 2 * this->dot(normal);
|
||||
}
|
||||
Reference in New Issue
Block a user