Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upGeneric 3D bounds #187
Conversation
brendanzab
reviewed
Mar 14, 2015
| @@ -8,7 +8,7 @@ | |||
| // http://www.apache.org/licenses/LICENSE-2.0 | |||
| // | |||
| // Unless required by applicable law or agreed to in writing, software | |||
| // distributed under the License is distributed on an "AS IS" BASIS, | |||
| // distributed under the License is distributed on an "AS IS" BASisize, | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ghost
reviewed
Mar 15, 2015
| assert_eq!(aabb.volume(), 30is * 40is); | ||
| assert_eq!(aabb.center(), Point2::new(-5is, 10is)); | ||
| fn test_general() { | ||
| let aabb = Aabb2::new(Point2::new(-20isize, 30isize), Point2::new(10isize, -10isize)); |
This comment has been minimized.
This comment has been minimized.
ghost
reviewed
Mar 15, 2015
| // if we see Cross, then the result is Cross | ||
| // if we see In, then we keep the old result | ||
| // otherwise, take the current result | ||
| if cur == Relation::Cross || r == Relation::In { |
This comment has been minimized.
This comment has been minimized.
ghost
Mar 15, 2015
I think there is a bug here, if r is Relation::Cross and cur is In the state will be Relation::In instead of Relation::Cross
This might be nicer as a match too:
match (cur, r) {
(Relation::Out, _) | (_, Relation::Out) => Relation::Out,
(Relation::Cross, _) | (_, Relation::Cross) => Relation::Cross,
_ => Relation::In
}
This comment has been minimized.
This comment has been minimized.
kvark
Mar 15, 2015
Author
Collaborator
The condition cur == Cross || r == In will be false, so the outcome will take the other arm, which is just r, which is exactly Cross. So I think condition is still correct?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kvark
Mar 15, 2015
Author
Collaborator
cur == Cross would let it go the first arm, which results in cur, which is Cross. I believe this is still correct?
This comment has been minimized.
This comment has been minimized.
ghost
Mar 15, 2015
I think there are two cases missing here. If cur == Out and r == In The result should still be Out where it will be marked as In. The other case if cur == Cross && r == Out the result should be once again Out where it would be marked as Cross.
This comment has been minimized.
This comment has been minimized.
kvark
Mar 15, 2015
Author
Collaborator
cur == Out && r == In would result in Out, since it's the first arm of the condition. You are correct about the second case though, Cross shouldn't overwrite Out, and I need to fix the condition.
This comment has been minimized.
This comment has been minimized.
kvark
Mar 15, 2015
Author
Collaborator
I fixed the condition now. Thank you for spotting the logical error. Your attention to detail is highly professional!
ghost
reviewed
Mar 15, 2015
| fn relate_clip_space(&self, projection: &Matrix4<S>) -> Relation { | ||
| use std::cmp::Ordering::*; | ||
| let p = projection.mul_v(&self.to_homogeneous()); | ||
| match (p.x.abs().partial_cmp(&p.w), p.y.abs().partial_cmp(&p.w), p.z.abs().partial_cmp(&p.w)) { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kvark
Mar 15, 2015
Author
Collaborator
It would just return Cross for the matter of Relation. Not sure what would be a better way to handle it.
This comment has been minimized.
This comment has been minimized.
ghost
commented
Mar 15, 2015
|
This needs to be rebased. |
kvark
added some commits
Mar 12, 2015
kvark
force-pushed the
kvark:bound
branch
from
737bd8c
to
6691dce
Mar 15, 2015
This comment has been minimized.
This comment has been minimized.
|
Rebased now. |
This comment has been minimized.
This comment has been minimized.
|
We'd want to implement But that could be done later on without breaking the interface. |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Mar 15, 2015
|
I'm not sure why Travis is not building this... |
This comment has been minimized.
This comment has been minimized.
|
It was a bad merge on my part. The upcoming build should be fine though. |
This comment has been minimized.
This comment has been minimized.
|
Another thing to do would be adding a benchmark for frustum culling. This would be handy for the optimized |
ghost
pushed a commit
that referenced
this pull request
Mar 15, 2015
ghost
merged commit de2c032
into
rustgd:master
Mar 15, 2015
1 check passed
This comment has been minimized.
This comment has been minimized.
ghost
commented
Mar 15, 2015
|
Thanks~ |
kvark commentedMar 13, 2015
Closes #117
Fixes #125
Infrastructure to do frustum culling based on
SphereorAabbbounds. More can be implemented for theBoundtrait. Example code: