Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Perl and Quaternions

by salva (Monsignor)
on May 08, 2014 at 08:03 UTC ( #1085428=note: print w/ replies, xml ) Need Help??


in reply to Perl and Quaternions

Uff, that's not the usual quaternion!

The best way to do trigonometric operations with a computer is to convert between degrees and radians on the input/output layer and internally, on your program, use always radians.

Also, in order to manipulate 2D coordinates, using vector arithmetic would greatly simplify everything. For instance, check Math::Vector::Real.


Comment on Re: Perl and Quaternions
Re^2: Perl and Quaternions
by AppleFritter (Hermit) on May 08, 2014 at 09:50 UTC

    Uff, that's not the usual quaternion!

    Actually, it is; quaternions are often used to represent rotations.

      Oh, ok, I got confused because of the X, Y names. 2D and 3D coordinates are promoted to quaternions as {0, x, y, z} and seeing {x, 0, 0, y} didn't feel right!

      In any case, for 2D rotations, quaternions are overkill. You can just use complex numbers.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1085428]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2014-07-25 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (170 votes), past polls