private static List <Polyline> DrawCorridor(List <Point3d> anchors, List <Line> mainAxis) { List <Polyline> corridor = new List <Polyline>(); if (anchors.Count < 2) { return(null); } List <Rectangle3d> rectList = new List <Rectangle3d>(); for (int i = 0; i < anchors.Count - 1; i++) { Rectangle3d tempRect = RectangleTools.DrawP2PRect(anchors[i], anchors[i + 1], CorridorDimension.OneWayWidth); rectList.Add(tempRect); } if (rectList.Count > 1) { Curve intersected = rectList[0].ToNurbsCurve(); for (int i = 0; i < rectList.Count - 1; i++) { List <Curve> unionCurves = new List <Curve>(); unionCurves.Add(intersected); unionCurves.Add(rectList[i + 1].ToNurbsCurve()); intersected = Curve.CreateBooleanUnion(unionCurves)[0]; } corridor.Add(CurveTools.ToPolyline(intersected)); } return(corridor); }
private static List <Polyline> DrawCorridor(Point3d anchor1, Point3d anchor2) { List <Polyline> corridors = new List <Polyline>(); Rectangle3d tempRect = RectangleTools.DrawP2PRect(anchor1, anchor2, CorridorDimension.TwoWayWidth); corridors.Add(tempRect.ToPolyline()); return(corridors); }
private static List <Polyline> DrawCorridor(List <Point3d> anchor1, List <Point3d> anchor2) { List <Polyline> corridors = new List <Polyline>(); for (int i = 0; i < anchor1.Count; i++) { Rectangle3d tempRect = RectangleTools.DrawP2PRect(anchor1[i], anchor2[i], CorridorDimension.TwoWayWidth); corridors.Add(tempRect.ToPolyline()); } return(corridors); }
private static List <Polyline> DrawCorridor(List <Point3d> anchors, List <Line> baseAxis, double subLength) { List <Polyline> corridor = new List <Polyline>(); Rectangle3d subCorridor = RectangleTools.DrawP2PRect(anchors[0], anchors[1], subLength, CorridorDimension.TwoWayWidth); Rectangle3d mainCorridor = RectangleTools.DrawP2PRect(anchors[1], anchors[2], CorridorDimension.TwoWayWidth, subLength); List <Curve> forUnion = new List <Curve>(); forUnion.Add(subCorridor.ToNurbsCurve()); forUnion.Add(mainCorridor.ToNurbsCurve()); corridor.Add(CurveTools.ToPolyline(Curve.CreateBooleanUnion(forUnion)[0])); return(corridor); }
public static bool IsInEllipse(this Rectangle rectangle, int x, int y) => RectangleTools.IsRectangleInEllipse(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, x, y);