Esempio n. 1
0
        public GeLine(GePoint sp, GePoint ep)
        {
            Debug.Assert(sp != null && ep != null);

            VectorAdaptor dir = ep._Proxy - sp._Proxy;
            m_Proxy = MathAdaptorFactory.Instance.CreateLineAdaptor(
                sp._Proxy, dir.UnitVectorAdaptor);
        }
Esempio n. 2
0
        public bool Contains(LineAdaptor line)
        {
            if (null == line) return false;

            if (Contains(line.BasePoint)
                && Normal.IsPerpendicularTo(line.Direction))
                return true;

            return false;
        }
Esempio n. 3
0
        // The shortest distance of two lines.
        public double DistanceTo(LineAdaptor lineB)
        {
            Debug.Assert(lineB != null);

            if (IsParallelTo(lineB))
            {
                // Get the distance of point to line
                return DistanceTo(lineB.BasePoint);
            }
            else
            {
                // Get a plan contains line B and is parallel to this line.
                VectorAdaptor normal = this.Direction.Cross(lineB.Direction.VectorAdaptor);
                PlaneAdaptor newPlane = MathAdaptorFactory.Instance.CreatePlaneAdaptor(
                    lineB.BasePoint
                    , MathAdaptorFactory.Instance.CreateUnitVectorAdaptor(
                    normal.X, normal.Y, normal.Z));

                // Get the distance of point to plane
                return this.BasePoint.DistanceTo(newPlane);
            }
        }
Esempio n. 4
0
        public GeLine(GePoint point, UnitVector direction)
        {
            Debug.Assert(point != null && direction != null);

            m_Proxy = MathAdaptorFactory.Instance.CreateLineAdaptor(point._Proxy, direction._Proxy);
        }
Esempio n. 5
0
        public bool IsOn(LineAdaptor line)
        {
            if (null == line) return false;

            return line.Contains(this);
        }
Esempio n. 6
0
        public bool IsParallelTo(LineAdaptor lineB)
        {
            if (null == lineB) return false;

            return (this.Direction.IsParallelTo(lineB.Direction));
        }