mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 12:32:40 +00:00
make plane zero if norm is zero after normalization
This commit is contained in:
@@ -30,7 +30,14 @@
|
||||
CGLM_INLINE
|
||||
void
|
||||
glm_plane_normalize(vec4 plane) {
|
||||
glm_vec4_scale(plane, 1.0f / glm_vec3_norm(plane), plane);
|
||||
float norm;
|
||||
|
||||
if ((norm = glm_vec3_norm(plane)) == 0.0f) {
|
||||
glm_vec4_zero(plane);
|
||||
return;
|
||||
}
|
||||
|
||||
glm_vec4_scale(plane, 1.0f / norm, plane);
|
||||
}
|
||||
|
||||
#endif /* cglm_plane_h */
|
||||
|
||||
Reference in New Issue
Block a user