327 |
// Normalize. |
// Normalize. |
328 |
double x = p.getX() - (getX() + getWidth() / 2); |
double x = p.getX() - (getX() + getWidth() / 2); |
329 |
double y = p.getY() - (getY() + getHeight() / 2); |
double y = p.getY() - (getY() + getHeight() / 2); |
330 |
setAngleStart(Math.toDegrees(Math.atan2(y, x))); |
setAngleStart(Math.toDegrees(Math.atan2(-y, x))); |
331 |
} |
} |
332 |
|
|
333 |
/** |
/** |
352 |
y1 = y1 - (my + mh / 2); |
y1 = y1 - (my + mh / 2); |
353 |
x2 = x2 - (mx + mw / 2); |
x2 = x2 - (mx + mw / 2); |
354 |
y2 = y2 - (my + mh / 2); |
y2 = y2 - (my + mh / 2); |
355 |
double start = Math.toDegrees(Math.atan2(y1, x1)); |
double start = Math.toDegrees(Math.atan2(-y1, x1)); |
356 |
double extent = Math.toDegrees(Math.atan2(y2, x2)) - start; |
double extent = Math.toDegrees(Math.atan2(-y2, x2)) - start; |
357 |
if (extent < 0) |
if (extent < 0) |
358 |
extent += 360; |
extent += 360; |
359 |
setAngleStart(start); |
setAngleStart(start); |
469 |
double extent = getAngleExtent(); |
double extent = getAngleExtent(); |
470 |
double end = start + extent; |
double end = start + extent; |
471 |
|
|
472 |
|
if (extent == 0) |
473 |
|
return false; |
474 |
|
|
475 |
if (extent >= 360 || extent <= -360) |
if (extent >= 360 || extent <= -360) |
476 |
return true; |
return true; |
477 |
|
|
493 |
while (a < start) |
while (a < start) |
494 |
a += 360; |
a += 360; |
495 |
|
|
496 |
return a >= start && a <= end; |
return a >= start && a < end; // starting angle included, ending angle not |
497 |
} |
} |
498 |
|
|
499 |
/** |
/** |
501 |
* is empty, then this will return false. |
* is empty, then this will return false. |
502 |
* |
* |
503 |
* The area considered 'inside' an arc of type OPEN is the same as the |
* The area considered 'inside' an arc of type OPEN is the same as the |
504 |
* area inside an equivalent filled PIE-type arc. The area considered |
* area inside an equivalent filled CHORD-type arc. The area considered |
505 |
* 'inside' a CHORD-type arc is the same as the filled area. |
* 'inside' a CHORD-type arc is the same as the filled area. |
506 |
* |
* |
507 |
* @param x the x coordinate to test |
* @param x the x coordinate to test |
524 |
return false; |
return false; |
525 |
|
|
526 |
double angle = Math.toDegrees(Math.atan2(-dy, dx)); |
double angle = Math.toDegrees(Math.atan2(-dy, dx)); |
527 |
if (getArcType() != CHORD) |
if (getArcType() == PIE) |
528 |
return containsAngle(angle); |
return containsAngle(angle); |
529 |
|
|
530 |
double a1 = Math.toRadians(getAngleStart()); |
double a1 = Math.toRadians(getAngleStart()); |