コード例 #1
0
        public static Polyline OutlineFromFaceEdgeCorner(Plane facePlane, Plane[] edgePlanes, Plane[] bisePlanes, int T = 1, double tolerance = 0.1)
        {
            Polyline polyline = new Polyline();

            switch (T)
            {
            case (2):

                for (int j = 0; j < edgePlanes.Length; j++)
                {
                    Plane currPlane = edgePlanes[j];
                    Plane nextPlane = edgePlanes[MathUtil.Wrap(j + 1, edgePlanes.Length)];


                    if (Vector3d.VectorAngle(currPlane.XAxis, nextPlane.XAxis) < tolerance)
                    {
                        Vector3d vv = new Vector3d(currPlane.XAxis);
                        vv.Rotate(Math.PI * 0.5, currPlane.YAxis);
                        nextPlane = new Plane(bisePlanes[j].Origin, vv, currPlane.YAxis);
                    }

                    Line line = PlaneUtil.PlanePlane(currPlane, nextPlane);
                    polyline.Add(PlaneUtil.LinePlane(line, facePlane));
                }
                polyline.Close();
                break;

            default:
                for (int j = 0; j < bisePlanes.Length; j++)
                {
                    Point3d pt;
                    Rhino.Geometry.Intersect.Intersection.PlanePlanePlane(facePlane, bisePlanes[j], edgePlanes[j], out pt);
                    polyline.Add(pt);
                }
                polyline.Close();
                break;
            }


            return(polyline);
        }
コード例 #2
0
        public static List <Circle> SortCircles(List <Circle> x)
        {
            if (x.Count == 1)
            {
                return(x);
            }

            List <Circle> sortedCircles = new List <Circle>()
            {
                x[0]
            };

            for (int i = 1; i < x.Count; i++)
            {
                Plane  plane  = PlaneUtil.ProjectPlaneXPlaneToYPlane(sortedCircles[sortedCircles.Count - 1].Plane, x[i].Plane);
                Circle circle = new Circle(plane, x[i].Radius);
                sortedCircles.Add(circle);
            }

            return(sortedCircles);
        }