예제 #1
0
        /***************************************************/

        public static List <ICurve> AllEdgeCurves(this PanelPlanar panel)
        {
            List <ICurve> result = panel.ExternalEdgeCurves();

            result.AddRange(panel.InternalEdgeCurves());
            return(result);
        }
예제 #2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static double Area(this PanelPlanar panel)
        {
            List <PolyCurve> externalEdges = panel.ExternalEdgeCurves().IJoin();
            List <PolyCurve> internalEdges = panel.InternalEdgeCurves().IJoin();

            return(externalEdges.Select(x => x.Area()).Sum() - internalEdges.Select(x => x.Area()).Sum());
        }
예제 #3
0
        /***************************************************/

        public static List <Point> PointGrid(this PanelPlanar panel)
        {
            List <ICurve> curves = panel.ExternalEdgeCurves();

            List <PolyCurve> joined = curves.IJoin();
            List <PolyCurve> joinedOpeningCurves = panel.InternalEdgeCurves().IJoin();

            Plane plane = joined.First().FitPlane();

            Vector z = Vector.ZAxis;

            double angle = plane.Normal.Angle(z);

            Vector axis = plane.Normal.CrossProduct(z);

            TransformMatrix matrix = Engine.Geometry.Create.RotationMatrix(Point.Origin, axis, angle);

            List <PolyCurve> rotated = curves.Select(x => x.IRotate(Point.Origin, axis, angle)).ToList().IJoin();

            BoundingBox bounds = rotated.First().Bounds();

            for (int i = 1; i < rotated.Count; i++)
            {
                bounds += rotated[i].Bounds();
            }

            double xMin = bounds.Min.X;
            double yMin = bounds.Min.Y;
            double zVal = bounds.Min.Z;

            int steps = 9;

            double xStep = (bounds.Max.X - xMin) / steps;
            double yStep = (bounds.Max.Y - yMin) / steps;

            List <Point>    pts       = new List <Point>();
            TransformMatrix transpose = matrix.Transpose();

            for (int i = 0; i < steps; i++)
            {
                double x = xMin + xStep * i;
                for (int j = 0; j < steps; j++)
                {
                    Point pt = new Point {
                        X = x, Y = yMin + yStep * j, Z = zVal
                    };
                    bool isInside = false;

                    pt = pt.Transform(transpose);

                    foreach (PolyCurve crv in joined)
                    {
                        List <Point> list = new List <Point> {
                            pt
                        };
                        if (crv.IsContaining(list, true, 1E-3))
                        {
                            if (!joinedOpeningCurves.Any(c => c.IsContaining(list, false)))
                            {
                                isInside = true;
                                break;
                            }
                        }
                    }
                    if (isInside)
                    {
                        pts.Add(pt);
                    }
                }
            }

            return(pts);
        }
예제 #4
0
        /******************************************/
        /****          Panel outline           ****/
        /******************************************/

        public static PolyCurve Outline(this PanelPlanar panel)
        {
            return(new PolyCurve {
                Curves = panel.ExternalEdgeCurves()
            });
        }