Exemplo n.º 1
0
        public static Polyline GetProjectedPolyline(this Polyline2d pline, [NotNull] Plane plane, Vector3d direction)
        {
            var tol = new Tolerance(1e-9, 1e-9);

            if (plane.Normal.IsPerpendicularTo(direction, tol))
            {
                return(null);
            }

            if (pline.Normal.IsPerpendicularTo(direction, tol))
            {
                var dirPlane = new Plane(Point3d.Origin, direction);
                if (!pline.IsWriteEnabled)
                {
                    // ReSharper disable once UpgradeOpen
                    pline.UpgradeOpen();
                }

                pline.TransformBy(Matrix3d.WorldToPlane(dirPlane));
                var extents = pline.GeometricExtents;
                pline.TransformBy(Matrix3d.PlaneToWorld(dirPlane));
                return(GeomExt.ProjectExtents(extents, plane, direction, dirPlane));
            }

            return(GeomExt.ProjectPolyline(pline, plane, direction));
        }
Exemplo n.º 2
0
 public static Polyline GetProjectedPolyline(this Polyline3d pline, [NotNull] Plane plane, Vector3d direction)
 {
     return(plane.Normal.IsPerpendicularTo(direction, new Tolerance(1e-9, 1e-9))
         ? null
         : GeomExt.ProjectPolyline(pline, plane, direction));
 }