public void Oval() { var points = new[] { CurvePointUtils.CurvePoint(new[] { 0.5, 1, 0.77614237490000004, 1, 0.22385762510000001, 1 }), CurvePointUtils.CurvePoint(new[] { 1, 0.5, 1, 0.22385762510000001, 1, 0.77614237490000004 }), CurvePointUtils.CurvePoint(new[] { 0.5, 0, 0.22385762510000001, 0, 0.77614237490000004, 0 }), CurvePointUtils.CurvePoint(new[] { 0, 0.5, 0, 0.77614237490000004, 0, 0.22385762510000001 }), }; var oval = new SketchPath(points, true); var svg = SketchCurvePointsToSvg.ToSvgString(oval); Assert.That(svg, Does.Match("^M 0.5 1 C 0.7761423749 1 1 0.7761423749 1 0.5 C 1 0.2238576251 0.7761423749 0 0.5 0 C 0.2238576251 0 0 0.2238576251 0 0.5 C 0 0.7761423749 0.2238576251 1 0.5 1$")); }
public void StartWithCurve() { var points = new[] { CurvePointUtils.CurvePoint(new [] { 0.0, 100, 0, 0, 0, 200 }), CurvePointUtils.LinePoint(50, 0), CurvePointUtils.LinePoint(100, 100) }; var curve = new SketchPath(points, false); var svg = SketchCurvePointsToSvg.ToSvgString(curve); Console.WriteLine(svg); Assert.That(svg, Does.Match("^M 0 100 C 0 33.33333333333 16.66666666667 0 50 0 L 100 100$")); }
public void EndWithCurve() { var points = new[] { CurvePointUtils.LinePoint(0, 100), CurvePointUtils.LinePoint(50, 0), CurvePointUtils.CurvePoint(new [] { 100.0, 100, 100, 200, 100, 0 }) }; var curve = new SketchPath(points, false); var svg = SketchCurvePointsToSvg.ToSvgString(curve); Console.WriteLine(svg); Assert.That(svg, Does.Match("M 0 100 L 50 0 C 83.33333333333 0 100 33.33333333333 100 100$")); }
public void CurveFromFirstPoint() { var points = new[] { CurvePointUtils.CurvePoint(new[] { 0.0, 0.0 }, new[] { 123.20975114271207, 8.196425347535656 }, new[] { -123.20975114271207, -8.1964253475356769 }), CurvePointUtils.LinePoint(94.613074518933793, 99) }; var curve = new SketchPath(points, false); var svg = SketchCurvePointsToSvg.ToSvgString(curve); Console.WriteLine(svg); Assert.That(svg, Does.Match("^M 0 0 C 82.13983409514 5.464283565024 113.6775256015 38.46428356502 94.61307451893 99$")); }