Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -




Not registered yet?

#1 2005-11-08 09:05:35

Super Member


Rotating a 3d point about a 3d line.

Suppose you had two 3d points, "pointone", "pointwo", and a point "thepoint", what would be the best way to rotate "thepoint"around the line connecting point one and pointtwo?

I really need to get some books on 3d linear algebra. :-/

A logarithm is just a misspelled algorithm.

#2 2005-11-08 17:49:27

Full Member


Re: Rotating a 3d point about a 3d line.

are you trying to find the volume by using cylindrical shells?

#3 2005-11-08 18:27:39

Power Member


Re: Rotating a 3d point about a 3d line.

I'm going to type out loud here.

You want the point to travel in a circle, so my intuition tells me to use the circular functions.

Define the rate of rotation as radians per unit time. Let ω = rate of rotation.
Let n = number of ω's per circle = 2pi/ω

r = radius of circle = found by distance formula (sorry I'm too lazy to do this for you smile)

R1 = radius from center to original point
R2 = radius to translated point

Length L that point travels per unit time: L = 2*r*pi * sin (pi/n)

R1, L, and R2 form a triangle.

L is a vector quantity, so you can find its components using vector arithmetic. To do this, I'll first define my axes. I'll put x and y on the horizontal plane, and z on the vertical (altitude). I'll also call the components of the vector Lx, Ly, and Lz.

Imagine viewing the system from directly overhead, so the z component is entirely suppressed. Now, vectors can be freely repositioned as long as their magnitude and direction are not altered. So, we'll put the corner of  R1 and L at the origin.

Drop a perpendicular to the x-axis, and you have a right triangle, the legs of which are Lx and Ly. We know all of the angles of the triangle (R1 L R2) -- one is ω, and the other two are (π/2 - ω). All we need is the angle that L makes with the x (or y) axis, and the problem is solved.

But, I can't think of a way to find it right now, and I need to go to bed. Later maybe, or someone else can find it. Or you wink

Last edited by ryos (2005-11-09 14:08:03)

El que pega primero pega dos veces.

#4 2005-11-09 14:05:15

Power Member


Re: Rotating a 3d point about a 3d line.

Some more thoughts.

You can calculate the angle that your line makes with the horizontal from the slope. Say D is the distance between point1 and point2. Dy = rise of slope, Dx = run of slope. So,

∠β = arcsin (Dy / D).

The plane of rotation is perpendicular to this angle. So, to get the angle that the plane of rotation makes with the x/y plane, you just add π/2: ∠Z = β + π/2

This lets you find the z component: Lz = L sin ∠Z

For Lx and Ly, we need to drop a perpendicular from the high end of L. The top angle here is (π/2 - ∠Z) = ∠θ. This forms a triangle on the "ground", with hypotenuse given by H = sqrt( L² - Lz² ).

Now, Lx = H sin θ
and Ly = H cos θ

We're done! In summary,

r = 3d distance formula
ω = angular velocity of point (rate of rotation, radians/sec)
n = 2π / ω
L = 2πr sin (π/n)

And the rest, from this post. (Man, I'm lazy. Too lazy to summarize.)

Last edited by ryos (2005-11-09 14:08:44)

El que pega primero pega dos veces.

#5 2005-11-09 18:49:45

Super Member


Re: Rotating a 3d point about a 3d line.

Well some of this may be above my level as I'm having a bit of trouble understanding. I'll reread it a few times to see if it sinks in. I wasn't necessarily interested in velociy, (Though I might be able to use that)  I was more interested in rotating by a specified degree about a specified axis. What I can't figure out is what is that angle defined from and how do we specify which direction we want to rotate it. If you want to rotate 15 degrees, then 15 degrees in want direction? Depending on the axis and the location of the point that may end up rotating in the opposite direction you had desired.

Btw, one thing I did note that if a point is rotating about an axis, the point will always remain the distances from two points on the axis, even if those distances are not equal to eachother, the won't change.

Suppose we want to rotate a point (who's coordinates are x,y, and z) about the axis defined by the line connecting point1 and point2 (who's coordinates will be x1, y1, z1, x2, y2, z2 respectively)

We know the 3d distance from point1 and the point will not change, and that the 3d distance from point2 and the point will not change.

So distance1 = sqrt ((x1 - x)^2 + (y1 - y)^2 + (z1 - z)^2)
and distance2 = sqrt ((x2 - x)^2 + (y2-y)^2 + (z2 - z)^2)

Where distance1 and distance2 are the 3d distances from the point, to point1 and point2 respectively, before the rotation is made and the points coordinates are known.

That gives us two equations about the points. So I suppose if we know at least one of the coordinates of the point we should be able to calculate the remaining two coordinates to define its new location. I suppose this one coordinate must somehow be determined by the desired angle of rotation.

A logarithm is just a misspelled algorithm.

#6 2005-11-10 04:00:27

Power Member


Re: Rotating a 3d point about a 3d line.

Sorry - I didn't take the time to be clear, I mostly just thought out loud until I came to a conclusion. And I busted out a lot of symbols, but they're mostly just arbitrary (except for ω, which really is the symbol they use to denote angular velocity).

I think radii of the circle are an easier quantity to work with than distances from the endpoints.

That ω thing - angular velocity - is just how many radians the point moves along the circle per unit time. It can be any arbitrary angle over any arbitrary timeslice. Or, you could just give it a static value.

The direction of rotation is given by the sign of ω. Positive means it's rotating counter-clockwise WRT its axis of rotation, and negative the opposite. I don't think you have to worry about it too much; the math should just take care of it for you.

So, the point moves along an arc of length ω. What is the linear distance between the starting and ending points? Well, this motion divides the circle into a number n of--wait, I think I need to tweak this part. The formula I gave you was for a circle divided into n equal parts, but we don't necessarily have that here.

The two radii from the start and end points of motion form a triangle with angle ω at the top. Bisect the angle to get two right triangles with top angles of ω/2. You can then use trig to find the length of the distance the point traveled:

2r sin (ω/2) = L

Now we have that length. This line is a vector, meaning a quantity with both magnitude (length) and direction (angle). We can use this fact to find the offset that we must add to the coordinates of thepoint in order to rotate it one step.

Every vector has components. A component is just a vector that is directed along one of the axes. Take three of these and add them (using vector arithmetic), and you produce a 3d vector. But you don't need to add them, you just need to find them. My second post described that process.

Once you have Lx, Ly, and Lz (remembering the axes I've defined; yours may be different--you may have to swap y and z, for example), you can just add them to the x, y, and z coordinates of your first point, and you've rotated it. The signs of the numbers should have been properly preserved and produce the correct motion regardless of where your object is. I think.

I don't know if this is a very computationally efficient way to do it (matrices are probably better, but I know almost nothing about them wink).

El que pega primero pega dos veces.

Board footer

Powered by FluxBB