Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Rotate point on sphere to exactly 'cut sphere in half'

  1. Dec 7, 2007 #1
    Given a point on a unit radius sphere (let's say at coords x=0, y=0.4, z=-0.9165 as shown in the attached diagram), and given a starting angle from 0 to 360 for which the point to travel, what math can I use to exactly 'cut' the sphere in half?

    For example, the attached diagram below shows the sphere cut exactly in half in two different ways according to the starting direction (blue line about 30 degrees (anti-clockwise from 3 o'clock), and orange line about 75 degrees).

    So input is: x, y, z, starting angle direction, and distance travelled around the sphere (as an angle).
    And output is newx, newy, and newz.

    What equation can I use?

    Attached Files:

    Last edited: Dec 7, 2007
  2. jcsd
  3. Dec 7, 2007 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Any great circle (circle that defines a diameter) will work for this. To find what the possible great circles are, note they have to cross through the point directly opposite your starting point, i.e. be on the line defined by the starting point and the center of the circle. This is fortunately trivial to calculate as the center is the origin, so you can just take the negative of each coordinate.

    Given those two points you can draw a circle of radius one on any plane passing through them (the circle and the plane passing through the points that is) and you've found a possible great circle. Note this gives you infinite possible solutions. I'm not quite sure how you're defining the starting angle for a generic point, but once you pick a way, you've narrowed it down to exactly one path
  4. Dec 7, 2007 #3
    Yes, all that makes sense. To answer your question, the starting angle is arbitrary from 0-360 and that's why I gave it as one of the starting variables. Do you know the math formula to output the new x, y & z values given the initial 5 variables as said at the end of my initial post?
  5. Dec 7, 2007 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I know the starting angle is arbitrary, but you have to say what it's an angle with respect to so it's defined well. For example, when you give polar coordinates, you give the angle with respect to the positive x-axis. I imagine it's tricky to find something good to do this with as in general, there's no set axis or plane where you can define the angle off of, since the perspective of the point skews as it moves


    I just noticed, your distance traveled around the sphere is kind of useless, because the point always travels around a great circle, so it never changes
  6. Dec 7, 2007 #5
    Sorry, this should read as "distance (as an angle) travelled around the great circle".

    Ah, yeah I kinda see how this could be tricky. Okay, this is what I want. Assume an 'absolute' angle system. So for example, let's say that the white point is *behind* the sphere (instead of in front as shown). Even now, 0 degrees as the starting direction would be counted as what we see as 3-o'clock. In other words, the sphere stays static, and we don't try to rotate our view to centralize the point. And now, where the point is at on the sphere, we always count rightwards as 0 degrees.

    I understand this will create sudden 'about turn' anomalies on the bright green circle of the shown sphere, but that doesn't worry me at this point in time. I hope this answers your question. See below attachment for clarification.

    By the way, thanks for offering your time to work this out. I'm getting excited about the prospects of how I can use this if it works.

    Attached Files:

    Last edited: Dec 7, 2007
  7. Dec 8, 2007 #6


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I'll preface this by saying that for the duration of this post, in the images you posted the x-axis is horizontal and the z-axis is vertical (y-axis is into/out of the page)

    Ok, so instead of being something in the front or the back of the sphere, if instead the point was off to the side (so maybe, from our perspective, at (-1,0,0) if we're looking at this from the negative y-axis), from our perspective it has a projection angle of zero, so the way of describing this isn't very good as it's not defined for two points I think. The top and bottom might not work either, as you have no up/down rotation to determine what the angle is.

    I'm starting to see now, when you say
    You're not actually traveling all the way around the sphere. That makes more sense.

    I think what we need to do is describe the sphere in spherical coordinates.

    If you don't know what they are, look here http://en.wikipedia.org/wiki/Spherical_coordinates. we know the radius of the sphere is 1, so we can describe the point by stating the angle w.r.t. the z-axis (angle formed by the z-axis and the line from the origin to the point, always between 0 and 180) and the angle of the projection onto the x-y plane w.r.t. the x-axis, which is between 0 and 360. We'll call these P and T (P for phi, and T for theta. I'm too lazy to keep texing)

    Then the coordinates of your point are (P,T). If you want the input as (x,y,z) that's fine, as we can algorithmically calculate P and T based on them. But input as (P,T) probably would be better depending on your application as there can't be any rounding error in making sure the point actually is on the sphere (e.g. if x,y,z are repeating or irrationals). Then based on the point's location, we can give a trajectory (p,t). For example, the zero degrees that you have up there would be described as (90,0) as , if you put the trajectories on the origin, they would form a 0 degree angle with the x-axis and a ninety degree angle with the z-axis. If it was a point on the side (one that I said you couldn't do with your system), then it would be (p, 90) or (p,270) depending on which way it was pointing. If the trajectory was pointing straight up or straight down, then the t portion wouldn't be well defined, but you can probably just put a 0 in there and find a way to make it work.

    How the whole algorithm would come together I'm not entirely sure of yet, so I'll have to get back to you after thinking a bit
  8. Dec 8, 2007 #7
    Okay. Is it okay if in future we use X for the horizontal, Y for the vertical, and Z for the into/out of the page as this seems to be more intuitive for me.

    Is that x=-1, y=0, and z=0?

    Yes, it's only travelling around the sphere in the sense that the great circle travels 'around the sphere'.

    Yep, seen this page before. I've got a spherical coord system up and running in fact.

    Fine. Yes having the input as spherical angles instead of the Cartesian coord system is probably simpler. It's trivial to convert between them anyway.

    Hope you manage to solve it!
  9. Dec 8, 2007 #8


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Actually, I realized my stupid (p,t) trajectory system was complete bullocks (I've always wanted to use that word), because of the exact same problem that came from trying to do the static one dimensional version (i.e. the vector skews as it goes around the sphere). The system would work, but actually calculating what the trajectory vector is would be a pain for non-trivial points on the sphere. here's what's needed I think:

    An outward pointing normal vector at (x,y,z) is (x,y,z) which is the normal of the plane [tex]xx_0 + yy_0 + zz_0 = c[/tex] where the [tex]x_0,y_0, z_0[/tex] are the variables. So given (x,y,z) the tangent plane to the sphere at that point is is [tex]xx_0 + yy_0 + zz_0 = x^2 + y^2 + z^2=1[/tex] as the point (x,y,z) must be on the plane and (x,y,z) is on the sphere. So on the plane described by [tex]xx_0+yy_0+zz_0=1[/tex] we need to pick a vector on the plane, and then describe the angle w.r.t. that vector. To satisfy our geometric intuition that you were trying to use before, we're going to pick a vector on it with no z0 component (then picking the angle is equivalent to what you were doing for most cases). So we have [tex]xx_0+yy_0=1[/tex] which is satisfied by [tex]x_0=1/(2x), y_0=1/(2y)[/tex]. Unless, of course, x or y (or both) is zero. So we break it down to if else statements to determine what you're measuring your angle with respect to (vectors placed on the sphere at the starting point):

    if (x=0)
    angle is measured with respect to (1,0,0)
    if (y=0)
    angle is measured with respect to (0,1,0) (these two cases you should be able to see visually in your head why they work)
    angle is measured with respect to (1/(2x),1/(2y),0)

    Notice how this makes some intuitive sense as we can take any multiple of the vector we're measuring w.r.t. (since we only need direction), so for x large w.r.t. y, the angle is measured with something that has a large y component, and then taken to the extreme for y zero, the y component must be infinitely larger than the x component. So now that that's sorted with a solid level of rigor, next up is figuring out what great circle you're looking at given a point, and an angle w.r.t. a tangent vector (coming up tomorrow probably)

    EDIT: If you can confirm this makes sense, that would be great :) If you have any questions on the above, feel free to ask
    Last edited: Dec 8, 2007
  10. Dec 10, 2007 #9


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Much better way of doing things:

    If your starting point is (P,T), first, you calculate the matrix that rotates this to (1,0,0), which would be combining a rotation of -T around the z-axis, then a rotation of P around the x-axis. multiply the two to get your final matrix. Then amazingly enough orientation of any 'horizontal' vector is still horizontal, so we can describe the trajectory by an angle O w.r.t an a vector parallel to (0,1,0). Then the great circle is going to be parametrized by

    cos(t)i + sin(t)j + 0k and we need to rotate this by an angle O around the x-axis. This gives us a parametrization w.r.t. angle for position on the great circle, and by multiplying by the inverse of the original rotation matrix, we find the position you're looking for.

    Smooth as silk
  11. Dec 10, 2007 #10
    I'm afraid I can't easily follow your last two posts, but it looks as though you may have cracked it judging from your last one. Nice one! (You'd never guess what this is all for by the way :D )

    So from your latest post, could you express the newx, newy and newz output variables in terms of the 5 input vars (or 4 if you use spherical coords) ?
  12. Dec 12, 2007 #11


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I'm taking an eight hour plane flight in less than 24 hours, but I'll post up a full description of the method on friday or saturday
  13. Feb 8, 2008 #12
    Question to Office_Shredder

    Sorry to butt in here but I'm curious to know whether the following
    alternative solution derived from vector algebra is the same as the
    elegant solution proposed by Office_Shredder:

    Let [tex] \{x,y,z\} [/tex] be an orthonormal set of basis vectors
    spanning 3D space, and let [tex] a [/tex] be
    a unit vector specifying the initial point on the unit sphere:

    [tex] a = Xx + Yy +Zz [/tex], where [tex] \{X,Y,Z\} [/tex] are just real numbers.

    Following the suggestion in the previous posts,
    [tex] a [/tex] can be specified in terms of spherical coordinates:

    [tex] X=\sin{\theta}\cos{\phi}; \ Y=\sin{\theta}\sin{\phi}; \
    Z=\cos{\theta} [/tex].

    The plane tangent to the sphere at the point specified by [tex] \ a [/tex] is

    [tex] P := xyza = Xyz +Yzx +Zxy [/tex].

    Now define two orthonormal reference vectors in this plane:

    [tex] e_1 = z \cdot P/ \left |z \cdot P \right | = (Yx - Xy)/t [/tex], where [tex]t = \sqrt{X^2 + Y^2}[/tex]

    [tex] e_2 = (z \cdot P)P^{-1} \\
    = (Yx - Xy)(Xzy + Yxz + Zyx) \\
    = z - Za. [/tex]

    The unit vectors [tex] (a, e_1, e_2) [/tex] comprise a set of orthonormal vectors.
    The great circle dividing the sphere in half may now be specified by
    defining a unit vector [tex]u[/tex] in terms of an angle
    [tex] \tau, \ (0 \leq \tau \leq 2\pi) [/tex]:

    [tex] u = e_1\ \cos{\tau} + e_2\ \sin{\tau} [/tex].

    The great circle lies in the plane [tex] a\wedge u[/tex]. Any point on this
    great circle can be expressed in terms of an angle
    [tex] \beta, \ (0 \leq \beta \leq 2\pi) [/tex]
    to define a vector r pointing from the origin to a point on the circle:

    [tex] r(\beta) = a\ \cos{\beta} + u\ \sin{\beta} [/tex].

    If the radius of the sphere is R, then simply multiply r by R.

    This formula will fail if the starting point is on the z-axis. In this
    case, one can develop an alternative formula by defining the reference
    vectors with x instead of with z.

    The above procedure should produce the same result as the one by
    Office_Shredder but it does not require rotation matrices.
    Last edited: Feb 8, 2008
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook