Debian Codegraph @

src/gen/lib/pathplan/route__c.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * Project Info: http://plantuml.com
6 *
7 * If you like this project or if you find it useful, you can support us at:
8 *
9 * http://plantuml.com/patreon (only 1$ per month!)
10 * http://plantuml.com/paypal
11 *
12 * This file is part of Smetana.
13 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
14 *
15 * (C) Copyright 2009-2020, Arnaud Roques
16 *
17 * This translation is distributed under the same Licence as the original C program:
18 *
19 *************************************************************************
20 * Copyright (c) 2011 AT&T Intellectual Property
21 * All rights reserved. This program and the accompanying materials
22 * are made available under the terms of the Eclipse Public License v1.0
23 * which accompanies this distribution, and is available at
24 * http://www.eclipse.org/legal/epl-v10.html
25 *
26 * Contributors: See CVS logs. Details at http://www.graphviz.org/
27 *************************************************************************
28 *
29 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
30 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
31 *
32 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
33 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
34 *
35 * You may obtain a copy of the License at
36 *
37 * http://www.eclipse.org/legal/epl-v10.html
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
44 *
45 */
46 package gen.lib.pathplan;
47 import static gen.lib.pathplan.solvers__c.solve3;
48 import static smetana.core.JUtils.setjmp;
49 import static smetana.core.JUtils.sqrt;
50 import static smetana.core.JUtilsDebug.ENTERING;
51 import static smetana.core.JUtilsDebug.LEAVING;
52 import static smetana.core.Macro.DISTSQ;
53 import static smetana.core.Macro.N;
54 import static smetana.core.Macro.UNSUPPORTED;
55 import h.ST_Pedge_t;
56 import h.ST_Ppoly_t;
57 import h.ST_pointf;
58 import h.ST_tna_t;
59 import smetana.core.Z;
60 import smetana.core.__ptr__;
61 import smetana.core.jmp_buf;
62
63 public class route__c {
64 //1 baedz5i9est5csw3epz3cv7z
65 // typedef Ppoly_t Ppolyline_t
66
67
68 //1 7pb9zum2n4wlgil34lvh8i0ts
69 // typedef double COORD
70
71
72 //1 540u5gu9i0x1wzoxqqx5n2vwp
73 // static jmp_buf jbuf
74 private static jmp_buf jbuf = new jmp_buf();
75
76 //1 3k2f2er3efsrl0210su710vf
77 // static Ppoint_t *ops
78 //static private __ptr__ ops;
79
80 //1 ds2k0zdfzruet3qxk0duytkjx
81 // static int opn, opl
82 //private static int opn;
83 //private static int opl;
84
85
86
87 //3 9stmrdqlmufyk2wutp3totr5j
88 // int Proutespline(Pedge_t * edges, int edgen, Ppolyline_t input, Ppoint_t * evs, Ppolyline_t * output)
89 public static int Proutespline(ST_Pedge_t.Array edges, int edgen, ST_Ppoly_t input, __ptr__ evs, ST_Ppoly_t output) {
90 // WARNING!! STRUCT
91 return Proutespline_w_(edges, edgen, (ST_Ppoly_t) input.copy(), evs, output);
92 }
93 private static int Proutespline_w_(ST_Pedge_t.Array edges, int edgen, final ST_Ppoly_t input, __ptr__ evs, ST_Ppoly_t output) {
94 ENTERING("9stmrdqlmufyk2wutp3totr5j","Proutespline");
95 try {
96 ST_pointf.Array inps;
97 int inpn;
98 /* unpack into previous format rather than modify legacy code */
99 inps = input.ps;
100 inpn = input.pn;
101 if (setjmp(jbuf)!=0)
102 UNSUPPORTED("8d9xfgejx5vgd6shva5wk5k06"); // return -1;
103 /* generate the splines */
104 evs.plus(0).getStruct().___(normv((ST_pointf) evs.plus(0).getStruct()));
105 evs.plus(1).getStruct().___(normv((ST_pointf) evs.plus(1).getStruct()));
106 Z.z().opl = 0;
107 growops(4);
108 Z.z().ops_route.plus(Z.z().opl).setStruct(inps.plus(0).getStruct());
109 Z.z().opl++;
110 if (reallyroutespline(edges, edgen, inps, inpn, (ST_pointf)evs.plus(0).getStruct(), (ST_pointf)evs.plus(1).getStruct()) == -1)
111 return -1;
112 output.setInt("pn", Z.z().opl);
113 output.ps = Z.z().ops_route;
114 return 0;
115 } finally {
116 LEAVING("9stmrdqlmufyk2wutp3totr5j","Proutespline");
117 }
118 }
119
120
121
122
123 //3 13dxqzbgtpl4ubnnvw6ehzzi9
124 // static int reallyroutespline(Pedge_t * edges, int edgen, Ppoint_t * inps, int inpn, Ppoint_t ev0, Ppoint_t ev1)
125 //private static __ptr__ tnas;
126 //private static int tnan;
127 public static int reallyroutespline(ST_Pedge_t.Array edges, int edgen, ST_pointf.Array inps, int inpn, final ST_pointf ev0, final ST_pointf ev1) {
128 // WARNING!! STRUCT
129 return reallyroutespline_w_(edges, edgen, inps, inpn, ev0.copy(), ev1.copy());
130 }
131 private static int reallyroutespline_w_(ST_Pedge_t.Array edges, int edgen, ST_pointf.Array inps, int inpn, final ST_pointf ev0, final ST_pointf ev1) {
132 ENTERING("13dxqzbgtpl4ubnnvw6ehzzi9","reallyroutespline");
133 try {
134 final ST_pointf p1 = new ST_pointf(), p2 = new ST_pointf(), cp1 = new ST_pointf(), cp2 = new ST_pointf(), p = new ST_pointf();
135 final ST_pointf v1 = new ST_pointf(), v2 = new ST_pointf(), splitv = new ST_pointf(), splitv1 = new ST_pointf(), splitv2 = new ST_pointf();
136 double maxd, d, t;
137 int maxi, i, spliti;
138 if (Z.z().tnan < inpn) {
139 if (N(Z.z().tnas)) {
140 if (N(Z.z().tnas = new ST_tna_t.Array(inpn)))
141 return -1;
142 } else {
143 if (N(Z.z().tnas = Z.z().tnas.reallocJ(inpn)))
144 return -1;
145 }
146 Z.z().tnan = inpn;
147 }
148 Z.z().tnas.plus(0).getStruct().setDouble("t", 0);
149 for (i = 1; i < inpn; i++)
150 Z.z().tnas.plus(i).getStruct().setDouble("t", Z.z().tnas.plus(i-1).getStruct().t + dist((ST_pointf)inps.plus(i).getStruct(), (ST_pointf)inps.plus(i-1).getStruct()));
151 for (i = 1; i < inpn; i++)
152 Z.z().tnas.plus(i).getStruct().setDouble("t", Z.z().tnas.plus(i).getStruct().t / Z.z().tnas.plus(inpn - 1).getStruct().t);
153 for (i = 0; i < inpn; i++) {
154 ((ST_tna_t)Z.z().tnas.plus(i).getStruct()).a[0].____(scale(ev0, B1(Z.z().tnas.plus(i).getStruct().t)));
155 ((ST_tna_t)Z.z().tnas.plus(i).getStruct()).a[1].____(scale(ev1, B2(Z.z().tnas.plus(i).getStruct().t)));
156 }
157 if (mkspline(inps, inpn, Z.z().tnas, ev0, ev1, p1, v1, p2, v2) == -1)
158 return -1;
159 if (splinefits(edges, edgen, p1, v1, p2, v2, inps, inpn)!=0)
160 return 0;
161 cp1.___(add(p1, scale(v1, 1 / 3.0)));
162 cp2.___(sub(p2, scale(v2, 1 / 3.0)));
163 for (maxd = -1, maxi = -1, i = 1; i < inpn - 1; i++) {
164 t = Z.z().tnas.get(i).t;
165 p.setDouble("x", B0(t) * p1.x + B1(t) * cp1.x + B2(t) * cp2.x + B3(t) * p2.x);
166 p.setDouble("y", B0(t) * p1.y + B1(t) * cp1.y + B2(t) * cp2.y + B3(t) * p2.y);
167 if ((d = dist(p, (ST_pointf) inps.plus(i).getStruct())) > maxd)
168 {maxd = d; maxi = i;}
169 }
170 spliti = maxi;
171 splitv1.___(normv(sub((ST_pointf)inps.plus(spliti).getStruct(), (ST_pointf)inps.plus(spliti - 1).getStruct())));
172 splitv2.___(normv(sub((ST_pointf)inps.plus(spliti + 1).getStruct(), (ST_pointf)inps.plus(spliti).getStruct())));
173 splitv.___(normv(add(splitv1, splitv2)));
174 reallyroutespline(edges, edgen, inps, spliti + 1, ev0, splitv);
175 reallyroutespline(edges, edgen, inps.plus(spliti), inpn - spliti, splitv,
176 ev1);
177 return 0;
178 } finally {
179 LEAVING("13dxqzbgtpl4ubnnvw6ehzzi9","reallyroutespline");
180 }
181 }
182
183
184
185
186 //3 29sok6jkfyobf83q130snkhmh
187 // static int mkspline(Ppoint_t * inps, int inpn, tna_t * tnas, Ppoint_t ev0, Ppoint_t ev1, Ppoint_t * sp0, Ppoint_t * sv0, Ppoint_t * sp1, Ppoint_t * sv1)
188 public static int mkspline(__ptr__ inps, int inpn, ST_tna_t.Array tnas, final ST_pointf ev0, final ST_pointf ev1, __ptr__ sp0, __ptr__ sv0, __ptr__ sp1, __ptr__ sv1) {
189 // WARNING!! STRUCT
190 return mkspline_w_(inps, inpn, tnas, ev0.copy(), ev1.copy(), sp0, sv0, sp1, sv1);
191 }
192 private static int mkspline_w_(__ptr__ inps, int inpn, ST_tna_t.Array tnas, final ST_pointf ev0, final ST_pointf ev1, __ptr__ sp0, __ptr__ sv0, __ptr__ sp1, __ptr__ sv1) {
193 ENTERING("29sok6jkfyobf83q130snkhmh","mkspline");
194 try {
195 final ST_pointf tmp = new ST_pointf();
196 double c[][] = new double[2][2];
197 double x[] = new double[2];
198 double det01, det0X, detX1;
199 double d01, scale0, scale3;
200 int i;
201 scale0 = scale3 = 0.0;
202 c[0][0] = c[0][1] = c[1][0] = c[1][1] = 0.0;
203 x[0] = x[1] = 0.0;
204 for (i = 0; i < inpn; i++) {
205 c[0][0] += dot(((ST_tna_t)tnas.plus(i).getStruct()).a[0], ((ST_tna_t)tnas.plus(i).getStruct()).a[0]);
206 c[0][1] += dot(((ST_tna_t)tnas.plus(i).getStruct()).a[0], ((ST_tna_t)tnas.plus(i).getStruct()).a[1]);
207 c[1][0] = c[0][1];
208 c[1][1] += dot(((ST_tna_t)tnas.plus(i).getStruct()).a[1], ((ST_tna_t)tnas.plus(i).getStruct()).a[1]);
209 tmp.___(sub((ST_pointf) inps.plus(i).getStruct(), add(scale((ST_pointf) inps.plus(0).getStruct(), B01(tnas.plus(i).getStruct().t)),
210 scale((ST_pointf) inps.plus(inpn - 1).getStruct(), B23(tnas.plus(i).getStruct().t)))));
211 x[0] += dot(((ST_tna_t)tnas.plus(i).getStruct()).a[0], tmp);
212 x[1] += dot(((ST_tna_t)tnas.plus(i).getStruct()).a[1], tmp);
213 }
214 det01 = c[0][0] * c[1][1] - c[1][0] * c[0][1];
215 det0X = c[0][0] * x[1] - c[0][1] * x[0];
216 detX1 = x[0] * c[1][1] - x[1] * c[0][1];
217 if (((det01) >= 0 ? (det01) : -(det01)) >= 1e-6) {
218 scale0 = detX1 / det01;
219 scale3 = det0X / det01;
220 }
221 if (((det01) >= 0 ? (det01) : -(det01)) < 1e-6 || scale0 <= 0.0 || scale3 <= 0.0) {
222 d01 = dist((ST_pointf)inps.plus(0).getStruct(), (ST_pointf)inps.plus(inpn - 1).getStruct()) / 3.0;
223 scale0 = d01;
224 scale3 = d01;
225 }
226 sp0.setStruct(inps.plus(0).getStruct());
227 sv0.setStruct(scale(ev0, scale0));
228 sp1.setStruct(inps.plus(inpn - 1).getStruct());
229 sv1.setStruct(scale(ev1, scale3));
230 return 0;
231 } finally {
232 LEAVING("29sok6jkfyobf83q130snkhmh","mkspline");
233 }
234 }
235
236
237
238
239 //3 ea6jsc0rwfyjtmmuxax6r5ngk
240 // static double dist_n(Ppoint_t * p, int n)
241 public static double dist_n(ST_pointf.Array p, int n) {
242 ENTERING("ea6jsc0rwfyjtmmuxax6r5ngk","dist_n");
243 try {
244 int i;
245 double rv;
246 rv = 0.0;
247 for (i = 1; i < n; i++) {
248 rv +=
249 sqrt((p.plus(i).getStruct().x - p.plus(i - 1).getStruct().x) * (p.plus(i).getStruct().x - p.plus(i - 1).getStruct().x)+
250 (p.plus(i).getStruct().y - p.plus(i - 1).getStruct().y) * (p.plus(i).getStruct().y - p.plus(i - 1).getStruct().y));
251 }
252 return rv;
253 } finally {
254 LEAVING("ea6jsc0rwfyjtmmuxax6r5ngk","dist_n");
255 }
256 }
257
258
259
260
261 //3 987ednrgu5qo9dzhpiox47mhb
262 // static int splinefits(Pedge_t * edges, int edgen, Ppoint_t pa, Pvector_t va, Ppoint_t pb, Pvector_t vb, Ppoint_t * inps, int inpn)
263 public static int splinefits(ST_Pedge_t.Array edges, int edgen, final ST_pointf pa, final ST_pointf va, final ST_pointf pb, final ST_pointf vb, ST_pointf.Array inps, int inpn) {
264 // WARNING!! STRUCT
265 return splinefits_w_(edges, edgen, pa.copy(), va.copy(), pb.copy(), vb.copy(), inps, inpn);
266 }
267 private static int splinefits_w_(ST_Pedge_t.Array edges, int edgen, final ST_pointf pa, final ST_pointf va, final ST_pointf pb, final ST_pointf vb, ST_pointf.Array inps, int inpn) {
268 ENTERING("987ednrgu5qo9dzhpiox47mhb","splinefits");
269 try {
270 final ST_pointf.Array sps = new ST_pointf.Array( 4);
271 double a, b;
272 int pi;
273 int forceflag;
274 int first = 1;
275 forceflag = (inpn == 2 ? 1 : 0);
276 a = b = 4;
277 for (;;) {
278 sps.plus(0).getStruct().setDouble("x", pa.x);
279 sps.plus(0).getStruct().setDouble("y", pa.y);
280 sps.plus(1).getStruct().setDouble("x", pa.x + a * va.x / 3.0);
281 sps.plus(1).getStruct().setDouble("y", pa.y + a * va.y / 3.0);
282 sps.plus(2).getStruct().setDouble("x", pb.x - b * vb.x / 3.0);
283 sps.plus(2).getStruct().setDouble("y", pb.y - b * vb.y / 3.0);
284 sps.plus(3).getStruct().setDouble("x", pb.x);
285 sps.plus(3).getStruct().setDouble("y", pb.y);
286 /* shortcuts (paths shorter than the shortest path) not allowed -
287 * they must be outside the constraint polygon. this can happen
288 * if the candidate spline intersects the constraint polygon exactly
289 * on sides or vertices. maybe this could be more elegant, but
290 * it solves the immediate problem. we could also try jittering the
291 * constraint polygon, or computing the candidate spline more carefully,
292 * for example using the path. SCN */
293 if (first!=0 && (dist_n(sps.asPtr(), 4) < (dist_n(inps, inpn) - 1E-3)))
294 return 0;
295 first = 0;
296 if (splineisinside(edges, edgen, sps)) {
297 growops(Z.z().opl + 4);
298 for (pi = 1; pi < 4; pi++) {
299 Z.z().ops_route.plus(Z.z().opl).setDouble("x", sps.plus(pi).getStruct().x);
300 Z.z().ops_route.plus(Z.z().opl).setDouble("y", sps.plus(pi).getStruct().y);
301 Z.z().opl++;
302 }
303 return 1;
304 }
305 if (a == 0 && b == 0) {
306 if (forceflag!=0) {
307 growops(Z.z().opl + 4);
308 for (pi = 1; pi < 4; pi++)
309 {
310 Z.z().ops_route.plus(Z.z().opl).setDouble("x", sps.plus(pi).getStruct().x);
311 Z.z().ops_route.plus(Z.z().opl).setDouble("y", sps.plus(pi).getStruct().y);
312 Z.z().opl++;
313 }
314 return 1;
315 }
316 break;
317 }
318 if (a > .01)
319 {
320 a /= 2;
321 b /= 2;
322 }
323 else
324 a = b = 0;
325 }
326 return 0;
327 } finally {
328 LEAVING("987ednrgu5qo9dzhpiox47mhb","splinefits");
329 }
330 }
331
332
333
334
335 //3 b6eghkeu16aum3l778ig52ht1
336 // static int splineisinside(Pedge_t * edges, int edgen, Ppoint_t * sps)
337 public static boolean splineisinside(ST_Pedge_t.Array edges, int edgen, ST_pointf.Array sps) {
338 ENTERING("b6eghkeu16aum3l778ig52ht1","splineisinside");
339 try {
340 double roots[] = new double[4];
341 int rooti, rootn;
342 int ei;
343 final ST_pointf.Array lps = new ST_pointf.Array( 2);
344 final ST_pointf ip = new ST_pointf();
345 double t, ta, tb, tc, td;
346 for (ei = 0; ei < edgen; ei++) {
347 lps.plus(0).setStruct(edges.get(ei).a);
348 lps.plus(1).setStruct(edges.get(ei).b);
349 /* if ((rootn = splineintersectsline (sps, lps, roots)) == 4)
350 return 1; */
351 if ((rootn = splineintersectsline(sps, lps, roots)) == 4)
352 continue;
353 for (rooti = 0; rooti < rootn; rooti++) {
354 if (roots[rooti] < 1E-6 || roots[rooti] > 1 - 1E-6)
355 continue;
356 t = roots[rooti];
357 td = t * t * t;
358 tc = 3 * t * t * (1 - t);
359 tb = 3 * t * (1 - t) * (1 - t);
360 ta = (1 - t) * (1 - t) * (1 - t);
361 ip.setDouble("x", ta * sps.get(0).x + tb * sps.get(1).x +
362 tc * sps.get(2).x + td * sps.get(3).x);
363 ip.setDouble("y", ta * sps.get(0).y + tb * sps.get(1).y +
364 tc * sps.get(2).y + td * sps.get(3).y);
365 if (DISTSQ(ip, lps.plus(0).getStruct()) < 1E-3 ||
366 DISTSQ(ip, lps.plus(1).getStruct()) < 1E-3)
367 continue;
368 return false;
369 }
370 }
371 return true;
372 } finally {
373 LEAVING("b6eghkeu16aum3l778ig52ht1","splineisinside");
374 }
375 }
376
377
378
379
380 //3 32nc8itszi77u36la8npt2870
381 // static int splineintersectsline(Ppoint_t * sps, Ppoint_t * lps, double *roots)
382 public static int splineintersectsline(ST_pointf.Array sps, ST_pointf.Array lps, double roots[]) {
383 ENTERING("32nc8itszi77u36la8npt2870","splineintersectsline");
384 try {
385 double scoeff[] = new double[4];
386 double xcoeff[] = new double[2];
387 double ycoeff[] = new double[2];
388 double xroots[] = new double[3];
389 double yroots[] = new double[3];
390 double tv, sv, rat;
391 int rootn[] = new int[]{0};
392 int xrootn, yrootn, i, j;
393 xcoeff[0] = lps.plus(0).getStruct().x;
394 xcoeff[1] = lps.plus(1).getStruct().x - lps.plus(0).getStruct().x;
395 ycoeff[0] = lps.plus(0).getStruct().y;
396 ycoeff[1] = lps.plus(1).getStruct().y - lps.plus(0).getStruct().y;
397 rootn[0] = 0;
398 if (xcoeff[1] == 0) {
399 if (ycoeff[1] == 0) {
400 points2coeff(sps.plus(0).getStruct().x, sps.plus(1).getStruct().x, sps.plus(2).getStruct().x, sps.plus(3).getStruct().x, scoeff);
401 scoeff[0] -= xcoeff[0];
402 xrootn = solve3(scoeff, xroots);
403 points2coeff(sps.plus(0).getStruct().y, sps.plus(1).getStruct().y, sps.plus(2).getStruct().y, sps.plus(3).getStruct().y, scoeff);
404 scoeff[0] -= ycoeff[0];
405 yrootn = solve3(scoeff, yroots);
406 if (xrootn == 4)
407 if (yrootn == 4)
408 return 4;
409 else
410 for (j = 0; j < yrootn; j++)
411 addroot(yroots[j], roots, rootn);
412 else if (yrootn == 4)
413 for (i = 0; i < xrootn; i++)
414 addroot(xroots[i], roots, rootn);
415 else
416 for (i = 0; i < xrootn; i++)
417 for (j = 0; j < yrootn; j++)
418 if (xroots[i] == yroots[j])
419 addroot(xroots[i], roots, rootn);
420 return rootn[0];
421 } else {
422 points2coeff(sps.plus(0).getStruct().x, sps.plus(1).getStruct().x, sps.plus(2).getStruct().x, sps.plus(3).getStruct().x, scoeff);
423 scoeff[0] -= xcoeff[0];
424 xrootn = solve3(scoeff, xroots);
425 if (xrootn == 4)
426 return 4;
427 for (i = 0; i < xrootn; i++) {
428 tv = xroots[i];
429 if (tv >= 0 && tv <= 1) {
430 points2coeff(sps.plus(0).getStruct().y, sps.plus(1).getStruct().y, sps.plus(2).getStruct().y, sps.plus(3).getStruct().y,
431 scoeff);
432 sv = scoeff[0] + tv * (scoeff[1] + tv *
433 (scoeff[2] + tv * scoeff[3]));
434 sv = (sv - ycoeff[0]) / ycoeff[1];
435 if ((0 <= sv) && (sv <= 1))
436 addroot(tv, roots, rootn);
437 }
438 }
439 return rootn[0];
440 }
441 } else {
442 rat = ycoeff[1] / xcoeff[1];
443 points2coeff(sps.plus(0).getStruct().y - rat * sps.plus(0).getStruct().x, sps.plus(1).getStruct().y - rat * sps.plus(1).getStruct().x,
444 sps.plus(2).getStruct().y - rat * sps.plus(2).getStruct().x, sps.plus(3).getStruct().y - rat * sps.plus(3).getStruct().x,
445 scoeff);
446 scoeff[0] += rat * xcoeff[0] - ycoeff[0];
447 xrootn = solve3(scoeff, xroots);
448 if (xrootn == 4)
449 return 4;
450 for (i = 0; i < xrootn; i++) {
451 tv = xroots[i];
452 if (tv >= 0 && tv <= 1) {
453 points2coeff(sps.plus(0).getStruct().x, sps.plus(1).getStruct().x, sps.plus(2).getStruct().x, sps.plus(3).getStruct().x,
454 scoeff);
455 sv = scoeff[0] + tv * (scoeff[1] +
456 tv * (scoeff[2] + tv * scoeff[3]));
457 sv = (sv - xcoeff[0]) / xcoeff[1];
458 if ((0 <= sv) && (sv <= 1))
459 addroot(tv, roots, rootn);
460 }
461 }
462 return rootn[0];
463 }
464 } finally {
465 LEAVING("32nc8itszi77u36la8npt2870","splineintersectsline");
466 }
467 }
468
469
470
471
472 //3 9011b45d42bhwfxzhgxqnlfhp
473 // static void points2coeff(double v0, double v1, double v2, double v3, double *coeff)
474 public static void points2coeff(double v0, double v1, double v2, double v3, double coeff[]) {
475 ENTERING("9011b45d42bhwfxzhgxqnlfhp","points2coeff");
476 try {
477 coeff[3] = v3 + 3 * v1 - (v0 + 3 * v2);
478 coeff[2] = 3 * v0 + 3 * v2 - 6 * v1;
479 coeff[1] = 3 * (v1 - v0);
480 coeff[0] = v0;
481 } finally {
482 LEAVING("9011b45d42bhwfxzhgxqnlfhp","points2coeff");
483 }
484 }
485
486
487
488
489 //3 6ldk438jjflh0huxkg4cs8kwu
490 // static void addroot(double root, double *roots, int *rootnp)
491 public static void addroot(double root, double roots[], int rootnp[]) {
492 ENTERING("6ldk438jjflh0huxkg4cs8kwu","addroot");
493 try {
494 if (root >= 0 && root <= 1) {
495 roots[rootnp[0]] = root;
496 rootnp[0]++;
497 }
498 } finally {
499 LEAVING("6ldk438jjflh0huxkg4cs8kwu","addroot");
500 }
501 }
502
503
504
505
506 //3 3i8m1m9fg7qmnt8jloorwlu8e
507 // static Pvector_t normv(Pvector_t v)
508 public static ST_pointf normv(final ST_pointf v) {
509 // WARNING!! STRUCT
510 return normv_w_(v.copy()).copy();
511 }
512 private static ST_pointf normv_w_(final ST_pointf v) {
513 ENTERING("3i8m1m9fg7qmnt8jloorwlu8e","normv");
514 try {
515 double d;
516 d = v.x * v.x + v.y * v.y;
517 if (d > 1e-6) {
518 d = sqrt(d);
519 v.setDouble("x", v.x / d);
520 v.setDouble("y", v.y / d);
521 }
522 return v;
523 } finally {
524 LEAVING("3i8m1m9fg7qmnt8jloorwlu8e","normv");
525 }
526 }
527
528
529
530
531 //3 d59jcnpi1y0wr8e9uwxny2fvk
532 // static void growops(int newopn)
533 public static void growops(int newopn) {
534 ENTERING("d59jcnpi1y0wr8e9uwxny2fvk","growops");
535 try {
536 if (newopn <= Z.z().opn_route)
537 return;
538 if (N(Z.z().ops_route)) {
539 if (N(Z.z().ops_route = new ST_pointf.Array(newopn))) {
540 UNSUPPORTED("413an1hqgkb4ezaec6qdsdplx"); // fprintf (stderr, "libpath/%s:%d: %s\n", "graphviz-2.38.0\\lib\\pathplan\\route.c", 32, ("cannot malloc ops"));
541 UNSUPPORTED("1r6uhbnmxv8c6msnscw07w0qx"); // longjmp(jbuf,1);
542 }
543 } else {
544 if (N(Z.z().ops_route = Z.z().ops_route.reallocJ(newopn))) {
545 UNSUPPORTED("8u0qgahxvk5pplf90thmhwxhl"); // fprintf (stderr, "libpath/%s:%d: %s\n", "graphviz-2.38.0\\lib\\pathplan\\route.c", 32, ("cannot realloc ops"));
546 UNSUPPORTED("1r6uhbnmxv8c6msnscw07w0qx"); // longjmp(jbuf,1);
547 }
548 }
549 Z.z().opn_route = newopn;
550 } finally {
551 LEAVING("d59jcnpi1y0wr8e9uwxny2fvk","growops");
552 }
553 }
554
555
556
557
558 //3 f4a7nt247bokdwr2owda050of
559 // static Ppoint_t add(Ppoint_t p1, Ppoint_t p2)
560 public static ST_pointf add(final ST_pointf p1, final ST_pointf p2) {
561 // WARNING!! STRUCT
562 return add_w_(p1.copy(), p2.copy()).copy();
563 }
564 private static ST_pointf add_w_(final ST_pointf p1, final ST_pointf p2) {
565 ENTERING("f4a7nt247bokdwr2owda050of","add");
566 try {
567 p1.setDouble("x", p1.x + p2.x);
568 p1.setDouble("y", p1.y + p2.y);
569 return p1;
570 } finally {
571 LEAVING("f4a7nt247bokdwr2owda050of","add");
572 }
573 }
574
575
576
577
578 //3 c4l1gvlkv2s4mi6os7r9dh89f
579 // static Ppoint_t sub(Ppoint_t p1, Ppoint_t p2)
580 public static ST_pointf sub(final ST_pointf p1, final ST_pointf p2) {
581 // WARNING!! STRUCT
582 return sub_w_(p1.copy(), p2.copy()).copy();
583 }
584 private static ST_pointf sub_w_(final ST_pointf p1, final ST_pointf p2) {
585 ENTERING("c4l1gvlkv2s4mi6os7r9dh89f","sub");
586 try {
587 p1.setDouble("x", p1.x - p2.x);
588 p1.setDouble("y", p1.y - p2.y);
589 return p1;
590 } finally {
591 LEAVING("c4l1gvlkv2s4mi6os7r9dh89f","sub");
592 }
593 }
594
595
596
597
598 //3 dqnlz0tceriykws4ngudl94w9
599 // static double dist(Ppoint_t p1, Ppoint_t p2)
600 public static double dist(final ST_pointf p1, final ST_pointf p2) {
601 // WARNING!! STRUCT
602 return dist_w_(p1.copy(), p2.copy());
603 }
604 private static double dist_w_(final ST_pointf p1, final ST_pointf p2) {
605 ENTERING("dqnlz0tceriykws4ngudl94w9","dist");
606 try {
607 double dx, dy;
608 dx = p2.x - p1.x;
609 dy = p2.y - p1.y;
610 return sqrt(dx * dx + dy * dy);
611 } finally {
612 LEAVING("dqnlz0tceriykws4ngudl94w9","dist");
613 }
614 }
615
616
617
618
619 //3 19149pdllzhplvew0bsh5v6hy
620 // static Ppoint_t scale(Ppoint_t p, double c)
621 public static ST_pointf scale(final ST_pointf p, double c) {
622 // WARNING!! STRUCT
623 return scale_w_(p.copy(), c).copy();
624 }
625 private static ST_pointf scale_w_(final ST_pointf p, double c) {
626 ENTERING("19149pdllzhplvew0bsh5v6hy","scale");
627 try {
628 p.setDouble("x", p.x * c);
629 p.setDouble("y", p.y * c);
630 return p;
631 } finally {
632 LEAVING("19149pdllzhplvew0bsh5v6hy","scale");
633 }
634 }
635
636
637
638
639 //3 7ebsa2s1eoopqj1pp43bh5fw
640 // static double dot(Ppoint_t p1, Ppoint_t p2)
641 public static double dot(final ST_pointf p1, final ST_pointf p2) {
642 // WARNING!! STRUCT
643 return dot_w_(p1.copy(), p2.copy());
644 }
645 private static double dot_w_(final ST_pointf p1, final ST_pointf p2) {
646 ENTERING("7ebsa2s1eoopqj1pp43bh5fw","dot");
647 try {
648 return p1.x * p2.x + p1.y * p2.y;
649 } finally {
650 LEAVING("7ebsa2s1eoopqj1pp43bh5fw","dot");
651 }
652 }
653
654
655
656
657 //3 73nhv3cuxqa9va0puve0ji2d5
658 // static double B0(double t)
659 public static double B0(double t) {
660 ENTERING("73nhv3cuxqa9va0puve0ji2d5","B0");
661 try {
662 double tmp = 1.0 - t;
663 return tmp * tmp * tmp;
664 } finally {
665 LEAVING("73nhv3cuxqa9va0puve0ji2d5","B0");
666 }
667 }
668
669
670
671
672 //3 jkfs4ak0xr5pzwye7qnm6irp
673 // static double B1(double t)
674 public static double B1(double t) {
675 ENTERING("jkfs4ak0xr5pzwye7qnm6irp","B1");
676 try {
677 double tmp = 1.0 - t;
678 return 3 * t * tmp * tmp;
679 } finally {
680 LEAVING("jkfs4ak0xr5pzwye7qnm6irp","B1");
681 }
682 }
683
684
685
686
687 //3 9ziajuqys2xceftdw0vac02g9
688 // static double B2(double t)
689 public static double B2(double t) {
690 ENTERING("9ziajuqys2xceftdw0vac02g9","B2");
691 try {
692 double tmp = 1.0 - t;
693 return 3 * t * t * tmp;
694 } finally {
695 LEAVING("9ziajuqys2xceftdw0vac02g9","B2");
696 }
697 }
698
699
700
701
702 //3 5sjstsgkvoou9grsty3y0cnvg
703 // static double B3(double t)
704 public static double B3(double t) {
705 ENTERING("5sjstsgkvoou9grsty3y0cnvg","B3");
706 try {
707 return t * t * t;
708 } finally {
709 LEAVING("5sjstsgkvoou9grsty3y0cnvg","B3");
710 }
711 }
712
713
714
715
716 //3 9hzfapzxcesobeegq4aokksbp
717 // static double B01(double t)
718 public static double B01(double t) {
719 ENTERING("9hzfapzxcesobeegq4aokksbp","B01");
720 try {
721 double tmp = 1.0 - t;
722 return tmp * tmp * (tmp + 3 * t);
723 } finally {
724 LEAVING("9hzfapzxcesobeegq4aokksbp","B01");
725 }
726 }
727
728
729
730
731 //3 571cxp9l20eyvqjwdoy9vnc6t
732 // static double B23(double t)
733 public static double B23(double t) {
734 ENTERING("571cxp9l20eyvqjwdoy9vnc6t","B23");
735 try {
736 double tmp = 1.0 - t;
737 return t * t * (3 * tmp + t);
738 } finally {
739 LEAVING("571cxp9l20eyvqjwdoy9vnc6t","B23");
740 }
741 }
742
743
744 }