Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/Paths/SvgPathSegCurvetoQuadratic.cs @ 14161

Last change on this file since 14161 was 12762, checked in by aballeit, 9 years ago

#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)

File size: 1.2 KB
Line 
1using System;
2
3using SharpVectors.Polynomials;
4
5namespace SharpVectors.Dom.Svg
6{
7  public abstract class SvgPathSegCurvetoQuadratic : SvgPathSegCurveto
8  {
9    protected SvgPathSegCurvetoQuadratic(SvgPathSegType type) : base(type)
10    {
11    }
12
13    public abstract override SvgPointF AbsXY{get;}
14    public abstract override SvgPointF CubicX1Y1{get;}
15    public abstract override SvgPointF CubicX2Y2{get;}
16
17    public abstract SvgPointF QuadraticX1Y1{get;}
18
19        protected override SqrtPolynomial getArcLengthPolynomial()
20        {
21            double c2x, c2y, c1x, c1y;
22            SvgPointF p1 = PreviousSeg.AbsXY;
23            SvgPointF p2 = QuadraticX1Y1;
24            SvgPointF p3 = AbsXY;
25           
26            c2x = p1.X - 2.0 * p2.X + p3.X;
27            c2y = p1.Y - 2.0 * p2.Y + p3.Y;
28
29            c1x = -2.0*p1.X + 2.0*p2.X;
30            c1y = -2.0*p1.Y + 2.0*p2.Y;
31
32            // build polynomial
33            // dx = dx/dt
34            // dy = dy/dt
35            // sqrt poly = sqrt( (dx*dx) + (dy*dy) )
36            return new SqrtPolynomial(
37                c1x*c1x + c1y*c1y, 4.0*(c1x*c2x + c1y*c2y), 4.0*(c2x*c2x + c2y*c2y));
38        }
39  }
40}
Note: See TracBrowser for help on using the repository browser.