Esempio n. 1
0
 public bool Equals(Line other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return (Equals(other.Start, Start) && Equals(other.End, End))
         || (Equals(other.End, Start) && Equals(other.Start, End));
 }
Esempio n. 2
0
 /// <summary>
 /// Returns the intersection point closest to the start of the line.
 /// </summary>
 /// <param name="line">The intersection line</param>
 /// <returns>The closest intersecting point, or null if the line doesn't intersect.</returns>
 public override Coordinate GetIntersectionPoint(Line line)
 {
     var faces = GetBoxFaces().Union(MetaData.GetAll<List<Face>>().SelectMany(x => x));
     return faces.Select(x => x.GetIntersectionPoint(line))
         .Where(x => x != null)
         .OrderBy(x => (x - line.Start).VectorMagnitude())
         .FirstOrDefault();
 }
Esempio n. 3
0
 public UnitRotate(decimal scalar, Line axis)
 {
     Rotation = scalar;
     Axis = axis;
 }
Esempio n. 4
0
        private Coordinate GetIntersectionPoint(MapObject obj, Line line)
        {
            if (obj == null) return null;

            var solid = obj as Solid;
            if (solid == null) return obj.GetIntersectionPoint(line);

            return solid.Faces.Where(x => x.Opacity > 0 && !x.IsHidden)
                .Select(x => x.GetIntersectionPoint(line))
                .Where(x => x != null)
                .OrderBy(x => (x - line.Start).VectorMagnitude())
                .FirstOrDefault();
        }
Esempio n. 5
0
 public bool EquivalentTo(Line other, decimal delta = 0.0001m)
 {
     return (Start.EquivalentTo(other.Start, delta) && End.EquivalentTo(other.End, delta))
         || (End.EquivalentTo(other.Start, delta) && Start.EquivalentTo(other.End, delta));
 }