void WriteBezierSegment(CubicBezierSegment bs) {
     WriteStartElement(GeometryToken.CubicBezierSegment);
     WriteAttribute(GeometryToken.Points, PointsToString(bs.B(0), bs.B(1), bs.B(2), bs.B(3)));
     WriteEndElement();
 }
 string CubicBezierSegmentToString(CubicBezierSegment cubic, char previousInstruction) {
     var str = PointsToString(cubic.B(1), cubic.B(2), cubic.B(3));
     return previousInstruction=='C'?str:"C"+str;
 }
 string CubicBezierSegmentToString(CubicBezierSegment cubic)
 {
     return "C" + PointsToString(cubic.B(1), cubic.B(2), cubic.B(3));
 }
 private bool BezierSegIntersectsBoundary(CubicBezierSegment seg) {
     double side = Point.SignedDoubledTriangleArea(seg.B(0), seg.B(1), seg.B(2));
     if (side > 0)
         return BezierSegIntersectsTree(seg, thinLeftHierarchy) || BezierSegIntersectsTree(seg, leftHierarchy);
     else
         return BezierSegIntersectsTree(seg, thinRightHierarchy) || BezierSegIntersectsTree(seg, rightHierarchy);
 }
Ejemplo n.º 5
0
 static GraphicsPath CreateControlPointPolygon(Tuple<double, double> t, CubicBezierSegment cubic){
     var gp = new GraphicsPath();
     gp.AddLines(new[]{PP(cubic.B(0)), PP(cubic.B(1)), PP(cubic.B(2)), PP(cubic.B(3))});
     return gp;
 }
Ejemplo n.º 6
0
        internal static void DrawControlPoints(Graphics g, CubicBezierSegment bs){
            using (var pen = new Pen(Color.Green, (float) (1.0/1000.0))){
                pen.DashPattern = new[]{1, (float) 1};

                pen.DashStyle = DashStyle.Dot;
                g.DrawLine(pen, PointF(bs.B(0)), PointF(bs.B(1)));
                g.DrawLine(pen, PointF(bs.B(1)), PointF(bs.B(2)));
                g.DrawLine(pen, PointF(bs.B(2)), PointF(bs.B(3)));
            }
        }
Ejemplo n.º 7
0
 static void DrawBezier(DGraph graphToDraw, Pen myPen, Graphics g, CubicBezierSegment bs){
     g.DrawBezier(myPen, (float) bs.B(0).X, (float) bs.B(0).Y,
                  (float) bs.B(1).X, (float) bs.B(1).Y,
                  (float) bs.B(2).X, (float) bs.B(2).Y,
                  (float) bs.B(3).X, (float) bs.B(3).Y);
     if(graphToDraw.DrawingGraph.ShowControlPoints)
         DrawControlPoints(g, bs);
 }