mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Only reorient points for triangulation if the normal vector is not OUT
This commit is contained in:
parent
0726dccd0a
commit
7dffa24acd
1 changed files with 6 additions and 4 deletions
|
@ -765,9 +765,9 @@ class VMobject(Mobject):
|
||||||
self.needs_new_triangulation = False
|
self.needs_new_triangulation = False
|
||||||
return self.triangulation
|
return self.triangulation
|
||||||
|
|
||||||
# Rotate points such that unit normal vector is OUT
|
if not np.isclose(normal_vector, OUT).all():
|
||||||
# TODO, 99% of the time this does nothing. Do a check for that?
|
# Rotate points such that unit normal vector is OUT
|
||||||
points = np.dot(points, z_to_vector(normal_vector))
|
points = np.dot(points, z_to_vector(normal_vector))
|
||||||
indices = np.arange(len(points), dtype=int)
|
indices = np.arange(len(points), dtype=int)
|
||||||
|
|
||||||
b0s = points[0::3]
|
b0s = points[0::3]
|
||||||
|
@ -797,7 +797,9 @@ class VMobject(Mobject):
|
||||||
|
|
||||||
# Triangulate
|
# Triangulate
|
||||||
inner_verts = points[inner_vert_indices]
|
inner_verts = points[inner_vert_indices]
|
||||||
inner_tri_indices = inner_vert_indices[earclip_triangulation(inner_verts, rings)]
|
inner_tri_indices = inner_vert_indices[
|
||||||
|
earclip_triangulation(inner_verts, rings)
|
||||||
|
]
|
||||||
|
|
||||||
tri_indices = np.hstack([indices, inner_tri_indices])
|
tri_indices = np.hstack([indices, inner_tri_indices])
|
||||||
self.triangulation = tri_indices
|
self.triangulation = tri_indices
|
||||||
|
|
Loading…
Add table
Reference in a new issue