makePlaneReflection function

Matrix4 makePlaneReflection (Vector3 planeNormal, Vector3 planePoint)

Returns a transformation matrix that transforms points by reflecting them through the plane specified with planeNormal and planePoint.


Matrix4 makePlaneReflection(Vector3 planeNormal, Vector3 planePoint) {
  final Vector4 v = new Vector4([0],[1],[2], 0.0);
  final Matrix4 outer = new Matrix4.outer(v, v)..scale(2.0);
  Matrix4 r = new;
  r = r - outer;
  final double scale = 2.0 *;
  final Vector3 scaledNormal = (planeNormal.scaled(scale));
  final Vector4 T = new Vector4([0],[1],[2], 1.0);
  r.setColumn(3, T);
  return r;