Example #1
0
        public int CompareTo(object c)
        {
            ISectData c1 = this;
            ISectData c2 = (ISectData)c;
            double    d1 = (c1.origin.X - c1.intersect.X) * (c1.origin.X - c1.intersect.X) +
                           (c1.origin.Y - c1.intersect.Y) * (c1.origin.Y - c1.intersect.Y) +
                           (c1.origin.Z - c1.intersect.Z) * (c1.origin.Z - c1.intersect.Z);

            double d2 = (c2.origin.X - c2.intersect.X) * (c2.origin.X - c2.intersect.X) +
                        (c2.origin.Y - c2.intersect.Y) * (c2.origin.Y - c2.intersect.Y) +
                        (c2.origin.Z - c2.intersect.Z) * (c2.origin.Z - c2.intersect.Z);

            if (d1 > d2)
            {
                return(1);
            }
            if (d1 < d2)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
Example #2
0
        internal static ISectData ISectGroundPlane(Vector3Class direction, Vector3Class origin)
        {
            ISectData isect = null;

            TriangleIntersection[] intersect = null;

            // var groundPanel = CreateGroundPlane();
            if (IntersectTriangle(origin, direction, ObjectView.GroundPaneInflated, typeDirection.OneWay, false, new Vector3Class(), out intersect))
            {
                if (intersect != null && intersect.Length > 0)
                {
                    isect = new ISectData(null, null, intersect[0].IntersectionPoint, origin, direction);
                }
            }

            return(isect);
        }