Discussion:
Rotating a point in xyz
(too old to reply)
Hul Tytus
2014-12-15 14:58:02 UTC
Permalink
comp.graphics.algorithms
Rotating a point in xyz

Anyone know of an algorithm for rotating a point about a line? More
specifically, a point in 3 dimensional space (xyz) perpindicular to a line
specified by two xyz points. The point is assumed perpindicular to the line at
the line's first point. The amount of rotation is limited to steps of 90
degrees to hopefully minimize the procedure.
The definition of a sphere, most simply: x^2 + y^2 + z^2 = r^2, would seem
the logical starting point, but a suitable form of limiting a sphere to a
circle is elusive.
In another approach, with the line's length being equal to the distance
from the point to the start of the line, the rotated point will have the same
distance to the start of the line as the original point. The distances from
the rotated point to the original point and to the end of the line are equal
and the same as that between the end of the line and the original point. With
all of these common distances, logic should show a simple solution. Logic
seems to be hiding.
The university style math texts I've seen have come close, but usually with
points tied directly to a 3 dimensional reference and not defined strictly in
terms of points in space. For example, an "equation of a plane" was defined by
three points each actually on an axis of the reference in use. A method to
determine an "equation of a plane" from three points in space might well be
usefull, but not seen. These texts seem aimed at a familiarity with and
discussion of theories and not so much the nitty gritty of application.
If someone knows of an algroithm for handling this type of rotation or of a
likely code library, I would appreciate hearing about it. Or perhaps a text
based on a area of application that would require such calculations.

Hul
Hans-Bernhard Bröker
2014-12-15 16:26:21 UTC
Permalink
Post by Hul Tytus
Anyone know of an algorithm for rotating a point about a line? More
specifically, a point in 3 dimensional space (xyz) perpindicular to a line
specified by two xyz points. The point is assumed perpindicular to the line at
the line's first point.
Is it assumed to be, or is it actually?
Post by Hul Tytus
The amount of rotation is limited to steps of 90
degrees to hopefully minimize the procedure.
Then you don't really need a rotation algorithm ... you just need to
pick between 4 possible rotated positions, one if which is where the
point already is. The other three can be found by simple vector
computations (cross products, scaling).
Post by Hul Tytus
In another approach, with the line's length being equal to the distance
from the point to the start of the line, the rotated point will have the same
distance to the start of the line as the original point.
The line's length doesn't have anything to do with that. For the
purposes of this exercise, that line essentially has no length worth
knowing. It only needs a direction and a reference point.
Nils
2014-12-16 04:27:20 UTC
Permalink
Post by Hul Tytus
comp.graphics.algorithms
Rotating a point in xyz
Anyone know of an algorithm for rotating a point about a line?
Yep!

https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation

Just define the axis as the normal vector built from your two reference
points. The angle is - well - your rotation angle.

The rotation formula is given in:


https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation#Rotating_a_vector

Since you only want to rotate in 90° steps the sin/cos pair simplifies
down to -1,0,1 numbers. You'll end up with some elementary vector
algebra involving cross-product and dot-product only.

/Nils
Hul Tytus
2014-12-16 22:27:31 UTC
Permalink
Unfortunantly, the math in the wikipedia article you suggested couldn't be
read with an ascii only browser. Next time there's fancier one at hand,
I'll give it a try.

Hul
Post by Nils
Post by Hul Tytus
comp.graphics.algorithms
Rotating a point in xyz
Anyone know of an algorithm for rotating a point about a line?
Yep!
https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation
Just define the axis as the normal vector built from your two reference
points. The angle is - well - your rotation angle.
https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation#Rotating_a_vector
Since you only want to rotate in 90? steps the sin/cos pair simplifies
down to -1,0,1 numbers. You'll end up with some elementary vector
algebra involving cross-product and dot-product only.
/Nils
Loading...