Beispiel #1
0
Vector3
reflectVector(Vector3 const & v, Plane3 const & mirror_plane)
{
  // Assume Plane3::normal() is unit
  return v - 2 * v.dot(mirror_plane.getNormal()) * mirror_plane.getNormal();
}
Beispiel #2
0
Vector3
reflectPoint(Vector3 const & p, Plane3 const & mirror_plane)
{
  // Assume Plane3::normal() is unit
  return p - 2 * (p - mirror_plane.getPoint()).dot(mirror_plane.getNormal()) * mirror_plane.getNormal();
}