public static Polygon3D ToSAM(this TBD.Polygon polygon) { if (polygon == null) { return(null); } List <Point3D> point3Ds = new List <Point3D>(); int index = 0; TBD.TasPoint tasPoint = polygon.GetPoint(index); while (tasPoint != null) { Point3D point3D = tasPoint.ToSAM(); if (point3D != null) { point3Ds.Add(point3D); } index++; tasPoint = polygon.GetPoint(index); } if (point3Ds == null || point3Ds.Count == 0) { return(null); } return(Spatial.Create.Polygon3D(point3Ds)); }
public static BHG.Polyline FromTAS(this TBD.Polygon tbdPolygon) { List <BHG.Point> pnts = new List <BHG.Point>(); int pIndex = 0; TBD.TasPoint tPt = null; try { while ((tPt = tbdPolygon.GetPoint(pIndex)) != null) { pnts.Add(tPt.FromTAS()); pIndex++; } //if(pnts.First().Distance(pnts.Last()) > BHG.Tolerance.Distance) if (pnts.First() != pnts.Last()) { pnts.Add(pnts[0]); //Close the polyline } } catch (Exception ex) { BH.Engine.Base.Compute.RecordError(ex.ToString()); } return(new BHG.Polyline { ControlPoints = pnts }); }
public static TBD.TasPoint ToTAS(this BHG.Point point, TBD.TasPoint tbdPoint) { tbdPoint.x = (float)point.X; tbdPoint.y = (float)point.Y; tbdPoint.z = (float)point.Z; return(tbdPoint); }
public static Point3D ToSAM(this TBD.TasPoint tasPoint) { if (tasPoint == null) { return(null); } return(new Point3D(tasPoint.x, tasPoint.y, tasPoint.z)); }
public static BHG.Point FromTAS(this TBD.TasPoint tbdPoint) { return(new BHG.Point { X = tbdPoint.x, Y = tbdPoint.y, Z = tbdPoint.z, }); }
public static TBD.TasPoint ToTBD(this Point3D point3D) { if (point3D == null) { return(null); } TBD.TasPoint result = new TBD.TasPoint(); result.x = System.Convert.ToSingle(point3D.X); result.y = System.Convert.ToSingle(point3D.Y); result.z = System.Convert.ToSingle(point3D.Z); return(result); }
public static TBD.Polygon ToTASPolygon(this BHG.Polyline polyline, TBD.Polygon tbdPolygon) { if (polyline == null) { return(tbdPolygon); } foreach (BHG.Point pt in polyline.ControlPoints) { TBD.TasPoint p = tbdPolygon.AddPoint(); p = pt.ToTAS(p); } return(tbdPolygon); }
/***************************************************/ public static float MinElevation(TBD.Perimeter tbdPerimeter) { TBD.Polygon tbdPolygon = tbdPerimeter.GetFace(); int indexepoints = 0; float aZvalue = float.MaxValue; TBD.TasPoint TasPoint = tbdPolygon.GetPoint(indexepoints); while (TasPoint != null) { if (TasPoint.z < aZvalue) { aZvalue = TasPoint.z; } indexepoints++; TasPoint = tbdPolygon.GetPoint(indexepoints); } return(aZvalue); }