Ejemplo n.º 1
0
        public void Mirror(IPlane plane)
        {
            IVector3D n         = plane.Normal;
            IMatrix   tensor    = n.TensorProduct(n);
            double    dot_plane = IVector3D.Dot(plane.Origin, n);

            double[][] data = new double[4][];
            data[0] = new double[] { 1 - 2 * tensor.GetData(0, 0), -2 * tensor.GetData(0, 1), -2 * tensor.GetData(0, 2), 0 };
            data[1] = new double[] { -2 * tensor.GetData(1, 0), 1 - 2 * tensor.GetData(1, 1), -2 * tensor.GetData(1, 2), 0 };
            data[2] = new double[] { -2 * tensor.GetData(2, 0), -2 * tensor.GetData(2, 1), 1 - 2 * tensor.GetData(2, 2), 0 };
            data[3] = new double[] { 2 * dot_plane * n.X, 2 * dot_plane * n.Y, 2 * dot_plane * n.Z, 1 };
            IMatrix m = new IMatrix(data);

            TransformationMatrix = IMatrix.Mult(TransformationMatrix, m);
        }