iPhone: Converting C# code to Objective-C -
Can you help me convert this C # code to Objective-C? I do not have any clue about C # / Visual Studio! Public Static Class BezierSpline {Public Static Zero GetCurveControlPoints (point [] knots, outside point [] firstControlPoints, point out [secondControlPoints] {Int n = knots.Length - 1; // Calculate the first Bizzier Control Point / Double Right Vector on Right Hand [] rhs = New Double [N]; // Set the right hand side for x values (int i = 1; i & lt; n - 1; ++ i) rhs [i] = 4 * sea meat [i] .x + 2 * sea meat [ I + 1] .x; Rhs [0] = sea meat [0]. X + 2 * sea meal [1] .x; Rhs [n - 1] = (8 * knots [N -1] .x + knots [n] .x) / 2.0; // Get the first control digit X-value double [] x = GetFirstControlPoints (rhs); // Set the Right Hands for Y values (INT I = 1; i & lt; n - 1; ++ i) rhs [i] = 4 * sea meal [i] .Y + 2 * I + 1] .Y; Rhs [0] = sea meat [0]. Y + 2 * sea meal [1]. why; Rhs [n - 1] = (8 * knots [N -1]. Y + knots [n] .Y) / 2.0; // Get the first control points Y-value double [] y = GetFirstControlPoints (rhs); // Fill out the output array FirstControlPoints = New point [N]; SecondControlPoints = New point [N]; {// first control point for the first i = 0; i & lt; n; ++ i) controller points [i] = new point (x [ii], y [ii]); // Second control point if (i & lt; n - 1) second control point [i] = new point (2 * sea meat [i + 1] .x - x [i + 1], 2 * sea meat [i + 1] .Y - Y [I + 1]); Second second control point [i] = new point ((knots [n] x + x [n -1]) / 2, (nautical mi [n] y + y [n -1]) / 2); }} Private Static Double [] GetFirstControlPoints (double [] rhs) {int n = rhs.Length; Double [] x = new double [n]; // Solution Vector Double [TMP = New Double [N]; // temp workspace double b = 2.0; X [0] = RAS [0] / b; // Decomposition and Forwarding Replacement for (Int i = 1; I & lt; n; i ++) {TMP [I] = 1 / B; B = (I and LT; N - 1? 4.0: 3.5) - TMP [I]; X [I] = (RHS [I] - X [I-1]) / B; } (Int i = 1; i & lt; n; i ++) x [n - I - 1] - = tmp [n - i] * x [n - ii]; // Backsubstitution return x; }}
Thanks.
double [] tmp = new double [n];
The TMP length is an array of N. Each value is not explicitly started, but it is set to the default value of double type, which is 0, which is 0. Therefore, TMP is an N-length array of zero {0,0,0,0,0,0, ... 0}
Comments
Post a Comment