|
|
|
|
|
by b2gills
1806 days ago
|
|
In Raku you can also use × (U+D7) for multiplication # this assumes that ϕ, ψ, and θ have already been set
my \cϕ = ϕ.cos; my \sϕ = ϕ.sin;
my \cψ = ψ.cos; my \sψ = ψ.sin;
my \cθ = θ.cos; my \sθ = θ.sin;
my \alpha = [ cψ×cϕ−cθ×sϕ×sψ, cψ×sϕ+cθ×cϕ×sψ, sψ×sθ;
−sψ×cϕ−cθ×sϕ×cψ, −sψ×sϕ+cθ×cϕ×cψ, cψ×sθ;
sθ×sϕ, −sθ×cϕ, cθ];
I'm not sure if using × helps or hurts in this case since I'm not really experienced in this area.These all work because Unicode defines ϕψθ as "Letter lowercase" say "ϕψθ".uniprops;
# (Ll Ll Ll)
---I would like to note that I used the Unicode "Minus Sign" "−" U+2212 so that it wouldn't complain about not being able to find a routine named "cϕ-cθ". (A space next to the "-" would have also sufficed.) |
|
Blech; looks like a letter and normalizes cross products. Better to use "·" (U+B7)[0]:
Minus sign is a nice-to-have, though.0: Also "∧" (U+2227, wedge), the real other vector product[1], but that doesn't matter for scalar multiplication.
1: http://en.wikipedia.org/wiki/Wedge_product