Everything2
Near Matches
Ignore Exact
Full Text
Everything2

rotation

"rotation" is also a: user

created by takeru

(idea) by intromorph (7.9 y) (print)   ?   (I like it!) Fri Aug 18 2000 at 22:57:28

for a really long time, i tried to get a program that did rotation to work and found this difficult as nearly all of the info provided on the subject assume knowledge of matrices. thus, here are the formulas for rotation in simple algebra in cartesian coordinate space:

x axis:
y' = y * cos(a) - z * sin(a)
z' = z * cos(a) + y * sin(a)

y axis:
z' = z * cos(a) - x * sin(a)
x' = x * cos(a) + z * sin(a)

z axis:
x' = x * cos(a) - y * sin(a)
y' = y * cos(a) + x * sin(a)

remember that if you are using these formulas as part of a programming exercise, z' is NOT the same as z so if you say something like:

z' = z * cos(a) - x * sin(a)
x' = x * cos(a) + z' * sin(a)

you will wind up with really wacked out results.


(idea) by abiessu (22.2 hr) (print)   ?   (I like it!) Sat Oct 06 2001 at 4:19:47

Here is another method for achieving a rotational effect, based on having only distances, not angles:

                 ,.onOK|||||HQme., (x,y) 
            ,.szF'``           ``'Tux.,
    (u,v) ,z'``       ____,..---*''/``'c,
        ,x'`_,..---*'`            /    `'w,
      .u'\,            d         /       `'n.
     dy`  `\,                   /          `qb
    /7      `\,                /             VA
   4y         `\,             /               KD,
  ,I'           `\,          /                `VA
  dp              `\,       /                  qb
 ,j'                `\,    /                   `t,
 AV                   `\, /          r          VA
 69                      O----------------------96
 VA                    (w,z)                    AV
 `t,                                           ,j'
  qb                                           dp
  `I,                                         ,U'
   \D                                         4y'
    VA                                       /7'
     qb,                                   ,dy
      `'n.                               .u'`
        `'w,                           ,x'`
          `'c,,                     ,,z'`
            `'Tux.,,           ,,.szF'`
                 `'TTOKQQQQQH@TT'`

From the above points, let (x,y) be the starting point, (w,z) the center of rotation, and d the distance to the new point. In other words, the rotation is counterclockwise from (x,y) to a point d in distance from (x,y) about (w,z).

Let r be the distance from (x,y) to (w,z) (i.e., the radius of rotation) and define c=sqrt(r2-(d/2)2) (a helpful constant). Since r is a distance, r=sqrt((x-w)2+(y-z)2).

From this we get:

u = w+((x-w)⋅(c2-(d/2)2)-(y-z)⋅d⋅c)/r2
v = z+((y-z)⋅(c2-(d/2)2)+(x-w)⋅d⋅c)/r2

Thanks to jrn for noticing that supplying a negative number for d will cause a clockwise rotation.


Below is my LISP code to achieve such a rotation. Note that the rotation function will return nil if abs(d) is more than twice as big as the distance from the starting point to the center of rotation (i.e., c is not a real number).

(defun distance (p1 p2)
  "Takes two points and finds the distance between them."
  (when (and (consp p1)
             (consp p2)
             (> (length p1) 1)
             (> (length p2) 1)
             (every 'numberp p1)
             (every 'numberp p2))
    (sqrt (+ (expt (- (first p1) (first p2)) 2)
             (expt (- (second p1) (second p2)) 2)))))

(defun distance-rotate (p c d)
  "Takes a point p, a center of rotation c, and a distance d.
Rotates counter-clockwise about c to a point d away from p.
Use a negative number for d to get a clockwise rotation."
  (when (and (numberp d) (distance p c))
    (let* ((r (distance p c))
           (k (sqrt (- (expt r 2) (expt (/ d 2) 2))))
           (dx (- (first p) (first c)))
           (dy (- (second p) (second c))))
      (when (< (abs d) (* 2 r))
        `(,(+ (first c)
              (/ (- (* dx (- (expt k 2) (expt (/ d 2) 2)))
                    (* dy k d)) (* r r)))
          ,(+ (second c)
              (/ (+ (* dy (- (expt k 2) (expt (/ d 2) 2)))
                    (* dx k d)) (* r r))))))))

(definition) by Webster 1913 (print) Wed Dec 22 1999 at 2:46:00

Ro*ta"tion (?), n. [L. rotatio: cf. F. rotation.]

1.

The act of turning, as a wheel or a solid body on its axis, as distinguished from the progressive motion of a revolving round another body or a distant point; thus, the daily turning of the earth on its axis is a rotation; its annual motion round the sun is a revolution.

2.

Any return or succession in a series.

Moment of rotation. See Moment of inertia, under Moment. -- Rotation in office, the practice of changing public officers at frequent intervals by discharges and substitutions. -- Rotation of crops, the practices of cultivating an orderly succession of different crops on the same land.

 

© Webster 1913.


Ro*ta"tion (?), a.

Pertaining to, or resulting from, rotation; of the nature of, or characterized by, rotation; as, rotational velocity.

 

© Webster 1913.


printable version
chaos

Playing the Nokia rotation game circle rotation matrix swavastika
Elliptic integral Continuous function fractals Nokia fractional linear transformation
Cogwheel &oplus; If cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl cyclohedron
Power Ball orthonormal matrix A/C curtate cycloid
nth roots of unity Markab Kerr metric How to throw a disc
funnel cloud bothersome nuance multiplicative inverse Ellipsoid
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
Engineering is my Religion
Making an F-16 from a cereal box, some Scotch tape, and a penny
Bleach
Things you can tell just by looking at her
Again, dammit!
Why Math Is Important To Women
Zoroastrianism
Stuffed full o' Nodes Day 2004
Human sacrifice and the Aztecs
KGB
Strange Fruit
Trying to explain Everything to your non-Everythingite friends
Missing neutrinos
New Writeups
Dreamvirus
Brighton Bombing(event)
Ariloulaleelay
'Appendices' to a 'Report' on THE HIVE×BODY MACHŸNE(log)
Timeshredder
WALL-E(review)
sitaraika
Win-laik-pya(idea)
Hazelnut
How to solve the obesity epidemic and the oil price hike in one fell swoop(idea)
raincomplex
Spitting out teeth like ampersands(place)
wertperch
July 4, 2008(personal)
Andrew Aguecheek
Keeping In Mind(fiction)
Heitah
The Pit of Life and Death(place)
alyssa-cruz
Spitting out teeth like ampersands(person)
antigravpussy
she is his sounding board(event)
Heitah
Four day work week(idea)
Simulacron3
The Brain and Reality(essay)
Heitah
Bomb, drug dogs for hire(idea)
Aerobe
Juniper Berries (& other botanicals)(fiction)
This affordable entertainment brought to you by The Everything Development Company