Esempio n. 1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Point3d P = new Point3d(0, 0, 0);
            double  R = 1.0;

            if (!DA.GetData(0, ref P))
            {
                return;
            }
            if (!DA.GetData(1, ref R))
            {
                return;
            }

            wPoint O   = new wPoint(P.X, P.Y, P.Z);
            wCurve Crv = new wCircle(O, R);

            wShape           Shape  = new wShape(Crv);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, R, R);
            Shapes.Type     = Crv.GetCurveType;

            Shapes.Graphics = new wGraphic().BlackFill();
            Shapes.Effects  = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
Esempio n. 2
0
        private hCircle AddCircle(wCircle InputCurve)
        {
            hCircle crv = new hCircle(InputCurve);

            crv.BuildSVGCurve();
            return(crv);
        }
Esempio n. 3
0
        public Path WpfCircle(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            Path    X = new Path();
            wCircle C = (wCircle)Shp;

            EllipseGeometry E = new EllipseGeometry();

            E.Center  = new System.Windows.Point((C.Center.X) * Scale, (C.Center.Y) * Scale);
            E.RadiusX = C.Radius * Scale;
            E.RadiusY = C.Radius * Scale;

            X.Data            = E;
            X.RenderTransform = Xform;

            X = SetPathFill(X, Graphics);
            X = SetPathStroke(X, Graphics);
            X = SetPathEffects(X, ShapeEffects);

            group.Shapes.Add(new wShape(E, Graphics));
            return(X);
        }
Esempio n. 4
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Curve  C = new Circle(new Point3d(0, 0, 0), 1).ToNurbsCurve();
            double D = 0;
            double K = 0;

            if (!DA.GetData(0, ref C))
            {
                return;
            }
            if (!DA.GetData(1, ref D))
            {
                return;
            }
            if (!DA.GetData(2, ref K))
            {
                return;
            }

            wCurve Crv = new wCircle(new wPoint(), 1);

            Curve[] Segments = C.DuplicateSegments();

            // Check if is pline
            if (Segments.Count() > 1)
            {
                Polyline P = new Polyline();
                if (C.TryGetPolyline(out P))
                {
                    List <wPoint> Pts = new List <wPoint>();
                    for (int i = 0; i < P.Count; i++)
                    {
                        Pts.Add(new wPoint(P[i].X, P[i].Y, P[i].Z));
                    }

                    Crv = new wPolyline(Pts, P.IsClosed);
                }
                else
                {
                    Crv = new RhCrvToWindCrv().ToPiecewiseBezier(C, D, K);
                }
            }
            else
            {
                Crv = new RhCrvToWindCrv(C).WindCurve;
            }

            BoundingBox B = C.GetBoundingBox(true);
            wPoint      O = new wPoint(B.Center.X, B.Center.Y, B.Center.Z);

            wShape           Shape  = new wShape(Crv);
            wShapeCollection Shapes = new wShapeCollection(Shape);

            wPlane Pln = new wPlane().XYPlane();

            Pln.Origin = O;

            Shapes.Boundary = new wRectangle(Pln, B.Diagonal.X, B.Diagonal.Y);
            Shapes.Type     = Crv.GetCurveType;

            if (C.IsClosed)
            {
                Shapes.Graphics = new wGraphic().BlackFill();
            }
            else
            {
                Shapes.Graphics = new wGraphic().BlackOutline();
            }
            Shapes.Effects = new wEffects();


            wObject WindObject = new wObject(Shapes, "Hoopoe", Shapes.Type);

            DA.SetData(0, WindObject);
        }
Esempio n. 5
0
 public hCircle(wCircle WindGeometry)
 {
     CenterX = WindGeometry.Center.X;
     CenterY = WindGeometry.Center.Y;
     Radius  = WindGeometry.Radius;
 }