Created
December 3, 2017 16:20
-
-
Save bysreg/b72298be4ed22b189f9dc6ae8cbb55d7 to your computer and use it in GitHub Desktop.
Get positive and negative point of AABB relative to a plane (a positive point is defined as a point that is most aligned with plane's normal whereas negative point is vice versa)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vec3f GetPointPositive(const AABB& a, const Vec3f& v) | |
{ | |
Vec3f ret( | |
(v.x > 0 ? a.max.x : a.min.x), | |
(v.y > 0 ? a.max.y : a.min.y), | |
(v.z > 0 ? a.max.z : a.min.z) | |
); | |
return ret; | |
} | |
Vec3f GetPointNegative(const AABB& a, const Vec3f& v) | |
{ | |
Vec3f ret( | |
(v.x > 0 ? a.min.x : a.max.x), | |
(v.y > 0 ? a.min.y : a.max.y), | |
(v.z > 0 ? a.min.z : a.max.z) | |
); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment