Exemplo n.º 1
0
 internal double DistanceAlongRay2(DmtxRay2 ray)
 {
     if (Math.Abs(1.0 - ray.V.Mag()) > DmtxConstants.DmtxAlmostZero)
     {
         throw new ArgumentException("DistanceAlongRay2: The ray's V vector must be a unit vector");
     }
     return((this - ray.P).Dot(ray.V));
 }
Exemplo n.º 2
0
        internal bool PointAlongRay2(DmtxRay2 ray, double t)
        {
            if (Math.Abs(1.0 - ray.V.Mag()) > DmtxConstants.DmtxAlmostZero)
            {
                throw new ArgumentException("PointAlongRay: The ray's V vector must be a unit vector");
            }
            DmtxVector2 tmp = new DmtxVector2(ray.V.X * t, ray.V.Y * t);

            this.X = ray.P.X + tmp.X;
            this.Y = ray.P.Y + tmp.Y;
            return(true);
        }
Exemplo n.º 3
0
        internal bool Intersect(DmtxRay2 p0, DmtxRay2 p1)
        {
            double denominator = p1.V.Cross(p0.V);

            if (Math.Abs(denominator) < DmtxConstants.DmtxAlmostZero)
            {
                return(false);
            }
            double numerator = p1.V.Cross(p1.P - p0.P);

            return(PointAlongRay2(p0, numerator / denominator));
        }