mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Going back and forth on how I want objects to be ordered in the 3d camera
This commit is contained in:
parent
3f445cb14e
commit
58dc8f2f0d
1 changed files with 16 additions and 16 deletions
|
@ -83,22 +83,22 @@ class ThreeDCamera(CameraWithPerspective):
|
||||||
*self.get_spherical_coords()
|
*self.get_spherical_coords()
|
||||||
)
|
)
|
||||||
def z_cmp(*vmobs):
|
def z_cmp(*vmobs):
|
||||||
#Compare to three dimensional mobjects based on
|
# Compare to three dimensional mobjects based on
|
||||||
#how close they are to the camera
|
# how close they are to the camera
|
||||||
return cmp(*[
|
# return cmp(*[
|
||||||
-np.linalg.norm(vm.get_center()-camera_point)
|
# -np.linalg.norm(vm.get_center()-camera_point)
|
||||||
for vm in vmobs
|
# for vm in vmobs
|
||||||
])
|
# ])
|
||||||
# three_d_status = map(should_shade_in_3d, vmobs)
|
three_d_status = map(should_shade_in_3d, vmobs)
|
||||||
# has_points = [vm.get_num_points() > 0 for vm in vmobs]
|
has_points = [vm.get_num_points() > 0 for vm in vmobs]
|
||||||
# if all(three_d_status) and all(has_points):
|
if all(three_d_status) and all(has_points):
|
||||||
# cmp_vect = self.get_unit_normal_vect(vmobs[1])
|
cmp_vect = self.get_unit_normal_vect(vmobs[1])
|
||||||
# return cmp(*[
|
return cmp(*[
|
||||||
# np.dot(vm.get_center(), cmp_vect)
|
np.dot(vm.get_center(), cmp_vect)
|
||||||
# for vm in vmobs
|
for vm in vmobs
|
||||||
# ])
|
])
|
||||||
# else:
|
else:
|
||||||
# return 0
|
return 0
|
||||||
Camera.display_multiple_vectorized_mobjects(
|
Camera.display_multiple_vectorized_mobjects(
|
||||||
self, sorted(vmobjects, cmp = z_cmp)
|
self, sorted(vmobjects, cmp = z_cmp)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue