Example #1
0
        public static IPolyLine3D ConvertTo3D(IPolyLine2D polyline, IMatrix44 lcs)
        {
            var geom = GeomOperation.ConvertTo3D(polyline);

            GeomOperation.TransformToGCS(lcs, geom);
            return(geom);
        }
Example #2
0
        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);
        }