@@ -62,9 +62,9 @@ def prism(
6262 anchor_x , anchor_y , anchor_z = center
6363
6464 arr = np .linspace (0 , 2 * np .pi , num = n_sides , endpoint = False )
65- z_poly = np .cos (arr ) + anchor_z + radius
66- y_poly = np .sin (arr ) + anchor_y + radius
67- x_poly = np .zeros (n_sides ) + anchor_x
65+ z_poly = np .cos (arr ) * radius
66+ y_poly = np .sin (arr ) * radius
67+ x_poly = np .zeros (n_sides )
6868
6969 x_array = np .concat ([x_poly , x_poly + height ])
7070 y_array = np .concat ([y_poly , y_poly ])
@@ -83,7 +83,7 @@ def cone(
8383 height = 1.0 ,
8484 radius : Optional [float ] = None ,
8585 capping : bool = True ,
86- angle : Optional [ float ] = None ,
86+ angle : float = 0.0 ,
8787 resolution : int = 6 ,
8888 color : str = "#aaa" ,
8989 opacity : float = 0.5 ,
@@ -96,13 +96,13 @@ def cone(
9696 num = resolution ,
9797 endpoint = False ,
9898 )
99- z_poly = np .cos (arr ) * radius + anchor_x
100- y_poly = np .sin (arr ) * radius + anchor_y
101- x_poly = np .zeros (resolution ) + anchor_z
99+ z_poly = np .cos (arr ) * radius
100+ y_poly = np .sin (arr ) * radius
101+ x_poly = np .zeros (resolution )
102102
103- z_array = np .concat ([z_poly , np .array ([anchor_z ])])
104- y_array = np .concat ([y_poly , np .array ([anchor_y ])])
105- x_array = np .concat ([x_poly , np .array ([anchor_x + height ])])
103+ z_array = np .concat ([z_poly , np .array ([0 ])])
104+ y_array = np .concat ([y_poly , np .array ([0 ])])
105+ x_array = np .concat ([x_poly , np .array ([height ])])
106106
107107 x_array , y_array , z_array = apply_transformations (x_array , y_array , z_array , center , direction )
108108
@@ -125,8 +125,8 @@ def sphere(
125125 opacity = 0.5 ,
126126) -> go .Mesh3d :
127127 anchor_x , anchor_y , anchor_z = center
128- phi = np .linspace (start_phi , 2 * np .radians (end_phi ), 2 * phi_resolution )
129- theta = np .linspace (start_theta , np .radians (end_theta ), theta_resolution )
128+ phi = np .linspace (start_phi , 2 * np .radians (end_phi ), phi_resolution + 1 )
129+ theta = np .linspace (start_theta , np .radians (end_theta ), theta_resolution + 1 )
130130
131131 theta , phi = np .meshgrid (theta , phi )
132132
@@ -213,11 +213,11 @@ def circular_arc_from_normal(
213213 center = np .array (center )
214214 anchor_x , anchor_y , anchor_z = center
215215 radius = np .sqrt (np .sum ((polar - center ) ** 2 , axis = 0 ))
216- angles = np .linspace (0.0 , np .radians (angle ), resolution + 1 )
216+ angles = np .linspace (0.0 , np .radians (angle ), resolution + 1 , endpoint = True )
217217
218- x_array = np .cos (angles ) + radius + anchor_x
219- y_array = np .sin (angles ) + radius + anchor_y
220- z_array = np .zeros (resolution + 1 ) + anchor_z
218+ z_array = np .cos (angles ) * radius + anchor_z
219+ y_array = np .sin (angles ) * radius + anchor_y
220+ x_array = np .zeros (resolution + 1 ) + anchor_x
221221
222222 x_array , y_array , z_array = apply_transformations (x_array , y_array , z_array , center , normal )
223223
0 commit comments