|
bool | iterate (double x, double y, double c0x, double c0y, double c2x, double c2y, double rr) const |
|
Definition at line 20 of file AnnulusBounds.cxx.
◆ EllipseCollisionTest()
EllipseCollisionTest::EllipseCollisionTest |
( |
int |
maxIterations | ) |
|
|
inlineexplicit |
◆ collide()
bool EllipseCollisionTest::collide |
( |
double |
x0, |
|
|
double |
y0, |
|
|
double |
w, |
|
|
double |
h, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
double |
r |
|
) |
| const |
|
inline |
Definition at line 92 of file AnnulusBounds.cxx.
94 double x = std::abs(
x1 - x0);
95 double y = std::abs(
y1 - y0);
100 if (
x *
x + (
h -
y) * (
h -
y) <=
r *
r || (
w -
x) * (
w -
x) +
y *
y <=
r *
r ||
103 x *
w -
y *
h <=
w *
w)) {
106 if ((
x -
w) * (
x -
w) + (
y -
h) * (
y -
h) <=
r *
r || (
x <=
w &&
y -
r <=
h) || (
y <=
h &&
x -
r <=
w)) {
113 double localCos =
x /
R;
114 double deltaR = std::sqrt(
h *
h + (
w *
w -
h *
h) * localCos * localCos);
◆ iterate()
bool EllipseCollisionTest::iterate |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
c0x, |
|
|
double |
c0y, |
|
|
double |
c2x, |
|
|
double |
c2y, |
|
|
double |
rr |
|
) |
| const |
|
inlineprivate |
Definition at line 24 of file AnnulusBounds.cxx.
30 int numNodes = 4 <<
t;
33 double c1x = (c0x + c2x) * innerPolygonCoef[
t];
34 double c1y = (c0y + c2y) * innerPolygonCoef[
t];
37 if (
tx *
tx + ty * ty <=
rr) {
40 double t2x = c2x - c1x;
41 double t2y = c2y - c1y;
42 if (
tx * t2x + ty * t2y >= 0 &&
tx * t2x + ty * t2y <= t2x * t2x + t2y * t2y &&
43 (ty * t2x -
tx * t2y >= 0 ||
rr * (t2x * t2x + t2y * t2y) >= (ty * t2x -
tx * t2y) * (ty * t2x -
tx * t2y))) {
46 double t0x = c0x - c1x;
47 double t0y = c0y - c1y;
48 if (
tx * t0x + ty * t0y >= 0 &&
tx * t0x + ty * t0y <= t0x * t0x + t0y * t0y &&
49 (ty * t0x -
tx * t0y <= 0 ||
rr * (t0x * t0x + t0y * t0y) >= (ty * t0x -
tx * t0y) * (ty * t0x -
tx * t0y))) {
53 double c3x = (c0x + c1x) * outerPolygonCoef[
t];
54 double c3y = (c0y + c1y) * outerPolygonCoef[
t];
55 if ((c3x -
x) * (c3x -
x) + (c3y -
y) * (c3y -
y) <
rr) {
60 double c4x = c1x - c3x + c1x;
61 double c4y = c1y - c3y + c1y;
62 if ((c4x -
x) * (c4x -
x) + (c4y -
y) * (c4y -
y) <
rr) {
67 double t3x = c3x - c1x;
68 double t3y = c3y - c1y;
69 if (ty * t3x -
tx * t3y <= 0 ||
rr * (t3x * t3x + t3y * t3y) > (ty * t3x -
tx * t3y) * (ty * t3x -
tx * t3y)) {
70 if (
tx * t3x + ty * t3y > 0) {
71 if (std::abs(
tx * t3x + ty * t3y) <= t3x * t3x + t3y * t3y ||
72 (
x - c3x) * (c0x - c3x) + (
y - c3y) * (c0y - c3y) >= 0) {
77 }
else if (-(
tx * t3x + ty * t3y) <= t3x * t3x + t3y * t3y ||
78 (
x - c4x) * (c2x - c4x) + (
y - c4y) * (c2y - c4y) >= 0) {
◆ m_maxIterations
int EllipseCollisionTest::m_maxIterations |
|
private |
The documentation for this class was generated from the following file: