/** * Scales the plane by a factor. * * @param scale the scale for this operation * @return the scaled object */ public Plane3D scaleBy(double scale) { double newDist = distance * scale; Point3D newDir; if (newDist < 0) { newDir = normal.reflectOrigin(); newDist = -newDist; } else { newDir = normal; } return new Plane3D(newDist, newDir); }
/** * Translates the plane by a vector <code>translateVector</code> without changing the original * plane. * * @param translateVector the point or vector by which the object shall be translated * @return the resulting translated plane */ public Plane3D translateBy(Point3D translateVector) { double additionalDist = normal.getScalarProduct(translateVector); double newDist = distance + additionalDist; Point3D newDir; if (newDist < 0) { newDir = normal.reflectOrigin(); newDist = -newDist; } else { newDir = normal; } return new Plane3D(newDist, newDir); }
/** * Reflects the plane at the origin without changing the original plane. * * @return the resulting reflected plane */ public Plane3D reflectOrigin() { return new Plane3D(distance, normal.reflectOrigin()); }