private void Test2() { foreach (ArcData d in ArcTestData) { ArcInterpolation arc = new ArcInterpolation(d.Start, d.End, d.Radius, false); } }
private static void ArcMove(float x, float y, float z, float i, float j, float k, float radius, bool clockwise) { // Only XY plane supported for now. CPointF start = new CPointF(mDev.mCurrentX, mDev.mCurrentY), end; ArcInterpolation arc = null; if (radius == float.MinValue) { // Center format arc. if (i == float.MinValue && j == float.MinValue) { Error("G2/3: I and J are missing"); } if (i == float.MinValue) { i = 0; } if (j == float.MinValue) { j = 0; } if (x == float.MinValue) { x = mDev.mCurrentX; } if (y == float.MinValue) { y = mDev.mCurrentY; } if (z == float.MinValue) { z = mDev.mCurrentZ; } CPointF center = new CPointF(mDev.mCurrentX + i, mDev.mCurrentY + j); end = new CPointF(x, y); arc = new ArcInterpolation(start, center, end, clockwise); } else { // Radius format arc // XYZ are the endpoint. R is the radius. if (x == float.MinValue && y == float.MinValue) { Error("G2/3: X and Y are missing"); } if (x == float.MinValue) { x = mDev.mCurrentX; } if (y == float.MinValue) { y = mDev.mCurrentY; } if (mDistanceMode == DistanceMode.Absolute) { end = new CPointF(x, y); } else { end = new CPointF(mDev.mCurrentX + x, mDev.mCurrentY + y); } arc = new ArcInterpolation(start, end, radius, clockwise); } if (arc == null) { Error("G2/3: could not find an arc solution"); } for (float t = ArcStep; t <= 1.0 + (ArcStep / 2); t += ArcStep) { CPointF target = arc.GetArcPoint(t); // Only XY supported mDev.MoveAbsoluteLinear(target.X, target.Y, mDev.mCurrentZ); } }