Last change
on this file since 13757 was
12762,
checked in by aballeit, 9 years ago
|
#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)
|
File size:
1.5 KB
|
Rev | Line | |
---|
[12762] | 1 | using System;
|
---|
| 2 |
|
---|
| 3 | using SharpVectors.Polynomials;
|
---|
| 4 |
|
---|
| 5 | namespace SharpVectors.Dom.Svg
|
---|
| 6 | {
|
---|
| 7 | public abstract class SvgPathSegCurveto : SvgPathSeg
|
---|
| 8 | {
|
---|
| 9 | #region constructors
|
---|
| 10 | protected SvgPathSegCurveto(SvgPathSegType type) : base(type)
|
---|
| 11 | {
|
---|
| 12 | }
|
---|
| 13 | #endregion
|
---|
| 14 |
|
---|
| 15 | #region abstract properties
|
---|
| 16 |
|
---|
| 17 | public abstract override SvgPointF AbsXY { get; }
|
---|
| 18 | public abstract SvgPointF CubicX1Y1 { get; }
|
---|
| 19 | public abstract SvgPointF CubicX2Y2 { get; }
|
---|
| 20 |
|
---|
| 21 | #endregion
|
---|
| 22 |
|
---|
| 23 | #region public properties
|
---|
| 24 | public override double Length
|
---|
| 25 | {
|
---|
| 26 | get
|
---|
| 27 | {
|
---|
| 28 | return this.getArcLengthPolynomial().Simpson(0, 1);
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | public override double StartAngle
|
---|
| 33 | {
|
---|
| 34 | get
|
---|
| 35 | {
|
---|
| 36 | SvgPointF p1 = PreviousSeg.AbsXY;
|
---|
| 37 | SvgPointF p2 = CubicX1Y1;
|
---|
| 38 |
|
---|
| 39 | double dx = p2.X - p1.X;
|
---|
| 40 | double dy = p2.Y - p1.Y;
|
---|
| 41 | double a = (Math.Atan2(dy, dx) * 180 / Math.PI);
|
---|
| 42 | a += 270;
|
---|
| 43 | a %= 360;
|
---|
| 44 | return a;
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public override double EndAngle
|
---|
| 49 | {
|
---|
| 50 | get
|
---|
| 51 | {
|
---|
| 52 | SvgPointF p1 = CubicX2Y2;
|
---|
| 53 | SvgPointF p2 = AbsXY;
|
---|
| 54 |
|
---|
| 55 | double dx = p1.X - p2.X;
|
---|
| 56 | double dy = p1.Y - p2.Y;
|
---|
| 57 | double a = (Math.Atan2(dy, dx) * 180 / Math.PI);
|
---|
| 58 | a += 270;
|
---|
| 59 | a %= 360;
|
---|
| 60 | return a;
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | #endregion
|
---|
| 64 |
|
---|
| 65 | protected abstract SqrtPolynomial getArcLengthPolynomial();
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.