Change fallback unit normal to be in negative y-direction

This commit is contained in:
Grant Sanderson 2020-06-06 10:57:07 -07:00
parent 98ac6a06f2
commit 7c1f560ae2
2 changed files with 3 additions and 3 deletions

View file

@ -13,7 +13,7 @@ vec3 get_unit_normal(in vec3[3] points){
if(new_cp_norm < tol){
// We only come here if all three points line up
// on the z-axis.
return vec3(0.0, 1.0, 0.0);
return vec3(0.0, -1.0, 0.0);
// return k_hat;
}
return new_cp / new_cp_norm;

View file

@ -4,7 +4,7 @@ import itertools as it
from mapbox_earcut import triangulate_float32 as earcut
from manimlib.constants import RIGHT
from manimlib.constants import UP
from manimlib.constants import DOWN
from manimlib.constants import OUT
from manimlib.constants import PI
from manimlib.constants import TAU
@ -204,7 +204,7 @@ def get_unit_normal(v1, v2, tol=1e-6):
new_cp = cross(cross(v1, OUT), v1)
new_cp_norm = get_norm(new_cp)
if new_cp_norm < tol:
return UP
return DOWN
return new_cp / new_cp_norm
return cp / cp_norm