3D trig algorithms



I've been trying to think of general algorithms that people might find
useful.

Many years ago, I was a teacher of high-school math. I found that
geometry was taught in a way that was quite different from the
Euclidean method that I learned when I was a kid. Euclid sees
geometrical figures as static. The method that I taught (and learned at
the same time!) uses "transformations" to shift the shapes around,
making difficult ideas simple. For example, taking a triangle off one
end of a rectangle and putting it at the other end converts the
rectangle into a parallelogram, so clearly the two figures have equal
areas.

I used similar ideas when I wrote the three-dimensional trig programs I
posted here recently. Instead of using complex formulae to calculate
the distance between points on a sphere, for example, I carried out
several very simple steps. First, I rotated the frame of reference so
as to put one of the points on the prime meridian (longitude zero). Then
I rotated again, about a perpendicular axis, to take the point to the
South Pole. In this frame of reference, the latitude of the second
point is directly related to the distance between the points, so the
calculation is extremely easy. Also, the longitude of the second point
is the compass bearing of this point from the first, along a great
circle. What could be easier?!

SunAlign explicitly uses the same ideas. Two SUBs, C2P and P2C, convert
co-ordinate systems between Cartesian co-ordinates (X, Y, Z) and polar
ones (angles of AZimuth and ELevation). The frame of reference is
changed from having its principal axis aligned with the earth's
rotation axis to having the axis vertical in the observer's locality by
converting to polar notation with the axis *horizontal*, aligned
east-west. Simply adding the observer's co-latitude to the azimuth
rotates the frame of reference to the desired orientation. Later, the
angle-bisection that is needed to find the mirror's orientation is done
by adding two vectors in Cartesian notation. If the vectors are of
equal lengths (P2C automatically generates vectors with length 1 unit),
then the vector sum is aligned along the angle bisector between the two
initial vectors. Converting back to polar notation then gives the
azimuth and elevation of the direction in which the mirror must be
pointed.

I urge anyone who is interested in writing these kinds of programs to
experiment with these methods. You'll find that they lead to some
remarkably simple code that does operations that would otherwise be
quite difficult.

Of the programs I posted, SunAlign is the best documented. If you read
it, you should be able to figure out how the transformations are done.

Have fun!

dow
.



Relevant Pages

  • Re: coordinates and equations.
    ... there is an x axis and a y axis and a ... frame of reference, and c is the speed of light, then if you ... read on a clock stationary in S, and t' for the time read on a clock ...
    (sci.physics.relativity)
  • Re: coordinates and equations.
    ... there is an x axis and a y axis and a ... frame of reference, and c is the speed of light, then if you ... read on a clock stationary in S, and t' for the time read on a clock ...
    (sci.physics.relativity)
  • Re: coordinates and equations.
    ... there is an x axis and a y axis and a ... frame of reference, and c is the speed of light, then if you ... read on a clock stationary in S, and t' for the time read on a clock ...
    (sci.physics.relativity)
  • Re: coordinates and equations.
    ... there is an x axis and a y axis and a ... frame of reference, and c is the speed of light, then if you ... read on a clock stationary in S, and t' for the time read on a clock ...
    (sci.physics.relativity)
  • Re: Rigid rod problem
    ... In the rest frame of the rod and of the ... corkscrew rotating along its long axis; and suppose for simplicity that it has exactly an integral number of turns so that it doesn't wobble as it rotates. ... A helix with an integral number of windings will have its COM on the symmetry axis of the helix. ...
    (sci.physics.relativity)