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); }
public bool Contains(LineAdaptor line) { if (null == line) return false; if (Contains(line.BasePoint) && Normal.IsPerpendicularTo(line.Direction)) return true; return false; }
// 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); } }
public GeLine(GePoint point, UnitVector direction) { Debug.Assert(point != null && direction != null); m_Proxy = MathAdaptorFactory.Instance.CreateLineAdaptor(point._Proxy, direction._Proxy); }
public bool IsOn(LineAdaptor line) { if (null == line) return false; return line.Contains(this); }
public bool IsParallelTo(LineAdaptor lineB) { if (null == lineB) return false; return (this.Direction.IsParallelTo(lineB.Direction)); }