reflectionOfPoint method

Point reflectionOfPoint(
  1. Point other
)

Given a point in space, this method finds the point that is the reflection of the given point through the plane.

Implementation

Point reflectionOfPoint(Point other) {
  Vector pVector = (other - point).toVector();
  Vector3 reflectionVector = pVector - normal.scale(2 * normal.dot(pVector));
  return point + reflectionVector.toPoint();
}