Пример #1
0
        // This reflects the vector v over mirror m
        // Note that mirror m must be normalized!
        // R = V - 2 * M * (M dot V)
        public static Vector2D Reflect(Vector2D v, Vector2D m)
        {
            // Get the dot product of v and m
            float dp = Vector2D.DotProduct(m, v);

            // Make the reflected vector
            Vector2D mv = new Vector2D();

            mv.x = v.x - (2f * m.x * dp);
            mv.y = v.y - (2f * m.y * dp);

            // Return the reflected vector
            return(mv);
        }
Пример #2
0
 /// <summary>
 /// This returns Z on the plane at X, Y
 /// </summary>
 public double GetZ(Vector2D pos)
 {
     return((-offset - Vector2D.DotProduct(normal, pos)) / normal.z);
 }