public static ICollection <Point> IntersectSpheres(ICollection <Sphere> sphereCollection)
        {
            Debug.Assert(sphereCollection.Count > 2, "Not enough spheres to get vertex.");

            List <Sphere> spheres = new List <Sphere>(sphereCollection);

            Body body = ShapeHelper.CreateSphere(spheres[0].Frame.Origin, spheres[0].Radius * 2);

            spheres.RemoveAt(0);

            while (spheres.Count > 0)
            {
                Body tool = ShapeHelper.CreateSphere(spheres[0].Frame.Origin, spheres[0].Radius * 2);
                spheres.RemoveAt(0);
                body.Intersect(new Body[] { tool });
            }

            List <Point> points = new List <Point>();

            foreach (Vertex vertex in body.Vertices)
            {
                points.Add(vertex.Position);
            }

            return(points);
        }
Exemplo n.º 2
0
        public static void Print(this Cone cone, Part part = null)
        {
            double startV = -Math.Cos(cone.HalfAngle) * cone.Radius;
            double endV   = 0;

            ShapeHelper.CreateRevolvedCurve(cone.Axis, CurveSegment.Create(
                                                cone.Evaluate(PointUV.Create(0, startV)).Point,
                                                cone.Evaluate(PointUV.Create(0, endV)).Point
                                                )).Print(part);

            //	Circle.Create(cone.Frame, cone.Radius).Print(part);
            //	CurveSegment.Create(cone.Evaluate(PointUV.Create(0, 0)).Point, cone.Evaluate(PointUV.Create(Math.PI / 2, 0)).Point).Print(part);
        }