|
@@ -1360,6 +1360,7 @@ namespace SketchAssistant
|
|
|
double sin = Math.Sin(thetha / 180 * Math.PI);
|
|
|
double targetXTransformed = cos * nextPositionXRelative - sin * nextPositionYRelative;
|
|
|
double targetYTransformed = sin * nextPositionXRelative + cos * nextPositionYRelative;
|
|
|
+ Console.WriteLine("distance between start and end point: " + (Math.Sqrt(nextPositionXRelative * nextPositionXRelative + nextPositionYRelative * nextPositionYRelative)) + " (old)," + Math.Sqrt(targetXTransformed * targetXTransformed + targetYTransformed * targetYTransformed) + " (new)");
|
|
|
(double[], double[]) values = sampleEllipticArcBiasedNoRotation(rx, ry, targetXTransformed, targetYTransformed, largeArcFlag, sweepFlag);
|
|
|
List<Point> result = new List<Point>();
|
|
|
for (int j = 0; j < values.Item1.Length; j++)
|
|
@@ -1370,7 +1371,8 @@ namespace SketchAssistant
|
|
|
double yCoordinateAbsolute = lastPositionY + yCoordinateRelative;
|
|
|
result.Add(ScaleAndCreatePoint(xCoordinateAbsolute, yCoordinateAbsolute));
|
|
|
}
|
|
|
- result.Add(ScaleAndCreatePoint(lastPositionX + nextPositionXRelative, lastPositionY + nextPositionYRelative));
|
|
|
+ Console.WriteLine("last point relative coordinates: (" + nextPositionXRelative + ";" + nextPositionYRelative + ") - (" + (cos * values.Item1[values.Item1.Length - 1] + sin * values.Item2[values.Item1.Length - 1]) + ";" + (cos * values.Item2[values.Item1.Length - 1] - sin * values.Item1[values.Item1.Length - 1]) + ")");
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -1379,15 +1381,15 @@ namespace SketchAssistant
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
- private (double[], double[]) sampleEllipticArcBiasedNoRotation(double rx, double ry, double nextPositionXRelative, double nextPositionYRelative, bool largeArcFlag, bool sweepFlag)
|
|
|
+ private (double[], double[]) sampleEllipticArcBiasedNoRotation(double rx, double ry, double targetXTransformed, double targetYTransformed, bool largeArcFlag, bool sweepFlag)
|
|
|
{
|
|
|
double xStretchFactor = rx / ry;
|
|
|
- (double[], double[]) values = sampleCircleArcBiasedNoRotation(ry, nextPositionXRelative, nextPositionYRelative, largeArcFlag, sweepFlag);
|
|
|
+ (double[], double[]) values = sampleCircleArcBiasedNoRotation(ry, targetXTransformed / xStretchFactor, targetYTransformed, largeArcFlag, sweepFlag);
|
|
|
for (int j = 0; j < values.Item1.Length; j++)
|
|
|
{
|
|
|
values.Item1[j] = values.Item1[j] * xStretchFactor;
|
|
@@ -1413,10 +1415,10 @@ namespace SketchAssistant
|
|
|
double x3 = (nextPositionXRelative) / 2;
|
|
|
double y3 = (nextPositionYRelative) / 2;
|
|
|
|
|
|
- Console.WriteLine("radsq: " + radsq);
|
|
|
- Console.WriteLine("q: " + q);
|
|
|
- Console.WriteLine("x3: " + x3);
|
|
|
- Console.WriteLine("y3: " + y3);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
bool xPlusFlag;
|
|
|
bool yPlusFlag;
|
|
@@ -1450,10 +1452,10 @@ namespace SketchAssistant
|
|
|
if (yPlusFlag) yC = y3 + Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((nextPositionXRelative) / q);
|
|
|
else yC = y3 - Math.Sqrt(radsq - ((q / 2) * (q / 2))) * ((nextPositionXRelative) / q);
|
|
|
|
|
|
- Console.WriteLine("radsq - ((q / 2) * (q / 2))): " + (radsq - ((q / 2) * (q / 2))));
|
|
|
- Console.WriteLine("Math.Sqrt(radsq - ((q / 2) * (q / 2))): " + Math.Sqrt(radsq - ((q / 2) * (q / 2))));
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- Console.WriteLine("computed center of circle (relative): point1= (0,0), point2= (" + nextPositionXRelative + "," + nextPositionYRelative + "), center= (" + xC + "," + yC + ")");
|
|
|
+
|
|
|
|
|
|
(double[], double[]) values = sampleCircleArcBiasedAroundCenter(-xC, -yC, nextPositionXRelative - xC, nextPositionYRelative - yC, r, largeArcFlag, sweepFlag);
|
|
|
for (int j = 0; j < values.Item1.Length; j++)
|
|
@@ -1495,19 +1497,19 @@ namespace SketchAssistant
|
|
|
double[] xValues = new double[numberOfPoints];
|
|
|
double[] yValues = new double[numberOfPoints];
|
|
|
double phiCurrent = phiStart;
|
|
|
- Console.WriteLine("sampling circular arc around origin: from " + phiStart + " until " + phiEnd + ":");
|
|
|
- Console.WriteLine("parsed start Point: (" + xStartPoint + "," + yStartPoint + ")");
|
|
|
+
|
|
|
+
|
|
|
for (int j = 0; j < numberOfPoints-1; j++)
|
|
|
{
|
|
|
if (clockwise) phiCurrent -= angle;
|
|
|
else phiCurrent += angle;
|
|
|
yValues[j] = Math.Sin(phiCurrent) * r;
|
|
|
xValues[j] = Math.Cos(phiCurrent) * r;
|
|
|
- Console.WriteLine("parsed Point: (" + xValues[j] + "," + yValues[j] + ")");
|
|
|
+
|
|
|
}
|
|
|
xValues[numberOfPoints - 1] = xFinalPoint;
|
|
|
yValues[numberOfPoints - 1] = yFinalPoint;
|
|
|
- Console.WriteLine("parsed final Point: (" + xValues[numberOfPoints - 1] + "," + yValues[numberOfPoints - 1] + ")");
|
|
|
+
|
|
|
|
|
|
return (xValues, yValues);
|
|
|
}
|