-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fixes an error in the OBB orientation calculation #100
Conversation
@alafi I think this should fix your issue. Wanna take a look? |
The fix seems to be flipping the OBB (or the rendering is erroneous?). Check the images below from the |
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.
And the whole "The-OBB-is-rotating-the-wrong-way-thing"
pivot) and expressed in the geometry frame as: | ||
`r_GQ = [(r_WQ - r_WG) * Bx, (r_WQ - r_WG) * By]^T` or | ||
`r_GQ = R_GW * (r_WQ - r_WG)`. | ||
Functionality that becomes: |
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.
"Functionally, that becomes:"
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.
Done
Vector2 r_WQ_W; | ||
Vector2 Bx = getXBasis(); | ||
Vector2 By = getYBasis(); | ||
Vector2 r_GQ_W = r_WQ - pivot_; |
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.
This would be clearer if the definitions of Bx
and By
came after r_GQ_W
. (Same for getYBasis()
.)
Blast! I was so focused on making sure that the numbers were internally consistent, that I didn't look for that. Great catch. I'll address it and ping you again. |
Ah...the difference is between release and debug. So, release looks right, debug looks wrong... Furthermore, it's clear that it's purely a rendering artifact. As I select different agents, their "near" goals move diagonally up to the left (even though the visualization of the goal moves up to the right). So, I'll take a look at the vis and figure out what's going on. |
0560633
to
ceb7ee9
Compare
Ok, I've updated the commit and I believe this fixes things. (Also the release vs debug thing may not have been 100% accurate. There's a vague chance that VisualStudio didn't update everything it should've. However, this feels good.) Moral of the story: I desperately need to get unit testing into Menge. A HUGE glaring hole... |
OK, this seems like fixed it. However, I am still getting the following assertion failed every while and then: Here are the parameter values for one of the incidents: The exception is thrown when calling Thank you for the great work and your follow up. |
Without looking to the code, I suspect I know the problem. The vector [1, 0] is most likely the default result when normalizing a zero vector. Obviously, in this case, that's a bad thing. I think I know where to look for that and I'll tackle it this evening. Once I look at it, I may include it in this PR, or I may PR it separately (the separate being a case of suspecting that there are mostly likely multiple instances of that across all the goals....) |
Review status: all files reviewed at latest revision, all discussions resolved. releaseNotes.txt, line 3 at r1 (raw file):
FYI spaces instead of tabs src/Menge/MengeCore/Math/Geometry2D.h, line 777 at r1 (raw file):
BTW (Meta) Line too long Comments from Reviewable |
The documentation of getXBasis() and getYBasis() did *not* agree with what was actually returned. This led to an incorrect result in computing the OBB centroid. 1. This elaborates on the documentation and how the basis vectors should be used. 2. It also corrects usage in OBBShape::setDirections and OBBShape::getTargetPoint 3. Modifies rendering to match. 4. Adds two methods to the OBBShape -- convertToWorld() and convertToGeometry() to remove the burden of callers on how to transform.
Review status: all files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
The documentation of getXBasis() and getYBasis() did not agree with what
was actually returned. This led to an incorrect result in computing the OBB
centroid.
Note to reviewer: some lines appear changed because whitespace has changed (tabs swapped for spaces -- sorry about that.)
Fixes #99
This change is