Exemplo n.º 1
0
        public wCurve ToPiecewiseBezier(Curve RhinoCurve, double DistanceTol, double KinkTol)
        {
            NurbsCurve N = RhinoCurve.ToNurbsCurve();

            N.MakePiecewiseBezier(true);
            BezierCurve[] B = BezierCurve.CreateCubicBeziers(N, DistanceTol, KinkTol);

            Point3d PtA = B[0].GetControlVertex3d(0);
            Point3d PtB = B[0].GetControlVertex3d(1);
            Point3d PtC = B[0].GetControlVertex3d(2);
            Point3d PtD = B[0].GetControlVertex3d(3);

            wBezierSpline pCurve = new wBezierSpline(new wPoint(PtA.X, PtA.Y, PtA.Z), new wPoint(PtB.X, PtB.Y, PtB.Z), new wPoint(PtC.X, PtC.Y, PtC.Z), new wPoint(PtD.X, PtD.Y, PtD.Z));

            for (int i = 1; i < B.Count(); i++)
            {
                PtA = B[i].GetControlVertex3d(0);
                PtB = B[i].GetControlVertex3d(1);
                PtC = B[i].GetControlVertex3d(2);
                PtD = B[i].GetControlVertex3d(3);
                pCurve.AddSpan(new wPoint(PtA.X, PtA.Y, PtA.Z), new wPoint(PtB.X, PtB.Y, PtB.Z), new wPoint(PtC.X, PtC.Y, PtC.Z), new wPoint(PtD.X, PtD.Y, PtD.Z));
            }
            WindCurve = pCurve;

            return(WindCurve);
        }
Exemplo n.º 2
0
        private hCubicBezierSpline AddSpline(wBezierSpline InputCurve)
        {
            hCubicBezierSpline crv = new hCubicBezierSpline(InputCurve);

            crv.BuildSVGCurve();
            return(crv);
        }
Exemplo n.º 3
0
        public Path WpfCompoundSpline(wShapeCollection Shapes)
        {
            Path X = new Path();
            PathFigureCollection Fc = new PathFigureCollection();
            PathGeometry         G  = new PathGeometry();

            Fc.Clear();

            foreach (wShape Shp in Shapes.Shapes)
            {
                PathSegmentCollection Sc = new PathSegmentCollection();
                PathFigure            Pf = new PathFigure();
                wBezierSpline         C  = (wBezierSpline)Shp.Curve;
                wPoint StartPoint        = C.Points[0];

                PolyBezierSegment S = new PolyBezierSegment();

                Pf.StartPoint = new System.Windows.Point(C.Points[0].X * Scale, C.Points[0].Y * Scale);

                for (int i = 1; i < C.Points.Count; i++)
                {
                    wPoint P = C.Points[i];
                    S.Points.Add(new System.Windows.Point(P.X * Scale, P.Y * Scale));
                }

                Sc.Add(S);
                Pf.Segments = Sc;
                //Pf.IsClosed = true;
                Fc.Add(Pf);
            }

            G.Figures = Fc;
            X.Data    = G;

            X.RenderTransform = Xform;

            wGraphic Graphics     = Shapes.Graphics;
            wEffects ShapeEffects = Shapes.Effects;

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


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
Exemplo n.º 4
0
        public Path WpfSpline(wCurve Shp, wGraphic Graphics, wEffects ShapeEffects)
        {
            wBezierSpline C = (wBezierSpline)Shp;

            PathFigure            Pf = new PathFigure();
            PolyBezierSegment     S  = new PolyBezierSegment();
            PathGeometry          G  = new PathGeometry();
            PathFigureCollection  Fc = new PathFigureCollection();
            PathSegmentCollection Sc = new PathSegmentCollection();

            Path X = new Path();

            Pf.StartPoint = new System.Windows.Point(C.Points[0].X * Scale, C.Points[0].Y * Scale);

            for (int i = 1; i < C.Points.Count; i++)
            {
                wPoint P = C.Points[i];
                S.Points.Add(new System.Windows.Point(P.X * Scale, P.Y * Scale));
            }

            Sc.Add(S);
            Pf.Segments = Sc;
            Fc.Add(Pf);
            G.Figures = Fc;
            X.Data    = G;

            X.StrokeMiterLimit = 1.0;

            X.RenderTransform = Xform;

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


            group.Shapes.Add(new wShape(G, Graphics));
            return(X);
        }
Exemplo n.º 5
0
 public hCubicBezierSpline(wBezierSpline WindGeometry)
 {
     Points = WindGeometry.Points;
 }