public static IPolyLine3D ConvertTo3D(IPolyLine2D polyline, IMatrix44 lcs) { var geom = GeomOperation.ConvertTo3D(polyline); GeomOperation.TransformToGCS(lcs, geom); return(geom); }
public static ISegment2D ConvertTo2D(ISegment3D segment3D, IMatrix44 lcs) { var segmentCopy = segment3D.CloneSegment(); GeomOperation.TransformToLCS(lcs, segmentCopy); var segment2D = ConvertTo2D(segmentCopy); return(segment2D); }
/// <summary> /// Transforms given polyline 3D to LCS using matrix and converts to 2D geometry. /// </summary> /// <param name="polyline3D">Polyline to convert.</param> /// <param name="lcs">Local coordinate system.</param> /// <returns>2D geometry.</returns> public static IPolyLine2D ConvertTo2D(IPolyLine3D polyline3D, IMatrix44 lcs) { var polylineCopy = new PolyLine3D(polyline3D); GeomOperation.TransformToLCS(lcs, polylineCopy); var polyline2D = ConvertTo2D(polylineCopy); return(polyline2D); }
public static IRegion2D ConvertTo2D(IRegion3D region3D, IMatrix44 lcs) { var regionCopy = new Region3D(region3D); GeomOperation.TransformToLCS(lcs, regionCopy); var outline2D = ConvertTo2D(regionCopy.Outline); var region2D = new Region2D(outline2D); if (regionCopy.OpeningsCount > 0) { foreach (var opening3D in regionCopy.Openings) { region2D.Openings.Add(ConvertTo2D(opening3D)); } } return(region2D); }
internal static IPolyLine3D ConvertTo3D(IPolygon2D polygon2D, Func <double, double, IPoint3D> createPoint, IMatrix44 lcs = null) { if (polygon2D == null) { return(null); } var count = polygon2D.Count; if (count > 1) { var polyline3D = new PolyLine3D(); var beg = createPoint(polygon2D[0].X, polygon2D[0].Y); for (var i = 1; i < count; ++i) { var end = createPoint(polygon2D[i].X, polygon2D[i].Y); var seg = new LineSegment3D(beg, end); polyline3D.Add(seg); beg = end; } if (polygon2D.IsClosed) { polyline3D.Segments.Last().EndPoint = polyline3D.Segments.First().StartPoint; } if (lcs != null) { GeomOperation.TransformToGCS(lcs, polyline3D); } return(polyline3D); } return(null); }