ReflectPointInLine() public static method

Reflects a point in a line defined by two points.
public static ReflectPointInLine ( Vector3D input, Vector3D p1, Vector3D p2 ) : Vector3D
input Vector3D
p1 Vector3D
p2 Vector3D
return Vector3D
Exemplo n.º 1
0
        /// <summary>
        /// Reflect a point in us.
        /// ZZZ - This method is confusing in that it is opposite the above (we aren't reflecting ourselves here).
        /// </summary>
        /// <param name="p"></param>
        public Vector3D ReflectPoint(Vector3D p)
        {
            if (this.IsLine)
            {
                return(Euclidean2D.ReflectPointInLine(p, P1, P2));
            }
            else
            {
                // Handle infinities.
                Vector3D infinityVector = Infinity.InfinityVector;
                if (p.Compare(Center))
                {
                    return(infinityVector);
                }
                if (p == infinityVector)
                {
                    return(Center);
                }

                Vector3D v = p - Center;
                double   d = v.Abs();
                v.Normalize();
                return(Center + v * (Radius * Radius / d));
            }
        }
Exemplo n.º 2
0
 public Vector3D ReflectPoint(Vector3D input)
 {
     if (SegmentType.Arc == Type)
     {
         Circle c = this.Circle;
         return(c.ReflectPoint(input));
     }
     else
     {
         return(Euclidean2D.ReflectPointInLine(input, P1, P2));
     }
 }