Revision dec81f48
Added by Leszek Koltunski 2 months ago
src/main/java/org/distorted/objectlib/helpers/FactorySticker.java | ||
---|---|---|
177 | 177 |
float tx = tangent_point[0] - other_point[0]; |
178 | 178 |
float ty = tangent_point[1] - other_point[1]; |
179 | 179 |
|
180 |
float ret= (-vy*tx+vx*ty >=0) ? computeAngle(-vy,vx) : computeAngle(vy,-vx); |
|
181 |
|
|
182 |
//android.util.Log.e("D", "tangent: "+tangent_point[0]+" "+tangent_point[1]+" other="+other_point[0]+" "+other_point[1]); |
|
183 |
//android.util.Log.e("D","circle: "+circle[0]+" "+circle[1]+" "+circle[2]+" ret="+ret); |
|
184 |
|
|
185 |
return ret; |
|
180 |
return ( vx*ty >= vy*tx ) ? computeAngle(-vy,vx) : computeAngle(vy,-vx); |
|
186 | 181 |
} |
187 | 182 |
} |
188 | 183 |
|
... | ... | |
299 | 294 |
output[0] = ox2; |
300 | 295 |
output[1] = oy2; |
301 | 296 |
} |
302 |
|
|
303 |
// android.util.Log.e("D", "findCircleLineIntersection circle="+x+" "+y+" "+r+" line="+a+" "+b+" "+c+" result: "+output[0]+" "+output[1]); |
|
304 | 297 |
} |
305 | 298 |
|
306 | 299 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
425 | 418 |
{ |
426 | 419 |
float pdir = computeDir(prev_edge_circle,cvert,pvert); |
427 | 420 |
float cdir = computeDir(curr_edge_circle,cvert,nvert); |
428 |
/* |
|
429 |
boolean pl = (cdir<pdir-PI || (cdir>pdir && cdir<pdir+PI)); |
|
430 |
boolean cl = (pdir<cdir-PI || (pdir>cdir && pdir<cdir+PI)); |
|
431 |
|
|
432 |
android.util.Log.e("D", "prev edge circle: "+prev_edge_circle[0]+" "+prev_edge_circle[1]+" "+prev_edge_circle[2]); |
|
433 |
android.util.Log.e("D", "from: "+cvert[0]+" "+cvert[1]); |
|
434 |
android.util.Log.e("D", "to : "+pvert[0]+" "+pvert[1]); |
|
435 |
android.util.Log.e("D", "dir : "+pdir+" left: "+pl); |
|
436 |
|
|
437 |
android.util.Log.e("D", "curr edge circle: "+curr_edge_circle[0]+" "+curr_edge_circle[1]+" "+curr_edge_circle[2]); |
|
438 |
android.util.Log.e("D", "from: "+cvert[0]+" "+cvert[1]); |
|
439 |
android.util.Log.e("D", "to : "+nvert[0]+" "+nvert[1]); |
|
440 |
android.util.Log.e("D", "dir : "+cdir+" left: "+cl); |
|
441 |
*/ |
|
442 | 421 |
float tmp = Math.abs(pdir-cdir); |
443 | 422 |
float diff= Math.abs(PI-tmp); |
444 | 423 |
|
... | ... | |
460 | 439 |
computeIntersection(moved_curr_edge,moved_prev_edge,cvert,output); |
461 | 440 |
output[2] = radius; |
462 | 441 |
output[3] = pleft ? 0:1; |
463 |
/* |
|
464 |
android.util.Log.e("D", "computeCornerCircle pdir="+pdir+" cdir="+cdir); |
|
465 |
android.util.Log.e("D", "prev edge circ: "+prev_edge_circle[0]+" "+prev_edge_circle[1]+" "+prev_edge_circle[2]+" pleft="+pleft); |
|
466 |
android.util.Log.e("D", "moved_prev: "+moved_prev_edge[0]+" "+moved_prev_edge[1]+" "+moved_prev_edge[2]); |
|
467 |
android.util.Log.e("D", "curr edge circ: "+curr_edge_circle[0]+" "+curr_edge_circle[1]+" "+curr_edge_circle[2]+" cleft="+cleft); |
|
468 |
android.util.Log.e("D", "moved_curr: "+moved_curr_edge[0]+" "+moved_curr_edge[1]+" "+moved_curr_edge[2]); |
|
469 |
|
|
470 |
android.util.Log.e("D", "pvert: "+pvert[0]+" "+pvert[1]); |
|
471 |
android.util.Log.e("D", "cvert: "+cvert[0]+" "+cvert[1]); |
|
472 |
android.util.Log.e("D", "nvert: "+nvert[0]+" "+nvert[1]); |
|
473 |
|
|
474 |
android.util.Log.d("D", "intersection: "+output[0]+" "+output[1]); |
|
475 |
*/ |
|
476 | 442 |
} |
477 | 443 |
} |
478 | 444 |
} |
... | ... | |
528 | 494 |
output[0] = ex; |
529 | 495 |
output[1] = cy; |
530 | 496 |
} |
531 |
|
|
532 |
//android.util.Log.e("D", "corner c: "+cx+" "+cy+" "+cr+" edge c: "+ex+" "+ey+" "+er+" output: "+output[0]+" "+output[1]); |
|
533 | 497 |
} |
534 | 498 |
|
535 | 499 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
594 | 558 |
while( sweepA<-PI ) sweepA += 2*PI; |
595 | 559 |
while( sweepA> PI ) sweepA -= 2*PI; |
596 | 560 |
|
597 |
//sweepA = -sweepA; |
|
598 |
|
|
599 | 561 |
startA *= 180/PI; |
600 | 562 |
sweepA *= 180/PI; |
601 | 563 |
|
Also available in: Unified diff
Minor