mirror of
				https://github.com/3b1b/manim.git
				synced 2025-10-31 20:18:56 +00:00 
			
		
		
		
	A little cleaning up of 3d axes. More to come
This commit is contained in:
		
							parent
							
								
									a204e422a5
								
							
						
					
					
						commit
						51eb9de9d0
					
				
					 1 changed files with 2 additions and 24 deletions
				
			
		|  | @ -216,7 +216,7 @@ class ThreeDAxes(Axes): | |||
|         "z_max": 3.5, | ||||
|         "z_normal": DOWN, | ||||
|         "num_axis_pieces": 20, | ||||
|         "light_source": 9 * DOWN + 7 * LEFT + 10 * OUT, | ||||
|         "gloss": 0.5, | ||||
|     } | ||||
| 
 | ||||
|     def __init__(self, **kwargs): | ||||
|  | @ -232,30 +232,8 @@ class ThreeDAxes(Axes): | |||
|         self.axes.add(z_axis) | ||||
|         self.add(z_axis) | ||||
| 
 | ||||
|         self.add_3d_pieces() | ||||
|         self.set_axis_shading() | ||||
| 
 | ||||
|     def add_3d_pieces(self): | ||||
|         for axis in self.axes: | ||||
|             axis.pieces = VGroup( | ||||
|                 *axis.get_pieces(self.num_axis_pieces) | ||||
|             ) | ||||
|             axis.add(axis.pieces) | ||||
|             axis.set_stroke(width=0, family=False) | ||||
|             axis.set_shade_in_3d(True) | ||||
| 
 | ||||
|     def set_axis_shading(self): | ||||
|         def make_func(axis): | ||||
|             vect = self.light_source | ||||
|             return lambda: ( | ||||
|                 axis.get_edge_center(-vect), | ||||
|                 axis.get_edge_center(vect), | ||||
|             ) | ||||
|         for axis in self: | ||||
|             for submob in axis.family_members_with_points(): | ||||
|                 submob.get_gradient_start_and_end_points = make_func(axis) | ||||
|                 submob.get_unit_normal = lambda a: np.ones(3) | ||||
|                 submob.set_sheen(0.2) | ||||
|             axis.insert_n_curves(self.num_axis_pieces - 1) | ||||
| 
 | ||||
| 
 | ||||
| class NumberPlane(Axes): | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Grant Sanderson
						Grant Sanderson