1

I am working on a computer program which involves some fairly complicated rotation/translation math.

The current problem I am having is that I have a point on a sphere, which I want to move around the sphere using a vector.

So, to imagine the problem on a flat surface: I have a point at x = 10, y = 10, I subtract the vector (10,0), so the point is now at x = 0, y = 0.

However, the above will not work on a sphere, since the resulting point will not follow the curvature of the sphere.

What I'm asking for is a solution that takes a point and moves that point around a sphere by a distance and direction given by a vector.

If this is impossible, which it may be, I would settle for a solution which takes a point and moves it around a sphere by an angle.

This solution: How can I rotate a coordinate around a circle Solves the latter problem, but only works in two dimensions, would it be possible to convert this to work in 3 dimensions?

Any advice is appreciated.

  • Do you mean "I subtract the vector $(10,10)$"? – Alex Provost Aug 27 '16 at 21:17
  • Are you seeking to push a point in a direction tangent to the sphere? Otherwise, what happens if, say, the vector points to the center of the sphere? – Alex Provost Aug 27 '16 at 21:19
  • What would the vector look like that you using to move the point? Would it be tangential like Alex asked? Or is the vector your imagining "curved" as though projected onto the sphere? – Carser Aug 27 '16 at 21:21
  • Notice that not all vectors are suitable for giving the direction on a sphere: they must be perpendicular to a sphere radius. And then: distance on a sphere is measured along a curve, while a vector is straight. Do you want the length of the vector to match the distance on the sphere surface? – Intelligenti pauca Aug 27 '16 at 21:21
  • The vector will not point to the center of the sphere. What I am doing is hard to explain, but I am trying to implement a "floating origin" system for a computer game, where as the player moves a certain distance from the origin, are moved back to the origin and the objects in the world move the same amount (this is the vector) to make the movement appear seamless. This is fine for most objects, but with the spherical terrain I have created, I can't seem to be able to move the points correctly, and I believe this is due to the spherical nature of the terrain. – Ronan Collins Aug 27 '16 at 21:52
  • I think, if I could simple rotate the point according to an angle, for now, I could at least get confirmation that the overall problem is what I think it is. – Ronan Collins Aug 27 '16 at 21:53
  • The issue with a 2-dimension vector is the projection: we have can have vectors on a world map only because we're using a specific projection. Why not using a spherical coordinate system (r, θ, φ) to describe your sphere and adapt the answer you've linked to? You could still use a vector which would describe an angle and a distance. – S3MP Aug 27 '16 at 21:56
  • I'm not familiar with spherical coordinate systems, would this be required to solve the problem? – Ronan Collins Aug 27 '16 at 22:15
  • I have now converted the points to a spherical coordinate system. How would I got about adapting the previous answer that I linked? I am currently trying to implement Rodrigues rotation formula in C++, but I can't find enough examples to work from. – Ronan Collins Aug 29 '16 at 21:59
  • In case it helps, here is my current code:

    http://pastebin.com/69tFn51k

    I seem to have successfully converted the cartesian coordinates to spherical, at least according to a plot in gnuplot.

    I cannot seem to rotate them though, any advice?

    – Ronan Collins Aug 30 '16 at 05:54

0 Answers0