Skip to content

Commit dd67928

Browse files
committed
offset the centre of the sphere
1 parent a846258 commit dd67928

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎spatialmath/base/graphics.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,9 @@ def sphere(radius=1, centre=(0, 0, 0), resolution=50):
618618

619619
Phi, Theta = np.meshgrid(phi_range, theta_range)
620620

621-
x = radius * np.sin(Theta) * np.cos(Phi)
622-
y = radius * np.sin(Theta) * np.sin(Phi)
623-
z = radius * np.cos(Theta)
621+
x = radius * np.sin(Theta) * np.cos(Phi) + centre[0]
622+
y = radius * np.sin(Theta) * np.sin(Phi) + centre[1]
623+
z = radius * np.cos(Theta) + centre[2]
624624

625625
return (x, y, z)
626626

0 commit comments

Comments
 (0)