-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend bindings for OBB and misc fixes. #493
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ OBB computeGravityAlignedMOBB(const vec3f& gravity, | |
const float dd = d0[0] * d1[1] - d0[1] * d1[0]; | ||
|
||
const float dx = s1[0] - s0[0]; | ||
const float dy = s1[1] - s0[0]; | ||
const float dy = s1[1] - s0[1]; | ||
const float t = (dx * d1[1] - dy * d1[0]) / dd; | ||
|
||
return s0 + t * d0; | ||
|
@@ -240,7 +240,7 @@ OBB computeGravityAlignedMOBB(const vec3f& gravity, | |
aabb.extend(T_w2b * pt); | ||
} | ||
|
||
return OBB{aabb.center(), aabb.sizes(), T_w2b.inverse()}; | ||
return OBB{T_w2b.inverse() * aabb.center(), aabb.sizes(), T_w2b.inverse()}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The center was not in world coordinates |
||
} | ||
|
||
} // namespace geo | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,13 +39,12 @@ std::vector<vec2f> convexHull2D(const std::vector<vec2f>& points) { | |
} | ||
|
||
// Build upper hull | ||
for (size_t i = idx.size() - 2, t = k + 1; i >= 0; i--) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here, just to have a history record for all this deep changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolves a segfault that occurs on Linux due to undefined behavior of unsigned integer underflows. |
||
for (size_t i = idx.size() - 1, t = k + 1; i > 0; i--) { | ||
while (k >= t && cross(points[hullIdx[k - 2]], points[hullIdx[k - 1]], | ||
points[idx[i]]) <= 0) { | ||
points[idx[i - 1]]) <= 0) { | ||
k--; | ||
} | ||
|
||
hullIdx[k++] = idx[i]; | ||
hullIdx[k++] = idx[i - 1]; | ||
} | ||
|
||
hullIdx.resize(k - 1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Skylion007, can you remind me what was the bug here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dy was not actually calculating a delta y.