Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function makePlanet(vec, rad)
  2. %the sphere(N) function will create three N+1 by N+1 matrices that are x, y,
  3. %and z coordinates to a unit sphere
  4. [x, y, z] = sphere(30);
  5. %apply the radius and position changes
  6. newx = x*rad + vec(1);
  7. newy = y*rad + vec(2);
  8. newz = z*rad + vec(3);
  9. %plot it
  10. surf(newx, newy, newz);
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement