001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.harmony.awt.geom;
018:
019: import org.apache.harmony.awt.gl.Crossing;
020:
021: public class GeometryUtil {
022: public static final double EPSILON = Math.pow(10, -14);
023:
024: public static int intersectLinesWithParams(double x1, double y1,
025: double x2, double y2, double x3, double y3, double x4,
026: double y4, double[] params) {
027: double dx = x4 - x3;
028: double dy = y4 - y3;
029: double d = dx * (y2 - y1) - dy * (x2 - x1);
030: // double comparison
031: if (Math.abs(d) < EPSILON) {
032: return 0;
033: }
034:
035: params[0] = (-dx * (y1 - y3) + dy * (x1 - x3)) / d;
036:
037: if (dx != 0) {
038: params[1] = (line(params[0], x1, x2) - x3) / dx;
039: } else if (dy != 0) {
040: params[1] = (line(params[0], y1, y2) - y3) / dy;
041: } else {
042: params[1] = 0.0;
043: }
044:
045: if (params[0] >= 0 && params[0] <= 1 && params[1] >= 0
046: && params[1] <= 1) {
047: return 1;
048: }
049:
050: return 0;
051: }
052:
053: /**
054: * The method checks up if line (x1, y1) - (x2, y2) and line (x3, y3) - (x4, y4)
055: * intersect. If lines intersect then the result parameters are saved to point
056: * array. The size of array point must be at least 2.
057: * @returns the method returns 1 if two lines intersect in the defined interval,
058: * otherwise 0
059: */
060: public static int intersectLines(double x1, double y1, double x2,
061: double y2, double x3, double y3, double x4, double y4,
062: double[] point) {
063: double A1 = -(y2 - y1);
064: double B1 = (x2 - x1);
065: double C1 = x1 * y2 - x2 * y1;
066: double A2 = -(y4 - y3);
067: double B2 = (x4 - x3);
068: double C2 = x3 * y4 - x4 * y3;
069: double coefParallel = A1 * B2 - A2 * B1;
070: // double comparison
071: if (x3 == x4 && y3 == y4 && (A1 * x3 + B1 * y3 + C1 == 0)
072: && (x3 >= Math.min(x1, x2)) && (x3 <= Math.max(x1, x2))
073: && (y3 >= Math.min(y1, y2)) && (y3 <= Math.max(y1, y2))) {
074: return 1;
075: }
076: if (Math.abs(coefParallel) < EPSILON) {
077: return 0;
078: }
079: point[0] = (B1 * C2 - B2 * C1) / coefParallel;
080: point[1] = (A2 * C1 - A1 * C2) / coefParallel;
081: if (point[0] >= Math.min(x1, x2)
082: && point[0] >= Math.min(x3, x4)
083: && point[0] <= Math.max(x1, x2)
084: && point[0] <= Math.max(x3, x4)
085: && point[1] >= Math.min(y1, y2)
086: && point[1] >= Math.min(y3, y4)
087: && point[1] <= Math.max(y1, y2)
088: && point[1] <= Math.max(y3, y4)) {
089: return 1;
090: }
091: return 0;
092: }
093:
094: /**
095: * It checks up if there is intersection of the line (x1, y1) - (x2, y2) and
096: * the quad curve (qx1, qy1) - (qx2, qy2) - (qx3, qy3). The parameters of the intersection
097: * area saved to params array. Therefore the params size must be at learst 4.
098: * @return The method returns the quantity of roots lied in the defined interval
099: */
100: public static int intersectLineAndQuad(double x1, double y1,
101: double x2, double y2, double qx1, double qy1, double qx2,
102: double qy2, double qx3, double qy3, double[] params) {
103: double[] eqn = new double[3];
104: double[] t = new double[2];
105: double[] s = new double[2];
106: double dy = y2 - y1;
107: double dx = x2 - x1;
108: int quantity = 0;
109: int count = 0;
110:
111: eqn[0] = dy * (qx1 - x1) - dx * (qy1 - y1);
112: eqn[1] = 2 * dy * (qx2 - qx1) - 2 * dx * (qy2 - qy1);
113: eqn[2] = dy * (qx1 - 2 * qx2 + qx3) - dx
114: * (qy1 - 2 * qy2 + qy3);
115:
116: if ((count = Crossing.solveQuad(eqn, t)) == 0) {
117: return 0;
118: }
119:
120: for (int i = 0; i < count; i++) {
121: if (dx != 0) {
122: s[i] = (quad(t[i], qx1, qx2, qx3) - x1) / dx;
123: } else if (dy != 0) {
124: s[i] = (quad(t[i], qy1, qy2, qy3) - y1) / dy;
125: } else {
126: s[i] = 0.0;
127: }
128: if (t[i] >= 0 && t[i] <= 1 && s[i] >= 0 && s[i] <= 1) {
129: params[2 * quantity] = t[i];
130: params[2 * quantity + 1] = s[i];
131: ++quantity;
132: }
133: }
134:
135: return quantity;
136: }
137:
138: /**
139: * It checks up if the line (x1, y1) - (x2, y2) and
140: * the cubic curve (cx1, cy1) - (cx2, cy2) - (cx3, cy3) - (cx4, cy4).
141: * The points of the intersection is saved to points array.
142: * Therefore the points size must be at learst 6.
143: * @return The method returns the quantity of roots lied in the defined interval
144: */
145: public static int intersectLineAndCubic(double x1, double y1,
146: double x2, double y2, double cx1, double cy1, double cx2,
147: double cy2, double cx3, double cy3, double cx4, double cy4,
148: double[] params) {
149: double[] eqn = new double[4];
150: double[] t = new double[3];
151: double[] s = new double[3];
152: double dy = y2 - y1;
153: double dx = x2 - x1;
154: int quantity = 0;
155: int count = 0;
156:
157: eqn[0] = (cy1 - y1) * dx + (x1 - cx1) * dy;
158: eqn[1] = -3 * (cy1 - cy2) * dx + 3 * (cx1 - cx2) * dy;
159: eqn[2] = (3 * cy1 - 6 * cy2 + 3 * cy3) * dx
160: - (3 * cx1 - 6 * cx2 + 3 * cx3) * dy;
161: eqn[3] = (-3 * cy1 + 3 * cy2 - 3 * cy3 + cy4) * dx
162: + (3 * cx1 - 3 * cx2 + 3 * cx3 - cx4) * dy;
163:
164: if ((count = Crossing.solveCubic(eqn, t)) == 0) {
165: return 0;
166: }
167:
168: for (int i = 0; i < count; i++) {
169: if (dx != 0) {
170: s[i] = (cubic(t[i], cx1, cx2, cx3, cx4) - x1) / dx;
171: } else if (dy != 0) {
172: s[i] = (cubic(t[i], cy1, cy2, cy3, cy4) - y1) / dy;
173: } else {
174: s[i] = 0.0;
175: }
176: if (t[i] >= 0 && t[i] <= 1 && s[i] >= 0 && s[i] <= 1) {
177: params[2 * quantity] = t[i];
178: params[2 * quantity + 1] = s[i];
179: ++quantity;
180: }
181: }
182:
183: return quantity;
184: }
185:
186: /**
187: * The method checks up if two quads (x1, y1) - (x2, y2) - (x3, y3) and
188: * (qx1, qy1) - (qx2, qy2) - (qx3, qy3) intersect. The result is saved to
189: * point array. Size of points should be at learst 4.
190: * @return the method returns the quantity of roots lied in the interval
191: */
192: public static int intersectQuads(double x1, double y1, double x2,
193: double y2, double x3, double y3, double qx1, double qy1,
194: double qx2, double qy2, double qx3, double qy3,
195: double[] params) {
196:
197: double[] initParams = new double[2];
198: double[] xCoefs1 = new double[3];
199: double[] yCoefs1 = new double[3];
200: double[] xCoefs2 = new double[3];
201: double[] yCoefs2 = new double[3];
202: int quantity = 0;
203:
204: xCoefs1[0] = x1 - 2 * x2 + x3;
205: xCoefs1[1] = -2 * x1 + 2 * x2;
206: xCoefs1[2] = x1;
207:
208: yCoefs1[0] = y1 - 2 * y2 + y3;
209: yCoefs1[1] = -2 * y1 + 2 * y2;
210: yCoefs1[2] = y1;
211:
212: xCoefs2[0] = qx1 - 2 * qx2 + qx3;
213: xCoefs2[1] = -2 * qx1 + 2 * qx2;
214: xCoefs2[2] = qx1;
215:
216: yCoefs2[0] = qy1 - 2 * qy2 + qy3;
217: yCoefs2[1] = -2 * qy1 + 2 * qy2;
218: yCoefs2[2] = qy1;
219:
220: // initialize params[0] and params[1]
221: params[0] = params[1] = 0.25;
222: quadNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, initParams);
223: if (initParams[0] <= 1 && initParams[0] >= 0
224: && initParams[1] >= 0 && initParams[1] <= 1) {
225: params[2 * quantity] = initParams[0];
226: params[2 * quantity + 1] = initParams[1];
227: ++quantity;
228: }
229: // initialize params
230: params[0] = params[1] = 0.75;
231: quadNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, params);
232: if (initParams[0] <= 1 && initParams[0] >= 0
233: && initParams[1] >= 0 && initParams[1] <= 1) {
234: params[2 * quantity] = initParams[0];
235: params[2 * quantity + 1] = initParams[1];
236: ++quantity;
237: }
238:
239: return quantity;
240: }
241:
242: /**
243: * It checks up if the quad (x1, y1) - (x2, y2) - (x3, y3) and
244: * the cubic (cx1, cy1) - (cx2, cy2) - (cx3, cy3) - (cx4, cy4) curves intersect.
245: * The points of the intersection is saved to points array.
246: * The points size should be at learst 6.
247: * @return The method returns the quantity of the intersection points
248: * lied in the interval.
249: */
250: public static int intersectQuadAndCubic(double qx1, double qy1,
251: double qx2, double qy2, double qx3, double qy3, double cx1,
252: double cy1, double cx2, double cy2, double cx3, double cy3,
253: double cx4, double cy4, double[] params) {
254: int quantity = 0;
255: double[] initParams = new double[3];
256: double[] xCoefs1 = new double[3];
257: double[] yCoefs1 = new double[3];
258: double[] xCoefs2 = new double[4];
259: double[] yCoefs2 = new double[4];
260: xCoefs1[0] = qx1 - 2 * qx2 + qx3;
261: xCoefs1[1] = 2 * qx2 - 2 * qx1;
262: xCoefs1[2] = qx1;
263:
264: yCoefs1[0] = qy1 - 2 * qy2 + qy3;
265: yCoefs1[1] = 2 * qy2 - 2 * qy1;
266: yCoefs1[2] = qy1;
267:
268: xCoefs2[0] = -cx1 + 3 * cx2 - 3 * cx3 + cx4;
269: xCoefs2[1] = 3 * cx1 - 6 * cx2 + 3 * cx3;
270: xCoefs2[2] = -3 * cx1 + 3 * cx2;
271: xCoefs2[3] = cx1;
272:
273: yCoefs2[0] = -cy1 + 3 * cy2 - 3 * cy3 + cy4;
274: yCoefs2[1] = 3 * cy1 - 6 * cy2 + 3 * cy3;
275: yCoefs2[2] = -3 * cy1 + 3 * cy2;
276: yCoefs2[3] = cy1;
277:
278: // initialize params[0] and params[1]
279: params[0] = params[1] = 0.25;
280: quadAndCubicNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2,
281: initParams);
282: if (initParams[0] <= 1 && initParams[0] >= 0
283: && initParams[1] >= 0 && initParams[1] <= 1) {
284: params[2 * quantity] = initParams[0];
285: params[2 * quantity + 1] = initParams[1];
286: ++quantity;
287: }
288: // initialize params
289: params[0] = params[1] = 0.5;
290: quadAndCubicNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, params);
291: if (initParams[0] <= 1 && initParams[0] >= 0
292: && initParams[1] >= 0 && initParams[1] <= 1) {
293: params[2 * quantity] = initParams[0];
294: params[2 * quantity + 1] = initParams[1];
295: ++quantity;
296: }
297:
298: params[0] = params[1] = 0.75;
299: quadAndCubicNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, params);
300: if (initParams[0] <= 1 && initParams[0] >= 0
301: && initParams[1] >= 0 && initParams[1] <= 1) {
302: params[2 * quantity] = initParams[0];
303: params[2 * quantity + 1] = initParams[1];
304: ++quantity;
305: }
306: return quantity;
307: }
308:
309: /**
310: * The method checks up if two cubic curves (x1, y1) - (x2, y2) - (x3, y3) - (x4, y4)
311: * and (cx1, cy1) - (cx2, cy2) - (cx3, cy3) - (cx4, cy4) intersect. The result is saved to
312: * point array. Size of points should be at learst 6.
313: * @return the method returns the quantity of the intersection points lied in the interval
314: */
315: public static int intersectCubics(double x1, double y1, double x2,
316: double y2, double x3, double y3, double x4, double y4,
317: double cx1, double cy1, double cx2, double cy2, double cx3,
318: double cy3, double cx4, double cy4, double[] params) {
319:
320: int quantity = 0;
321: double[] initParams = new double[3];
322: double[] xCoefs1 = new double[4];
323: double[] yCoefs1 = new double[4];
324: double[] xCoefs2 = new double[4];
325: double[] yCoefs2 = new double[4];
326: xCoefs1[0] = -x1 + 3 * x2 - 3 * x3 + x4;
327: xCoefs1[1] = 3 * x1 - 6 * x2 + 3 * x3;
328: xCoefs1[2] = -3 * x1 + 3 * x2;
329: xCoefs1[3] = x1;
330:
331: yCoefs1[0] = -y1 + 3 * y2 - 3 * y3 + y4;
332: yCoefs1[1] = 3 * y1 - 6 * y2 + 3 * y3;
333: yCoefs1[2] = -3 * y1 + 3 * y2;
334: yCoefs1[3] = y1;
335:
336: xCoefs2[0] = -cx1 + 3 * cx2 - 3 * cx3 + cx4;
337: xCoefs2[1] = 3 * cx1 - 6 * cx2 + 3 * cx3;
338: xCoefs2[2] = -3 * cx1 + 3 * cx2;
339: xCoefs2[3] = cx1;
340:
341: yCoefs2[0] = -cy1 + 3 * cy2 - 3 * cy3 + cy4;
342: yCoefs2[1] = 3 * cy1 - 6 * cy2 + 3 * cy3;
343: yCoefs2[2] = -3 * cy1 + 3 * cy2;
344: yCoefs2[3] = cy1;
345:
346: // TODO
347: params[0] = params[1] = 0.25;
348: cubicNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, initParams);
349: if (initParams[0] <= 1 && initParams[0] >= 0
350: && initParams[1] >= 0 && initParams[1] <= 1) {
351: params[2 * quantity] = initParams[0];
352: params[2 * quantity + 1] = initParams[1];
353: ++quantity;
354: }
355:
356: params[0] = params[1] = 0.5;
357: cubicNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, params);
358: if (initParams[0] <= 1 && initParams[0] >= 0
359: && initParams[1] >= 0 && initParams[1] <= 1) {
360: params[2 * quantity] = initParams[0];
361: params[2 * quantity + 1] = initParams[1];
362: ++quantity;
363: }
364:
365: params[0] = params[1] = 0.75;
366: cubicNewton(xCoefs1, yCoefs1, xCoefs2, yCoefs2, params);
367: if (initParams[0] <= 1 && initParams[0] >= 0
368: && initParams[1] >= 0 && initParams[1] <= 1) {
369: params[2 * quantity] = initParams[0];
370: params[2 * quantity + 1] = initParams[1];
371: ++quantity;
372: }
373: return quantity;
374: }
375:
376: public static double line(double t, double x1, double x2) {
377: return x1 * (1.0 - t) + x2 * t;
378: }
379:
380: public static double quad(double t, double x1, double x2, double x3) {
381: return x1 * (1.0 - t) * (1.0 - t) + 2.0 * x2 * t * (1.0 - t)
382: + x3 * t * t;
383: }
384:
385: public static double cubic(double t, double x1, double x2,
386: double x3, double x4) {
387: return x1 * (1.0 - t) * (1.0 - t) * (1.0 - t) + 3.0 * x2
388: * (1.0 - t) * (1.0 - t) * t + 3.0 * x3 * (1.0 - t) * t
389: * t + x4 * t * t * t;
390: }
391:
392: // x, y - the coordinates of new vertex
393: // t0 - ?
394: public static void subQuad(double coef[], double t0, boolean left) {
395: if (left) {
396: coef[2] = (1 - t0) * coef[0] + t0 * coef[2];
397: coef[3] = (1 - t0) * coef[1] + t0 * coef[3];
398: } else {
399: coef[2] = (1 - t0) * coef[2] + t0 * coef[4];
400: coef[3] = (1 - t0) * coef[3] + t0 * coef[5];
401: }
402: }
403:
404: public static void subCubic(double coef[], double t0, boolean left) {
405: if (left) {
406: coef[2] = (1 - t0) * coef[0] + t0 * coef[2];
407: coef[3] = (1 - t0) * coef[1] + t0 * coef[3];
408: } else {
409: coef[4] = (1 - t0) * coef[4] + t0 * coef[6];
410: coef[5] = (1 - t0) * coef[5] + t0 * coef[7];
411: }
412: }
413:
414: private static void cubicNewton(double xCoefs1[], double yCoefs1[],
415: double xCoefs2[], double yCoefs2[], double[] params) {
416: double t = 0.0, s = 0.0;
417: double t1 = params[0];
418: double s1 = params[1];
419: double d, dt, ds;
420:
421: while (Math.sqrt((t - t1) * (t - t1) + (s - s1) * (s - s1)) > EPSILON) {
422: d = -(3 * t * t * xCoefs1[0] + 2 * t * xCoefs1[1] + xCoefs1[2])
423: * (3 * s * s * yCoefs2[0] + 2 * s * yCoefs2[1] + yCoefs2[2])
424: + (3 * t * t * yCoefs1[0] + 2 * t * yCoefs1[1] + yCoefs1[2])
425: * (3 * s * s * xCoefs2[0] + 2 * s * xCoefs2[1] + xCoefs2[2]);
426:
427: dt = (t * t * t * xCoefs1[0] + t * t * xCoefs1[1] + t
428: * xCoefs1[2] + xCoefs1[3] - s * s * s * xCoefs2[0]
429: - s * s * xCoefs2[1] - s * xCoefs2[2] - xCoefs2[3])
430: * (-3 * s * s * yCoefs2[0] - 2 * s * yCoefs2[1] - yCoefs2[2])
431: + (t * t * t * yCoefs1[0] + t * t * yCoefs1[1] + t
432: * yCoefs1[2] + yCoefs1[3] - s * s * s
433: * yCoefs2[0] - s * s * yCoefs2[1] - s
434: * yCoefs2[2] - yCoefs2[3])
435: * (3 * s * s * xCoefs2[0] + 2 * s * xCoefs2[1] + xCoefs2[2]);
436:
437: ds = (3 * t * t * xCoefs1[0] + 2 * t * xCoefs1[1] + xCoefs1[2])
438: * (t * t * t * yCoefs1[0] + t * t * yCoefs1[1] + t
439: * yCoefs1[2] + yCoefs1[3] - s * s * s
440: * yCoefs2[0] - s * s * yCoefs2[1] - s
441: * yCoefs2[2] - yCoefs2[3])
442: - (3 * t * t * yCoefs1[0] + 2 * t * yCoefs1[1] + yCoefs1[2])
443: * (t * t * t * xCoefs1[0] + t * t * xCoefs1[1] + t
444: * xCoefs1[2] + xCoefs1[3] - s * s * s
445: * xCoefs2[0] - s * s * xCoefs2[1] - s
446: * xCoefs2[2] - xCoefs2[3]);
447:
448: t1 = t - dt / d;
449: s1 = s - ds / d;
450: }
451: params[0] = t1;
452: params[1] = s1;
453: }
454:
455: private static void quadAndCubicNewton(double xCoefs1[],
456: double yCoefs1[], double xCoefs2[], double yCoefs2[],
457: double[] params) {
458: double t = 0.0, s = 0.0;
459: double t1 = params[0];
460: double s1 = params[1];
461: double d, dt, ds;
462:
463: while (Math.sqrt((t - t1) * (t - t1) + (s - s1) * (s - s1)) > EPSILON) {
464: d = -(2 * t * xCoefs1[0] + xCoefs1[1])
465: * (3 * s * s * yCoefs2[0] + 2 * s * yCoefs2[1] + yCoefs2[2])
466: + (2 * t * yCoefs1[0] + yCoefs1[1])
467: * (3 * s * s * xCoefs2[0] + 2 * s * xCoefs2[1] + xCoefs2[2]);
468:
469: dt = (t * t * xCoefs1[0] + t * xCoefs1[1] + xCoefs1[2] + -s
470: * s * s * xCoefs2[0] - s * s * xCoefs2[1] - s
471: * xCoefs2[2] - xCoefs2[3])
472: * (-3 * s * s * yCoefs2[0] - 2 * s * yCoefs2[1] - yCoefs2[2])
473: + (t * t * yCoefs1[0] + t * yCoefs1[1] + yCoefs1[2]
474: - s * s * s * yCoefs2[0] - s * s
475: * yCoefs2[1] - s * yCoefs2[2] - yCoefs2[3])
476: * (3 * s * s * xCoefs2[0] + 2 * s * xCoefs2[1] + xCoefs2[2]);
477:
478: ds = (2 * t * xCoefs1[0] + xCoefs1[1])
479: * (t * t * yCoefs1[0] + t * yCoefs1[1] + yCoefs1[2]
480: - s * s * s * yCoefs2[0] - s * s
481: * yCoefs2[1] - s * yCoefs2[2] - yCoefs2[3])
482: - (2 * t * yCoefs1[0] + yCoefs1[1])
483: * (t * t * xCoefs1[0] + t * xCoefs1[1] + xCoefs1[2]
484: - s * s * s * xCoefs2[0] - s * s
485: * xCoefs2[1] - s * xCoefs2[2] - xCoefs2[3]);
486:
487: t1 = t - dt / d;
488: s1 = s - ds / d;
489: }
490: params[0] = t1;
491: params[1] = s1;
492: }
493:
494: private static void quadNewton(double xCoefs1[], double yCoefs1[],
495: double xCoefs2[], double yCoefs2[], double params[]) {
496: double t = 0.0, s = 0.0;
497: double t1 = params[0];
498: double s1 = params[1];
499: double d, dt, ds;
500:
501: while (Math.sqrt((t - t1) * (t - t1) + (s - s1) * (s - s1)) > EPSILON) {
502: t = t1;
503: s = s1;
504: d = -(2 * t * xCoefs1[0] + xCoefs1[1])
505: * (2 * s * yCoefs2[0] + yCoefs2[1])
506: + (2 * s * xCoefs2[0] + xCoefs2[1])
507: * (2 * t * yCoefs1[0] + yCoefs1[1]);
508:
509: dt = -(t * t * xCoefs1[0] + t * xCoefs1[1] + xCoefs1[1] - s
510: * s * xCoefs2[0] - s * xCoefs2[1] - xCoefs2[2])
511: * (2 * s * yCoefs2[0] + yCoefs2[1])
512: + (2 * s * xCoefs2[0] + xCoefs2[1])
513: * (t * t * yCoefs1[0] + t * yCoefs1[1] + yCoefs1[2]
514: - s * s * yCoefs2[0] - s * yCoefs2[1] - yCoefs2[2]);
515:
516: ds = (2 * t * xCoefs1[0] + xCoefs1[1])
517: * (t * t * yCoefs1[0] + t * yCoefs1[1] + yCoefs1[2]
518: - s * s * yCoefs2[0] - s * yCoefs2[1] - yCoefs2[2])
519: - (2 * t * yCoefs1[0] + yCoefs1[1])
520: * (t * t * xCoefs1[0] + t * xCoefs1[1] + xCoefs1[2]
521: - s * s * xCoefs2[0] - s * xCoefs2[1] - xCoefs2[2]);
522:
523: t1 = t - dt / d;
524: s1 = s - ds / d;
525: }
526: params[0] = t1;
527: params[1] = s1;
528: }
529:
530: }
|