make plane zero if norm is zero after normalization
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 */
