๐Ÿ“ฑ Erkannter Endgerättyp ๐Ÿ”‡ Sound ist aus. โ›ฑ๏ธ Tag und Nacht. Verbraucht keinen oder einen ๐Ÿช.
guest
Login ๐Ÿ—ƒ๏ธ Speicher- und Dateiverwaltung ๐Ÿช 1 Anzahl Ihrer gespeicherten Kekse, führt zur Keksdose

Geometric Algebra 4D

Addition STA Format eโ‚‚โ‚ƒ eโ‚ƒโ‚ eโ‚โ‚‚: It turns out in STA Heidelberg teaches to go eโ‚‚โ‚ƒ eโ‚ƒโ‚ eโ‚โ‚‚ BECAUSE you can then say "go around X,Y,Z and for 4D to X to W, Y to W, Z to W". Thats sane and i thus adapted to that. But i derived using eโ‚โ‚‚, eโ‚‚โ‚ƒ, eโ‚ƒโ‚, eโ‚ƒโ‚„, eโ‚โ‚„, eโ‚‚โ‚„ and swapped the code which is the same.

eโ‚‚โ‚ƒ     is orthogonal to    X           eโ‚โ‚„(!)
eโ‚ƒโ‚     is orthogonal to    Y           eโ‚‚โ‚„
eโ‚โ‚‚     is orthogonal to    Z           eโ‚ƒโ‚„

eโ‚‚โ‚ƒ eโ‚โ‚„ = eโ‚‚โ‚ƒโ‚โ‚„ = -eโ‚‚โ‚โ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚„ eโ‚ƒโ‚ eโ‚‚โ‚„ = eโ‚ƒโ‚โ‚‚โ‚„ = -eโ‚โ‚ƒโ‚‚โ‚„ = eโ‚โ‚‚โ‚ƒโ‚„ eโ‚โ‚‚ eโ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚„

all have ring 1-2-3-4-1...

eโ‚ โˆง eโ‚‚โ‚ƒโ‚„ = +eโ‚โ‚‚โ‚ƒโ‚„      0 swaps
eโ‚‚ โˆง eโ‚โ‚ƒโ‚„ = -eโ‚โ‚‚โ‚ƒโ‚„      1 swap
eโ‚ƒ โˆง eโ‚โ‚‚โ‚„ = +eโ‚โ‚‚โ‚ƒโ‚„      2 swaps
eโ‚„ โˆง eโ‚โ‚‚โ‚ƒ = -eโ‚โ‚‚โ‚ƒโ‚„      3 swaps

all good hypervolumes. These need to alternate similar to how a 2D face needs to be of alternating orientation at the face edges in 3D.

@TBH I THINK this has to do with all 8 cubes needing to be summed 0 volume. To be checked!!

Shorthand for RฬƒvR

Doing vR then Rฬƒ(vR) sounds tedious? It is!

v = vโ‚eโ‚ vโ‚‚eโ‚‚ vโ‚ƒeโ‚ƒ vโ‚„eโ‚„

B = R[1]eโ‚‚โ‚ƒ + R[2]eโ‚ƒโ‚ + R[3]eโ‚โ‚‚ + R[4]eโ‚โ‚„ + R[5]eโ‚‚โ‚„ + R[6]eโ‚ƒโ‚„

I = R[7]eโ‚โ‚‚โ‚ƒโ‚„

s = R[0]

RฬƒvR = (s - B + I) v (s + B + I)

Now you can group s + I to term lets say J

RฬƒvR = (J - B) v (J + B)

You can do that because in Addition you can shuffle around, you only need to consider commutativity in multiplication

Next move was new to me

RฬƒvR = (Jv - Bv) (J + B)

That's distributivity and to the left and its ok because we put the v AFTER those terms

Now lets expand that, then tackle one by one

RฬƒvR = JvJ + JvB - BvJ - BvB

JvJ

Jv = (s + I)v = sv + Iv

JvJ is thus (sv + Iv) * (s + I) and thats svs + svI + Ivs + IvI

as I anticommutes with vectors putting -vII makes that -vIยฒ

I stumbled here but you can see any odd and grade 4 will anticommute, even will commute if you do it on paper as an exercise. eโ‚ eโ‚โ‚‚โ‚ƒโ‚„ or eโ‚‚โ‚ƒ eโ‚โ‚‚โ‚ƒ or eโ‚ eโ‚โ‚‚โ‚ƒ or eโ‚โ‚‚ eโ‚‚โ‚ƒ

so

svs + svI + Ivs - vIยฒ

s is a scalar so we can do svI + sIv then svI - svI

leaves sยฒv - vIยฒ which can be distributed to (sยฒ - Iยฒ)v

JvB - BvJ

A mathmatician will see this can be done together as 3 terms are the same so lets do them in one go

JvB - BvJ

    = (s + I)vB - Bv(s + I)

expand

    = svB + IvB - Bvs - BvI

we now want s and I grouped out. Remember s commutes with anything and I and B are both even graded so they commute with each other and s ofc. But v is grade 1 so moving it will flip signs of B or I

So you reorder first and in case you did not know, over addition the terms always commute

    = svB - Bvs + IvB - BvI

    // remember v is grade one and B and I will commute so -BvI = BIv = IBv

    = s(vB - Bv) + I(vB + Bv)

GA Identities

I will admit i know nothing much about all of these tricks but still do all by hand. So i got hinted now these include the standard GA identities:

    vB - Bv = 2(v ยท B)
    vB + Bv = 2(v โˆง B)

So far I can tell from Doran Chapter 2 you can do two vectors(! grade 1 !) a and b like

ba = b ยท a + b โˆง a = a ยท b - a โˆง b

so now when you do ab + ba you get twice the dot product but due to anticommutivity of the wedge the wedge will cancel out

ab + ba = 2 a ยท b !

and for ab - ba now your dot product comes to 0 while the wedge will double (as its - - so +)

ab - ba = 2 a โˆง b

Wedge โˆง

But we dont deal with grade 1 vectors here where eโ‚ and eโ‚‚ etc would anticommute. B and v are grade 2 and 1 though so when you have v and B now

vB = v ยท B + v โˆง B

when you reorder these to Bv the sign of the wedge product will not change. eโ‚ƒ โˆง eโ‚โ‚‚ and eโ‚โ‚‚ โˆง eโ‚ƒ are the same!

eโ‚ eโ‚‚โ‚ƒ = eโ‚โ‚‚โ‚ƒ

eโ‚‚โ‚ƒ eโ‚ = eโ‚‚โ‚ƒโ‚ = -eโ‚‚โ‚โ‚ƒ = eโ‚โ‚‚โ‚ƒ

Dot ยท

However ... the dot product will now sign flip and cancel out :D Why? See that a plane and a vector will not dot like 2 vectors

v ยท B = eโ‚ ยท (eโ‚ โˆง eโ‚‚)

The reason is not explained in Hollmeier and noted its the "hodge adjoint"

but it turns out you can derive the hack of "bringing the same basis close at the paranthesis" with known geometric product rules:

Because the dot product is defined to LOWER any geometric product by the amount these 2 differ in their grade

Aแตฃ ยท Bโ‚› = โŸจAแตฃBโ‚›โŸฉ(|r-s|)

Imagine B ยท v

B ยท v = (eโ‚ eโ‚‚) ยท eโ‚

when you dot two vectors you want to measure how much they overlap and 2 orthogonal bases eโ‚˜ eโ‚™ will always be 0 and the same eโ‚™ยฒ is 1 in our 4D Cl(4,0). But that's just telling you how much eโ‚™ overlaps with eโ‚˜. When you want to know how much a line eโ‚™ overlaps with an area/plane eโ‚˜โ‚™ you will get back the other line that makes that area. But direction matters now. Because (eโ‚ eโ‚‚) ยท eโ‚ leaves you -eโ‚‚ and eโ‚ ยท (eโ‚ eโ‚‚) leaves you eโ‚‚!

When you know or think about or test some

Aแตฃ ยท Bโ‚› = โŸจAแตฃBโ‚›โŸฉ(|r-s|)

you will understand that and how this works.

e3 ยท eโ‚ โˆง eโ‚‚

thats just eโ‚ƒ (eโ‚eโ‚‚) and we want all grade 1 parts. what are they?

e3 ยท e1 ยท e2 thats a scalar and its 0. none overlap!

e3 โˆง eโ‚ โˆง eโ‚‚ = eโ‚ โˆง eโ‚‚ โˆง eโ‚ƒ

problem is ... these are only grade 0 and 3 - so the result is zero.

eโ‚‚โ‚ ยท (eโ‚โ‚‚โ‚ƒ)

that is

eโ‚‚โ‚โ‚โ‚‚โ‚ƒ so thats just eโ‚ƒ left you can spare the rest

leaves

eโ‚‚โ‚ ยท (eโ‚โ‚‚โ‚ƒ) = eโ‚ƒ

try the other way

eโ‚โ‚‚ ยท (eโ‚โ‚‚โ‚ƒ) = eโ‚โ‚‚โ‚โ‚‚โ‚ƒ = -eโ‚ƒ

another very simple example

eโ‚ ยท (eโ‚‚ โˆง eโ‚) = โŸจeโ‚โ‚‚โ‚ = -eโ‚‚โ‚โ‚ = -eโ‚‚โŸฉ(1) = -eโ‚‚

back to RฬƒvR = JvJ + JvB - BvJ - BvB part JvB - BvJ

vB - Bv = 2(v ยท B)
vB + Bv = 2(v โˆง B)

so to prove this is correct lets see for vB + Bv

vB = v ยท B + v โˆง B
Bv = B ยท v + B โˆง v

we know the wedges commute as these are known grade 2 bivectors and v is grade 1

f.e. eโ‚ โˆง eโ‚‚โ‚ƒ and eโ‚‚โ‚ƒ โˆง eโ‚ seem eโ‚โ‚‚โ‚ƒ and eโ‚‚โ‚ƒโ‚ thats 2 swaps. They commute

and the dot products give

v ยท B that will be some grade 1 vector left

B ยท v that will be the same grade 1 but negated

so it makes sense we get that twice on vB - Bv and none on vB + Bv

and as B โˆง v == v โˆง B it makes sense they go twice on vB + Bv and 0 on vB - Bv

JvB - BvJ == s(vB - Bv) + I(vB + Bv)

so we are at

(sยฒ - Iยฒ)v + (s(vB - Bv) + I(vB + Bv)) - BvB

-BvB

Ok so as departure is getting closer ill short this one a bit

we know

vB - Bv = 2(v ยท B)

so

vB = 2(v ยท B) + Bv
  • 2(v ยท B)

    vB - 2(v ยท B) = Bv

flip

Bv = vB - 2(v ยท B)

Now add B to the right

BvB = vBยฒ - 2(v ยท B)B

Minus

-BvB = - vBยฒ + 2(v ยท B) B

-BvB = 2(v ยท B)B - vBยฒ

(sยฒ - Iยฒ)v + s(vB - Bv) + I(vB + Bv) + 2(v ยท B)B - vBยฒ

(sยฒ - Iยฒ)v  + s(vB - Bv) + I(vB + Bv) + 2(v ยท B)B  - vBยฒ

puh

Remember

vB - Bv = 2(v ยท B)
vB + Bv = 2(v โˆง B)

So

(sยฒ - Iยฒ)v  + 2s(v ยท B) + 2I(v โˆง B) + 2(v ยท B)B  - vBยฒ

2(v ยท B)B - vBยฒ === -BvB

  • 2(v ยท B)B will give 1-vectors (v ยท B) but with โˆง B also when eโ‚™ โˆง eโ‚˜โ‚ is lin. independent a trivector

    • Grade 1: (v ยท B) ยท B
    • Grade 3: (v ยท B) โˆง B

Now this trivector will cancel out with whatever comes from vBยฒ

- Bยฒ has 6 quadvectors in its results. eโ‚โ‚‚ * eโ‚‚โ‚ƒ = eโ‚โ‚ƒ but eโ‚โ‚‚ * eโ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚„

- (Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) + 2(Bโ‚โ‚‚Bโ‚ƒโ‚„ + Bโ‚‚โ‚ƒBโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚„)I

when you multiply this with a vector this will return trivectors

Trivectors from 2(v ยท B)B

(v ยท B)

(vโ‚eโ‚ + vโ‚‚eโ‚‚ + vโ‚ƒeโ‚ƒ + vโ‚„eโ‚„) ยท (Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ + Bโ‚ƒโ‚eโ‚ƒโ‚ + Bโ‚โ‚‚eโ‚โ‚‚ + Bโ‚โ‚„eโ‚โ‚„ + Bโ‚‚โ‚„eโ‚‚โ‚„ + Bโ‚ƒโ‚„eโ‚ƒโ‚„)

=

    vโ‚(0 - Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚‚eโ‚‚ + Bโ‚โ‚„eโ‚„ + 0 + 0) +
    vโ‚‚(Bโ‚‚โ‚ƒeโ‚ƒ + 0 - Bโ‚โ‚‚eโ‚ + 0 + Bโ‚‚โ‚„eโ‚„ + 0) +
    vโ‚ƒ(-Bโ‚‚โ‚ƒeโ‚‚ + Bโ‚ƒโ‚eโ‚ + 0 + 0 + 0 + Bโ‚ƒโ‚„eโ‚„) +
    vโ‚„(0 + 0 + 0 - Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„eโ‚‚ - Bโ‚ƒโ‚„eโ‚ƒ) +

--------------

=   vโ‚(-Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚‚eโ‚‚ + Bโ‚โ‚„eโ‚„)
    vโ‚‚(+Bโ‚‚โ‚ƒeโ‚ƒ - Bโ‚โ‚‚eโ‚ + Bโ‚‚โ‚„eโ‚„)
    vโ‚ƒ(-Bโ‚‚โ‚ƒeโ‚‚ + Bโ‚ƒโ‚eโ‚ + Bโ‚ƒโ‚„eโ‚„)
    vโ‚„(-Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„eโ‚‚ - Bโ‚ƒโ‚„eโ‚ƒ)

(v ยท B)B

(all the v ยท B) (Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ + Bโ‚ƒโ‚eโ‚ƒโ‚ + Bโ‚โ‚‚eโ‚โ‚‚ + Bโ‚โ‚„eโ‚โ‚„ + Bโ‚‚โ‚„eโ‚‚โ‚„ + Bโ‚ƒโ‚„eโ‚ƒโ‚„)

Dot grade 1:

=   vโ‚( Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ + 0 + 0 + 0 - Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„ +
        Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ + 0 - Bโ‚โ‚‚ยฒeโ‚ + 0 + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„ + 0 +
        0 + 0 + 0 - Bโ‚โ‚„ยฒeโ‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ
    ) +
    vโ‚‚(-Bโ‚‚โ‚ƒยฒeโ‚‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚eโ‚ + 0 + 0 + 0 + Bโ‚‚โ‚ƒBโ‚ƒโ‚„eโ‚„ +
        0 + Bโ‚โ‚‚Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚‚ยฒeโ‚‚ - Bโ‚โ‚‚Bโ‚โ‚„eโ‚„ + 0 + 0 +
        0 + 0 + 0 - Bโ‚‚โ‚„Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„ยฒeโ‚‚ - Bโ‚‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ
    ) +
    vโ‚ƒ(-Bโ‚‚โ‚ƒยฒeโ‚ƒ + 0 + Bโ‚‚โ‚ƒBโ‚โ‚‚eโ‚ + 0 - Bโ‚‚โ‚ƒBโ‚‚โ‚„eโ‚„ + 0 +
        0 - Bโ‚ƒโ‚ยฒeโ‚ƒ + Bโ‚ƒโ‚Bโ‚โ‚‚eโ‚‚ + Bโ‚ƒโ‚Bโ‚โ‚„eโ‚„ + 0 + 0 +
        0 + 0 + 0 - Bโ‚ƒโ‚„Bโ‚โ‚„eโ‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„eโ‚‚ - Bโ‚ƒโ‚„ยฒeโ‚ƒ
    ) +
    vโ‚„( 0 + Bโ‚โ‚„Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚„Bโ‚โ‚‚eโ‚‚ - Bโ‚โ‚„ยฒeโ‚„ + 0 + 0
       -Bโ‚‚โ‚„Bโ‚‚โ‚ƒeโ‚ƒ + 0 + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚ + 0 - Bโ‚‚โ‚„ยฒeโ‚„ + 0
        Bโ‚ƒโ‚„Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚„Bโ‚ƒโ‚eโ‚ + 0 + 0 + 0 - Bโ‚ƒโ‚„ยฒeโ‚„
    )

=   vโ‚(+ Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ - Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„
       + Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ - Bโ‚โ‚‚ยฒeโ‚ + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„
       - Bโ‚โ‚„ยฒeโ‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ
    ) +
    vโ‚‚(- Bโ‚‚โ‚ƒยฒeโ‚‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚eโ‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„eโ‚„
       + Bโ‚โ‚‚Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚‚ยฒeโ‚‚ - Bโ‚โ‚‚Bโ‚โ‚„eโ‚„
       - Bโ‚‚โ‚„Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„ยฒeโ‚‚ - Bโ‚‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ
    ) +
    vโ‚ƒ(- Bโ‚‚โ‚ƒยฒeโ‚ƒ + Bโ‚‚โ‚ƒBโ‚โ‚‚eโ‚ - Bโ‚‚โ‚ƒBโ‚‚โ‚„eโ‚„
       - Bโ‚ƒโ‚ยฒeโ‚ƒ + Bโ‚ƒโ‚Bโ‚โ‚‚eโ‚‚ + Bโ‚ƒโ‚Bโ‚โ‚„eโ‚„
       - Bโ‚ƒโ‚„Bโ‚โ‚„eโ‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„eโ‚‚ - Bโ‚ƒโ‚„ยฒeโ‚ƒ
    ) +
    vโ‚„(+ Bโ‚โ‚„Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚„Bโ‚โ‚‚eโ‚‚ - Bโ‚โ‚„ยฒeโ‚„
       - Bโ‚‚โ‚„Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚ - Bโ‚‚โ‚„ยฒeโ‚„
       + Bโ‚ƒโ‚„Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚„Bโ‚ƒโ‚eโ‚ - Bโ‚ƒโ‚„ยฒeโ‚„
    )

Wedge grade 3 - there are only grade 3 here as sharing an axis in a wedge is an immediate 0

=   vโ‚( 0 + 0 - Bโ‚ƒโ‚Bโ‚โ‚‚eโ‚โ‚‚โ‚ƒ + Bโ‚ƒโ‚Bโ‚โ‚„eโ‚โ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚„eโ‚‚โ‚ƒโ‚„ + 0 +
        0 + Bโ‚โ‚‚Bโ‚ƒโ‚eโ‚โ‚‚โ‚ƒ + 0 - Bโ‚โ‚‚Bโ‚โ‚„eโ‚โ‚‚โ‚„ + 0 + Bโ‚โ‚‚Bโ‚ƒโ‚„eโ‚‚โ‚ƒโ‚„ +
        Bโ‚โ‚„Bโ‚‚โ‚ƒeโ‚‚โ‚ƒโ‚„ - Bโ‚โ‚„Bโ‚ƒโ‚eโ‚โ‚ƒโ‚„ + Bโ‚โ‚„Bโ‚โ‚‚eโ‚โ‚‚โ‚„ + 0 + 0 + 0
    ) +
    vโ‚‚( 0 + 0 + Bโ‚‚โ‚ƒBโ‚โ‚‚eโ‚โ‚‚โ‚ƒ - Bโ‚‚โ‚ƒBโ‚โ‚„eโ‚โ‚ƒโ‚„ - Bโ‚‚โ‚ƒBโ‚‚โ‚„eโ‚‚โ‚ƒโ‚„ + 0 +
       -Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚โ‚‚โ‚ƒ + 0 + 0 + 0 - Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚โ‚‚โ‚„ - Bโ‚โ‚‚Bโ‚ƒโ‚„eโ‚โ‚ƒโ‚„ +
        Bโ‚‚โ‚„Bโ‚‚โ‚ƒeโ‚‚โ‚ƒโ‚„ - Bโ‚‚โ‚„Bโ‚ƒโ‚eโ‚โ‚ƒโ‚„ + Bโ‚‚โ‚„Bโ‚โ‚‚eโ‚โ‚‚โ‚„ + 0 + 0 + 0
    ) + 
    vโ‚ƒ( 0 - Bโ‚‚โ‚ƒBโ‚ƒโ‚eโ‚โ‚‚โ‚ƒ + 0 + Bโ‚‚โ‚ƒBโ‚โ‚„eโ‚โ‚‚โ‚„ + 0 - Bโ‚‚โ‚ƒBโ‚ƒโ‚„eโ‚‚โ‚ƒโ‚„ +
        Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚โ‚‚โ‚ƒ + 0 + 0 + 0 + Bโ‚ƒโ‚Bโ‚‚โ‚„eโ‚โ‚‚โ‚„ + Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚โ‚ƒโ‚„ +
        Bโ‚ƒโ‚„Bโ‚‚โ‚ƒeโ‚‚โ‚ƒโ‚„ - Bโ‚ƒโ‚„Bโ‚ƒโ‚eโ‚โ‚ƒโ‚„ + Bโ‚ƒโ‚„Bโ‚โ‚‚eโ‚โ‚‚โ‚„ + 0 + 0 + 0
    ) +
    vโ‚„(-Bโ‚โ‚„Bโ‚‚โ‚ƒeโ‚โ‚‚โ‚ƒ + 0 + 0 + 0 - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚โ‚‚โ‚„ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚โ‚ƒโ‚„ +
        0 - Bโ‚‚โ‚„Bโ‚ƒโ‚eโ‚โ‚‚โ‚ƒ + 0 + Bโ‚‚โ‚„Bโ‚โ‚„eโ‚โ‚‚โ‚„ + 0 - Bโ‚‚โ‚„Bโ‚ƒโ‚„eโ‚‚โ‚ƒโ‚„ +
        0 + 0 - Bโ‚ƒโ‚„Bโ‚โ‚‚eโ‚โ‚‚โ‚ƒ + Bโ‚ƒโ‚„Bโ‚โ‚„eโ‚โ‚ƒโ‚„ + Bโ‚ƒโ‚„Bโ‚‚โ‚„eโ‚‚โ‚ƒโ‚„ + 0
    )

=   vโ‚(+Bโ‚ƒโ‚Bโ‚‚โ‚„eโ‚‚โ‚ƒโ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚„eโ‚‚โ‚ƒโ‚„ + Bโ‚โ‚„Bโ‚‚โ‚ƒeโ‚‚โ‚ƒโ‚„) +
    vโ‚‚(-Bโ‚‚โ‚ƒBโ‚โ‚„eโ‚โ‚ƒโ‚„ - Bโ‚โ‚‚Bโ‚ƒโ‚„eโ‚โ‚ƒโ‚„ - Bโ‚‚โ‚„Bโ‚ƒโ‚eโ‚โ‚ƒโ‚„) + 
    vโ‚ƒ(+Bโ‚‚โ‚ƒBโ‚โ‚„eโ‚โ‚‚โ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚„eโ‚โ‚‚โ‚„ + Bโ‚ƒโ‚„Bโ‚โ‚‚eโ‚โ‚‚โ‚„) +
    vโ‚„(-Bโ‚โ‚„Bโ‚‚โ‚ƒeโ‚โ‚‚โ‚ƒ - Bโ‚‚โ‚„Bโ‚ƒโ‚eโ‚โ‚‚โ‚ƒ - Bโ‚ƒโ‚„Bโ‚โ‚‚eโ‚โ‚‚โ‚ƒ)

So now as you can see these trivectors all share the same 3 factors Bโ‚โ‚‚Bโ‚ƒโ‚„, Bโ‚‚โ‚ƒBโ‚โ‚„, Bโ‚ƒโ‚Bโ‚‚โ‚„ so we can just call these like F

vโ‚(+F eโ‚‚โ‚ƒโ‚„)
vโ‚‚(-F eโ‚โ‚ƒโ‚„)
vโ‚ƒ(+F eโ‚โ‚‚โ‚„)
vโ‚„(-F eโ‚โ‚‚โ‚ƒ)

and as we need to know 2(v ยท B) โˆง B multiply by 2:

2 vโ‚(+F eโ‚‚โ‚ƒโ‚„)
2 vโ‚‚(-F eโ‚โ‚ƒโ‚„)
2 vโ‚ƒ(+F eโ‚โ‚‚โ‚„)
2 vโ‚„(-F eโ‚โ‚‚โ‚ƒ)

Trivectors from vBยฒ

(vโ‚eโ‚ + vโ‚‚eโ‚‚ + vโ‚ƒeโ‚ƒ + vโ‚„eโ‚„) * ((Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) + 2(Bโ‚โ‚‚Bโ‚ƒโ‚„ + Bโ‚‚โ‚ƒBโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚„)eโ‚โ‚‚โ‚ƒโ‚„)

we can ignore all the grade 0 components like Bโ‚โ‚‚ยฒ for now they are just vโ‚Bโ‚โ‚‚ยฒeโ‚ etc. all grade 1

(vโ‚eโ‚ + vโ‚‚eโ‚‚ + vโ‚ƒeโ‚ƒ + vโ‚„eโ‚„) * (2 Bโ‚โ‚‚Bโ‚ƒโ‚„ eโ‚โ‚‚โ‚ƒโ‚„ + 2 Bโ‚‚โ‚ƒBโ‚โ‚„ eโ‚โ‚‚โ‚ƒโ‚„ + 2 Bโ‚ƒโ‚Bโ‚‚โ‚„ eโ‚โ‚‚โ‚ƒโ‚„)

now that's rather easy as you know a wedge is immediately 0 when an axis is shared so these are all wedged to 0

Dot is left to get grade 3 trivectors

(vโ‚eโ‚ + vโ‚‚eโ‚‚ + vโ‚ƒeโ‚ƒ + vโ‚„eโ‚„) ยท (2 Bโ‚โ‚‚Bโ‚ƒโ‚„ eโ‚โ‚‚โ‚ƒโ‚„ + 2 Bโ‚‚โ‚ƒBโ‚โ‚„ eโ‚โ‚‚โ‚ƒโ‚„ + 2 Bโ‚ƒโ‚Bโ‚‚โ‚„ eโ‚โ‚‚โ‚ƒโ‚„)

= 
    vโ‚(2 Bโ‚โ‚‚Bโ‚ƒโ‚„ eโ‚‚โ‚ƒโ‚„ + 2 Bโ‚โ‚‚Bโ‚โ‚„ eโ‚‚โ‚ƒโ‚„ + 2 Bโ‚ƒโ‚Bโ‚‚โ‚„ eโ‚‚โ‚ƒโ‚„) +
    vโ‚‚(-2 Bโ‚โ‚‚Bโ‚ƒโ‚„ eโ‚โ‚ƒโ‚„ - 2 Bโ‚‚โ‚ƒBโ‚โ‚„ eโ‚โ‚ƒโ‚„ - 2 Bโ‚ƒโ‚Bโ‚‚โ‚„ eโ‚โ‚ƒโ‚„) +
    vโ‚ƒ(2 Bโ‚โ‚‚Bโ‚ƒโ‚„ eโ‚โ‚‚โ‚„ + 2 Bโ‚‚โ‚ƒBโ‚โ‚„ eโ‚โ‚‚โ‚„ + 2 Bโ‚ƒโ‚Bโ‚‚โ‚„ eโ‚โ‚‚โ‚„) +
    vโ‚„(-2 Bโ‚โ‚‚Bโ‚ƒโ‚„ eโ‚โ‚‚โ‚ƒ - 2 Bโ‚‚โ‚ƒBโ‚โ‚„ eโ‚โ‚‚โ‚ƒ - 2 Bโ‚ƒโ‚Bโ‚‚โ‚„ eโ‚โ‚‚โ‚ƒ)

now that wasnt hard, its just 0,1,2,3 swaps.

cleanup with the same F = Bโ‚โ‚‚Bโ‚ƒโ‚„, Bโ‚‚โ‚ƒBโ‚โ‚„, Bโ‚ƒโ‚Bโ‚‚โ‚„

= 
    2 vโ‚(+F eโ‚‚โ‚ƒโ‚„) +
    2 vโ‚‚(-F eโ‚โ‚ƒโ‚„) +
    2 vโ‚ƒ(+F eโ‚โ‚‚โ‚„) +
    2 vโ‚„(-F eโ‚โ‚‚โ‚ƒ)

Tadaaaa................ they all cancel out!

So the quadvector from Bยฒ will cancel out by going to trivectors with v while the trivectors that cancel these come from wedging grade 1 with grade 2 so trivectors again in the first part 2(v ยท B)B

Means -BvB will always be a vector / grade 1 so we could do either

โŸจ-BvBโŸฉโ‚ = โŸจ2(v ยท B)BโŸฉโ‚ - vโŸจBยฒโŸฉโ‚€

This means take only grade 1 (from 1 + 3) then minus vector * grade 0 (vector again grade 1) from grade 1 + 3

=> leaves only grade 1 vector part

also correct is to use ยท not ร— as this will only return ther grade 1 dot product (see above)

โŸจ-BvBโŸฉโ‚ = (2(v ยท B) ยท B) - vโŸจBยฒโŸฉโ‚€

Bonus Level for -BvB

Now ofc you may not like the pain of tracking all trivectors. So why do they disappear?

We know that a rotor reversed will flip all planes. So when

R = s + B + I

Rฬƒ = s - B + I

Similar each multivector in general will have rules in which grade a sign flips:

Grade 0 reversed is Grade 0
Grade 1 reversed is Grade 1
Grade 2 reversed is -Grade 2 because you need to swap once

    eโ‚eโ‚‚ = -eโ‚‚eโ‚

Grade 3 reversed is -Grade 3 because it takes 3 swaps

    eโ‚eโ‚‚eโ‚ƒ = -eโ‚‚eโ‚eโ‚ƒ = eโ‚‚eโ‚ƒeโ‚ = -eโ‚ƒeโ‚‚eโ‚ !

Grade 4 reversed is Grade 4 because it takes 6 swaps

            1        2       3        4       5        6
    eโ‚โ‚‚โ‚ƒโ‚„ = -eโ‚โ‚‚โ‚„โ‚ƒ = eโ‚โ‚„โ‚‚โ‚ƒ = -eโ‚„โ‚โ‚‚โ‚ƒ = eโ‚„โ‚โ‚ƒโ‚‚ = -eโ‚„โ‚ƒโ‚โ‚‚ = eโ‚„โ‚ƒโ‚‚โ‚

General Rule: (-1) ^ (k (k-1)) / 2 (this works as oddeven is always even)

For B this means Bฬƒ = -B because they are all grade 2!

Now to check whether this sandwich would change under reversion

BvB = (BvB)~ ?

(BvB)~ = Bฬƒ vฬƒ Bฬƒ

(BvB)~ = (-1)B (+1)v (-1)B

Thus you get -1ยฒ and 1 which are scalars and commute:

(BvB)~ = (-1)(+1)(-1) BvB = BvB

Tadaa

Because this means we can reverse the whole sandwich, parting it into its grades will hold reversion too:

(BvB)~ = (โŸจBvBโŸฉโ‚ + โŸจBvBโŸฉโ‚ƒ)~

Remember grade 1 is 1 reversed, but grade 3 is -1 reversed

(BvB)~ = โŸจBvBโŸฉโ‚~ + โŸจBvBโŸฉโ‚ƒ~

so

โŸจBvBโŸฉโ‚~ = โŸจBvBโŸฉโ‚
โŸจBvBโŸฉโ‚ƒ~ = - โŸจBvBโŸฉโ‚ƒ

Now we already showed BvB == (BvB)~ !!

thus

BvB = (BvB)~

can be replaced with โŸจBvBโŸฉโ‚ + โŸจBvBโŸฉโ‚ƒ and โŸจBvBโŸฉโ‚~ + โŸจBvBโŸฉโ‚ƒ~

and we know

โŸจBvBโŸฉโ‚~ + โŸจBvBโŸฉโ‚ƒ~ = โŸจBvBโŸฉโ‚ - โŸจBvBโŸฉโ‚ƒ

So hold on to your seat because that means

โŸจBvBโŸฉโ‚ + โŸจBvBโŸฉโ‚ƒ = โŸจBvBโŸฉโ‚ - โŸจBvBโŸฉโ‚ƒ

you can already see it but for completeness

subtract โŸจBvBโŸฉโ‚

โŸจBvBโŸฉโ‚ƒ = - โŸจBvBโŸฉโ‚ƒ

add โŸจBvBโŸฉโ‚ƒ

2 โŸจBvBโŸฉโ‚ƒ = 0

The only solution is to make โŸจBvBโŸฉโ‚ƒ == 0

- vBยฒ

Caution here. when you square B that will always introduce a minus as all planes square to -1 and we only want the scalar parts then.

(Just means instead of (Bโ‚‚โ‚ƒยฒ - Bโ‚ƒโ‚ยฒ - Bโ‚โ‚‚ยฒ - Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ - Bโ‚ƒโ‚„ยฒ) we go -(... + ... + ...))

So

- vโŸจBยฒโŸฉโ‚€ == -v (- |B|ยฒ) == |B|ยฒv

you cannot do that in STA though as Bยฒ there is a mix of plus and minus planes. Which is why i will stay with โŸจBยฒโŸฉโ‚€

As we later want to know the planes we can

(sยฒ - Iยฒ)v - vBยฒ == v(sยฒ - Iยฒ - โŸจBยฒโŸฉโ‚€)

Bยฒ is thus -(Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) + 2(Bโ‚‚โ‚ƒBโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚„)I (grade 4) + all other mixed terms cancel out

- Pairs sharing an axis anticommute and cancel (eโ‚โ‚‚eโ‚‚โ‚ƒ + eโ‚‚โ‚ƒeโ‚โ‚‚ = 0)
- orthogonal pairs commute and form the quadvector (2(Bโ‚‚โ‚ƒBโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚„)I)

For more fun on this part see the GA STA Doc in 705-GA-STA

Some do

From the formula to the algo

Ok so have this now as a usable vector multiplication function Rotor4.rotateVector4(v)

Easy parts

s = R[0]

p = R[7]

Bivector parts

Bโ‚โ‚‚ = R[1]
Bโ‚‚โ‚ƒ = R[2]
Bโ‚ƒโ‚ = R[3]
Bโ‚ƒโ‚„ = R[4]
Bโ‚โ‚„ = R[5]
Bโ‚‚โ‚„ = R[6]

Squares makes it easier and faster

s_2  = sยฒ
xy_2 = Bโ‚โ‚‚ยฒ
yz_2 = Bโ‚‚โ‚ƒยฒ
zx_2 = Bโ‚ƒโ‚ยฒ
zw_2 = Bโ‚ƒโ‚„ยฒ
xw_2 = Bโ‚โ‚„ยฒ
yw_2 = Bโ‚‚โ‚„ยฒ
p_2  = Iยฒ

v = eโ‚

We set v = eโ‚, start on v(sยฒ - Iยฒ - โŸจBยฒโŸฉโ‚€)

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚ 
    + ...

dot all bivectors with eโ‚ for 2s(v ยท B). gives

eโ‚ ยท Bโ‚โ‚‚eโ‚โ‚‚ = +Bโ‚โ‚‚eโ‚‚
eโ‚ ยท Bโ‚ƒโ‚eโ‚ƒโ‚ = -Bโ‚ƒโ‚eโ‚ƒ
eโ‚ ยท Bโ‚โ‚„eโ‚โ‚„ = +Bโ‚โ‚„eโ‚„

The other 3 bivectors/planes have no eโ‚ in them, thus will be 0

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚ 
    + 2 * s * (Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚„eโ‚„)
    + ...

wedge all bivectors with eโ‚ for 2I(v โˆง B) AND multiplying by I from the left !! gives

eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚ โˆง Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ) = eโ‚โ‚‚โ‚ƒโ‚„ * Bโ‚‚โ‚ƒeโ‚โ‚‚โ‚ƒ = Bโ‚‚โ‚ƒ eโ‚โ‚‚โ‚ƒโ‚„โ‚โ‚‚โ‚ƒ = -eโ‚โ‚‚โ‚ƒโ‚โ‚„โ‚‚โ‚ƒ = eโ‚โ‚‚โ‚โ‚ƒโ‚„โ‚‚โ‚ƒ = -eโ‚‚โ‚ƒโ‚„โ‚‚โ‚ƒ = eโ‚‚โ‚ƒโ‚„โ‚ƒโ‚‚ = -eโ‚‚โ‚„โ‚‚ =          Bโ‚‚โ‚ƒeโ‚„
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚ โˆง Bโ‚‚โ‚„eโ‚‚โ‚„) = eโ‚โ‚‚โ‚ƒโ‚„ * Bโ‚‚โ‚„eโ‚โ‚‚โ‚„ = Bโ‚‚โ‚„ eโ‚โ‚‚โ‚ƒโ‚„โ‚โ‚‚โ‚„ = -eโ‚โ‚‚โ‚ƒโ‚โ‚„โ‚‚โ‚„ = eโ‚โ‚‚โ‚ƒโ‚โ‚‚ = -eโ‚โ‚‚โ‚ƒโ‚‚โ‚ = eโ‚โ‚ƒโ‚ =                     -Bโ‚‚โ‚„eโ‚ƒ
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚ โˆง Bโ‚ƒโ‚„eโ‚ƒโ‚„) = eโ‚โ‚‚โ‚ƒโ‚„ * Bโ‚ƒโ‚„eโ‚โ‚ƒโ‚„ = Bโ‚ƒโ‚„ eโ‚โ‚‚โ‚ƒโ‚„โ‚โ‚ƒโ‚„ = -eโ‚โ‚‚โ‚ƒโ‚โ‚„โ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚โ‚ƒ = -eโ‚โ‚‚โ‚ =                               Bโ‚ƒโ‚„eโ‚‚

We still need to multiply by the pseudoscalars scalar component which ill just use p so you know its p times I

The other 3 planes/bivectors have eโ‚ in them, thus the wedge will be 0.

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚ 
    + 2 * s * (Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚„eโ‚„)
    + 2 * p * (Bโ‚‚โ‚ƒeโ‚„ - Bโ‚‚โ‚„eโ‚ƒ + Bโ‚ƒโ‚„eโ‚‚)
    + ...

Last term is 2(v ยท B) ยท B

We already know v ยท B is Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚„eโ‚„

Now this is a vector and we know its components eโ‚‚ eโ‚ƒ eโ‚„ will have dot 0 with all planes that are not that basis vector

another dot of this vector with B gives

(Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚„eโ‚„) ยท (Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ + Bโ‚ƒโ‚eโ‚ƒโ‚ + Bโ‚โ‚‚eโ‚โ‚‚ + Bโ‚โ‚„eโ‚โ‚„ + Bโ‚‚โ‚„eโ‚‚โ‚„ + Bโ‚ƒโ‚„eโ‚ƒโ‚„)

= -Bโ‚โ‚‚ยฒeโ‚ + Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ + 0 + 0 + 0 + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„
+ 0 + Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ -Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„ - 0 - 0
+ 0 + 0 + 0 - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚โ‚„ยฒeโ‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚

= -Bโ‚โ‚‚ยฒeโ‚ + Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ -Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚โ‚„ยฒeโ‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚

Now don't forget it's 2(v ยท B) ยท B so 2 *

    2 * (-Bโ‚โ‚‚ยฒeโ‚ + Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ -Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚โ‚„ยฒeโ‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚)

Almost there

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚ 
    + 2 * s * (Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚eโ‚ƒ + Bโ‚โ‚„eโ‚„)
    + 2 * p * (Bโ‚‚โ‚ƒeโ‚„ - Bโ‚‚โ‚„eโ‚ƒ + Bโ‚ƒโ‚„eโ‚‚)
    + 2 * (-Bโ‚โ‚‚ยฒeโ‚ + Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ -Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚โ‚„ยฒeโ‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚)

This would already work ... but we can simplify this ofc

eโ‚ Parts

    (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚
    2 * (-Bโ‚โ‚‚ยฒeโ‚ - Bโ‚ƒโ‚ยฒeโ‚ - Bโ‚โ‚„ยฒeโ‚)

    = (sยฒ - pยฒ - Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ - Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ - Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) eโ‚

eโ‚‚ Parts

    2 * s * Bโ‚โ‚‚eโ‚‚
    2 * p * Bโ‚ƒโ‚„eโ‚‚
    2 * (Bโ‚ƒโ‚Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚โ‚„Bโ‚‚โ‚„eโ‚‚)

    = 2 * (s * Bโ‚โ‚‚ + p * Bโ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚‚โ‚„) eโ‚‚

eโ‚ƒ Parts

    2 * s * -Bโ‚ƒโ‚eโ‚ƒ
    2 * p * -Bโ‚‚โ‚„eโ‚ƒ
    2 * (Bโ‚โ‚‚Bโ‚‚โ‚ƒeโ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ)

    = 2 * (s * -Bโ‚ƒโ‚ + p * -Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„) eโ‚ƒ

eโ‚„ Parts

    2 * s * Bโ‚โ‚„eโ‚„
    2 * p * Bโ‚‚โ‚ƒeโ‚„
    2 * (Bโ‚โ‚‚Bโ‚‚โ‚„eโ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„eโ‚„)

    = 2 (s * Bโ‚โ‚„ + p * Bโ‚‚โ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„) eโ‚„

not bad!

Full v = eโ‚

= (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚
+ 2 * (s * Bโ‚โ‚‚ + p * Bโ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚‚โ‚„) eโ‚‚
+ 2 * (s * -Bโ‚ƒโ‚ + p * -Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„) eโ‚ƒ
+ 2 (s * Bโ‚โ‚„ + p * Bโ‚‚โ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„) eโ‚„

Ok so now i have to admit thats actually only the COLUMNS so this is not part vโ‚‚, vโ‚ƒ, etc. but actually go there so that's one part of each!

v'โ‚ = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) * vโ‚ + ... vโ‚‚ + ... vโ‚ƒ + ... vโ‚„
v'โ‚‚ = 2 * (s * Bโ‚โ‚‚ + p * Bโ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚‚โ‚„) * vโ‚ + ... vโ‚‚ + ... vโ‚ƒ + ... vโ‚„
v'โ‚ƒ = 2 * (s * -Bโ‚ƒโ‚ + p * -Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„) * vโ‚ + ... vโ‚‚ + ... vโ‚ƒ + ... vโ‚„
v'โ‚„ = 2 (s * Bโ‚โ‚„ + p * Bโ‚‚โ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„) * vโ‚ + ... vโ‚‚ + ... vโ‚ƒ + ... vโ‚„

v = eโ‚‚

v(sยฒ - Iยฒ + Bยฒ)

v'  = (sยฒ - pยฒ + Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) eโ‚‚
    + ...

2s(v ยท B)

eโ‚‚ ยท Bโ‚โ‚‚eโ‚โ‚‚ = -Bโ‚โ‚‚eโ‚
eโ‚‚ ยท Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ = Bโ‚‚โ‚ƒeโ‚ƒ
eโ‚‚ ยท Bโ‚‚โ‚„eโ‚‚โ‚„ = Bโ‚‚โ‚„eโ‚„

=> 2 * s * (-Bโ‚โ‚‚eโ‚ + Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚‚โ‚„eโ‚„)

2I(v โˆง B)

eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚‚ โˆง Bโ‚ƒโ‚eโ‚ƒโ‚) = ... eโ‚โ‚‚โ‚ƒโ‚„โ‚‚โ‚ƒโ‚ = -eโ‚โ‚‚โ‚ƒโ‚‚โ‚„โ‚ƒโ‚ = eโ‚โ‚ƒโ‚„โ‚ƒโ‚ = -eโ‚โ‚„โ‚ =         Bโ‚ƒโ‚eโ‚„
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚‚ โˆง Bโ‚ƒโ‚„eโ‚ƒโ‚„) = ... eโ‚โ‚‚โ‚ƒโ‚„โ‚‚โ‚ƒโ‚„ = -eโ‚โ‚‚โ‚ƒโ‚‚โ‚„โ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚‚โ‚ƒ =                 -Bโ‚ƒโ‚„eโ‚ 
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚‚ โˆง Bโ‚โ‚„eโ‚โ‚„) = ... eโ‚โ‚‚โ‚ƒโ‚„โ‚‚โ‚โ‚„ = -eโ‚โ‚‚โ‚ƒโ‚‚โ‚„โ‚โ‚„ = eโ‚โ‚‚โ‚ƒโ‚‚โ‚ = -eโ‚โ‚ƒโ‚ =         Bโ‚โ‚„eโ‚ƒ

=> 2 * p * (Bโ‚ƒโ‚eโ‚„ - Bโ‚ƒโ‚„eโ‚ + Bโ‚โ‚„eโ‚ƒ)

2(v ยท B) ยท B

(-Bโ‚โ‚‚eโ‚ + Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚‚โ‚„eโ‚„) ยท (Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ + Bโ‚ƒโ‚eโ‚ƒโ‚ + Bโ‚โ‚‚eโ‚โ‚‚ + Bโ‚โ‚„eโ‚โ‚„ + Bโ‚‚โ‚„eโ‚‚โ‚„ + Bโ‚ƒโ‚„eโ‚ƒโ‚„)

= -Bโ‚โ‚‚ยฒeโ‚‚ + 0 + Bโ‚โ‚‚Bโ‚ƒโ‚eโ‚ƒ + 0 - Bโ‚โ‚‚Bโ‚โ‚„eโ‚„ + 0
+ 0 - Bโ‚‚โ‚ƒยฒeโ‚‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚eโ‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„eโ‚„ + 0 + 0
+ 0 + 0 + 0 - Bโ‚‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚‚โ‚„Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„ยฒeโ‚‚

=> 2 * (-Bโ‚โ‚‚ยฒeโ‚‚ + Bโ‚โ‚‚Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚‚Bโ‚โ‚„eโ‚„ - Bโ‚‚โ‚ƒยฒeโ‚‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚eโ‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„eโ‚„ - Bโ‚‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚‚โ‚„Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„ยฒeโ‚‚)

Simplify

v'  = (sยฒ - pยฒ + Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) eโ‚‚
    + 2 * s * (-Bโ‚โ‚‚eโ‚ + Bโ‚‚โ‚ƒeโ‚ƒ + Bโ‚‚โ‚„eโ‚„)
    + 2 * p * (Bโ‚ƒโ‚eโ‚„ - Bโ‚ƒโ‚„eโ‚ + Bโ‚โ‚„eโ‚ƒ)
    + 2 * (-Bโ‚โ‚‚ยฒeโ‚‚ + Bโ‚โ‚‚Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚‚Bโ‚โ‚„eโ‚„ - Bโ‚‚โ‚ƒยฒeโ‚‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚eโ‚ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„eโ‚„ - Bโ‚‚โ‚„Bโ‚ƒโ‚„eโ‚ƒ - Bโ‚‚โ‚„Bโ‚โ‚„eโ‚ - Bโ‚‚โ‚„ยฒeโ‚‚)

eโ‚‚ Parts

(sยฒ - pยฒ - Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ) eโ‚‚

eโ‚ Parts

2 * (s * -Bโ‚โ‚‚ + p * -Bโ‚ƒโ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚โ‚„) eโ‚

eโ‚ƒ Parts

2 * (s * Bโ‚‚โ‚ƒ + p * Bโ‚โ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚ƒโ‚„) eโ‚ƒ

eโ‚„ Parts

2 * (s * Bโ‚‚โ‚„ + p * Bโ‚ƒโ‚ - Bโ‚โ‚‚Bโ‚โ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„) eโ‚„

Combine with v' eโ‚

v'โ‚ = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) * vโ‚
    + 2 * (s * -Bโ‚โ‚‚ + p * -Bโ‚ƒโ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚โ‚„) * vโ‚‚
    +
    +

v'โ‚‚ = 2 * (s * Bโ‚โ‚‚ + p * Bโ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚‚โ‚„) * vโ‚
    + (sยฒ - pยฒ - Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ) * vโ‚‚
    + 
    +

v'โ‚ƒ = 2 * (s * -Bโ‚ƒโ‚ + p * -Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„) * vโ‚
    + 2 * (s * Bโ‚‚โ‚ƒ + p * Bโ‚โ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚ƒโ‚„) * vโ‚‚
    +
    +

v'โ‚„ = 2 (s * Bโ‚โ‚„ + p * Bโ‚‚โ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„) * vโ‚
    + 2 * (s * Bโ‚‚โ‚„ + p * Bโ‚ƒโ‚ - Bโ‚โ‚‚Bโ‚โ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„) * vโ‚‚
    +
    +

v = eโ‚ƒ

v(sยฒ - Iยฒ + Bยฒ)

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚ƒ
    + ...

2s(v ยท B)

eโ‚ƒ ยท Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ = -Bโ‚‚โ‚ƒeโ‚‚
eโ‚ƒ ยท Bโ‚ƒโ‚eโ‚ƒโ‚ = Bโ‚ƒโ‚eโ‚
eโ‚ƒ ยท Bโ‚ƒโ‚„eโ‚ƒโ‚„ = Bโ‚ƒโ‚„eโ‚„

=> 2 * s * (-Bโ‚‚โ‚ƒeโ‚‚ + Bโ‚ƒโ‚eโ‚ + Bโ‚ƒโ‚„eโ‚„)

2I(v โˆง B)

eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚ƒ โˆง Bโ‚โ‚‚eโ‚โ‚‚) = eโ‚โ‚‚โ‚ƒโ‚„โ‚ƒโ‚โ‚‚ = -eโ‚โ‚‚โ‚„โ‚โ‚‚ = eโ‚โ‚‚โ‚โ‚„โ‚‚ = -eโ‚‚โ‚„โ‚‚ =               Bโ‚โ‚‚eโ‚„
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚ƒ โˆง Bโ‚โ‚„eโ‚โ‚„) = eโ‚โ‚‚โ‚ƒโ‚„โ‚ƒโ‚โ‚„ = -eโ‚โ‚‚โ‚„โ‚โ‚„ = eโ‚โ‚‚โ‚ =                         -Bโ‚โ‚„eโ‚‚
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚ƒ โˆง Bโ‚‚โ‚„eโ‚‚โ‚„) = eโ‚โ‚‚โ‚ƒโ‚„โ‚ƒโ‚‚โ‚„ = -eโ‚โ‚‚โ‚„โ‚‚โ‚„ =                                Bโ‚‚โ‚„eโ‚

=> 2 * p * (Bโ‚โ‚‚eโ‚„ - Bโ‚โ‚„eโ‚‚ + Bโ‚‚โ‚„eโ‚)

2(v ยท B) ยท B

(-Bโ‚‚โ‚ƒeโ‚‚ + Bโ‚ƒโ‚eโ‚ + Bโ‚ƒโ‚„eโ‚„) ยท (Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ + Bโ‚ƒโ‚eโ‚ƒโ‚ + Bโ‚โ‚‚eโ‚โ‚‚ + Bโ‚โ‚„eโ‚โ‚„ + Bโ‚‚โ‚„eโ‚‚โ‚„ + Bโ‚ƒโ‚„eโ‚ƒโ‚„)

= Bโ‚‚โ‚ƒBโ‚โ‚‚eโ‚ - Bโ‚‚โ‚ƒยฒeโ‚ƒ + 0 + 0 + 0 - Bโ‚‚โ‚ƒBโ‚‚โ‚„eโ‚„
+ Bโ‚ƒโ‚Bโ‚โ‚‚eโ‚‚ + 0 - Bโ‚ƒโ‚ยฒeโ‚ƒ + 0 + Bโ‚ƒโ‚Bโ‚โ‚„eโ‚„ + 0
+ 0 + 0 + 0 - Bโ‚ƒโ‚„ยฒeโ‚ƒ - Bโ‚ƒโ‚„Bโ‚โ‚„eโ‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„eโ‚‚

=> 2 * (Bโ‚‚โ‚ƒBโ‚โ‚‚eโ‚ - Bโ‚‚โ‚ƒยฒeโ‚ƒ - Bโ‚‚โ‚ƒBโ‚‚โ‚„eโ‚„ + Bโ‚ƒโ‚Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ƒ + Bโ‚ƒโ‚Bโ‚โ‚„eโ‚„ - Bโ‚ƒโ‚„ยฒeโ‚ƒ - Bโ‚ƒโ‚„Bโ‚โ‚„eโ‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„eโ‚‚)

Simplify

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚ƒ
    + 2 * s * (-Bโ‚‚โ‚ƒeโ‚‚ + Bโ‚ƒโ‚eโ‚ + Bโ‚ƒโ‚„eโ‚„)
    + 2 * p * (Bโ‚โ‚‚eโ‚„ - Bโ‚โ‚„eโ‚‚ + Bโ‚‚โ‚„eโ‚)
    + 2 * (Bโ‚‚โ‚ƒBโ‚โ‚‚eโ‚ - Bโ‚‚โ‚ƒยฒeโ‚ƒ - Bโ‚‚โ‚ƒBโ‚‚โ‚„eโ‚„ + Bโ‚ƒโ‚Bโ‚โ‚‚eโ‚‚ - Bโ‚ƒโ‚ยฒeโ‚ƒ + Bโ‚ƒโ‚Bโ‚โ‚„eโ‚„ - Bโ‚ƒโ‚„ยฒeโ‚ƒ - Bโ‚ƒโ‚„Bโ‚โ‚„eโ‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„eโ‚‚)

eโ‚ƒ Parts

    (sยฒ - pยฒ + Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ - Bโ‚ƒโ‚ยฒ - Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) eโ‚ƒ

eโ‚ Parts

    2 * (s * Bโ‚ƒโ‚ + p * Bโ‚‚โ‚„ + Bโ‚‚โ‚ƒBโ‚โ‚‚ - Bโ‚ƒโ‚„Bโ‚โ‚„) eโ‚

eโ‚‚ Parts

    2 * (s * -Bโ‚‚โ‚ƒ + p * -Bโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚โ‚‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„) eโ‚‚

eโ‚„ Parts

    2 * (s * Bโ‚ƒโ‚„ + p * Bโ‚โ‚‚ - Bโ‚‚โ‚ƒBโ‚‚โ‚„ + Bโ‚ƒโ‚Bโ‚โ‚„) eโ‚„

Combine with v' eโ‚ eโ‚‚

v'โ‚ = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) * vโ‚
    + 2 * (s * -Bโ‚โ‚‚ + p * -Bโ‚ƒโ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚โ‚„) * vโ‚‚
    + 2 * (s * Bโ‚ƒโ‚ + p * Bโ‚‚โ‚„ + Bโ‚‚โ‚ƒBโ‚โ‚‚ - Bโ‚ƒโ‚„Bโ‚โ‚„) * vโ‚ƒ
    +

v'โ‚‚ = 2 * (s * Bโ‚โ‚‚ + p * Bโ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚‚โ‚„) * vโ‚
    + (sยฒ - pยฒ - Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ) * vโ‚‚
    + 2 * (s * -Bโ‚‚โ‚ƒ + p * -Bโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚โ‚‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„) * vโ‚ƒ
    +

v'โ‚ƒ = 2 * (s * -Bโ‚ƒโ‚ + p * -Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„) * vโ‚
    + 2 * (s * Bโ‚‚โ‚ƒ + p * Bโ‚โ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚ƒโ‚„) * vโ‚‚
    + (sยฒ - pยฒ + Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ - Bโ‚ƒโ‚ยฒ - Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) * vโ‚ƒ
    +

v'โ‚„ = 2 (s * Bโ‚โ‚„ + p * Bโ‚‚โ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„) * vโ‚
    + 2 * (s * Bโ‚‚โ‚„ + p * Bโ‚ƒโ‚ - Bโ‚โ‚‚Bโ‚โ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„) * vโ‚‚
    + 2 * (s * Bโ‚ƒโ‚„ + p * Bโ‚โ‚‚ - Bโ‚‚โ‚ƒBโ‚‚โ‚„ + Bโ‚ƒโ‚Bโ‚โ‚„) * vโ‚ƒ
    +

v = eโ‚„

v(sยฒ - Iยฒ + Bยฒ)

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚„
    + ...

2s(v ยท B)

eโ‚„ ยท Bโ‚ƒโ‚„eโ‚ƒโ‚„ = -Bโ‚ƒโ‚„eโ‚ƒ
eโ‚„ ยท Bโ‚โ‚„eโ‚โ‚„ = -Bโ‚โ‚„eโ‚
eโ‚„ ยท Bโ‚‚โ‚„eโ‚‚โ‚„ = -Bโ‚‚โ‚„eโ‚‚

=> 2 * s * (-Bโ‚ƒโ‚„eโ‚ƒ -Bโ‚โ‚„eโ‚ -Bโ‚‚โ‚„eโ‚‚)

2I(v โˆง B)

eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚„ โˆง Bโ‚โ‚‚eโ‚โ‚‚) = eโ‚โ‚‚โ‚ƒโ‚โ‚‚ = -eโ‚โ‚‚โ‚โ‚ƒโ‚‚ = eโ‚‚โ‚ƒโ‚‚ =                           -Bโ‚โ‚‚eโ‚ƒ
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚„ โˆง Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ) = eโ‚โ‚‚โ‚ƒโ‚‚โ‚ƒ =                                            -Bโ‚‚โ‚ƒeโ‚
eโ‚โ‚‚โ‚ƒโ‚„ * (eโ‚„ โˆง Bโ‚ƒโ‚eโ‚ƒโ‚) = eโ‚โ‚‚โ‚ =                                              -Bโ‚ƒโ‚eโ‚‚

=> 2 * p * (-Bโ‚โ‚‚eโ‚ƒ - Bโ‚‚โ‚ƒeโ‚ - Bโ‚ƒโ‚eโ‚‚)

2(v ยท B) ยท B

(-Bโ‚ƒโ‚„eโ‚ƒ -Bโ‚โ‚„eโ‚ -Bโ‚‚โ‚„eโ‚‚) ยท (Bโ‚‚โ‚ƒeโ‚‚โ‚ƒ + Bโ‚ƒโ‚eโ‚ƒโ‚ + Bโ‚โ‚‚eโ‚โ‚‚ + Bโ‚โ‚„eโ‚โ‚„ + Bโ‚‚โ‚„eโ‚‚โ‚„ + Bโ‚ƒโ‚„eโ‚ƒโ‚„)

= 0 + Bโ‚ƒโ‚„Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚„Bโ‚ƒโ‚eโ‚ - Bโ‚ƒโ‚„ยฒeโ‚„ + 0 + 0
+ -Bโ‚โ‚„Bโ‚โ‚‚eโ‚‚ + 0 + Bโ‚โ‚„Bโ‚ƒโ‚eโ‚ƒ + 0 - Bโ‚โ‚„ยฒeโ‚„ + 0
+ Bโ‚‚โ‚„Bโ‚โ‚‚eโ‚ - Bโ‚‚โ‚„Bโ‚‚โ‚ƒeโ‚ƒ + 0 + 0 + 0 - Bโ‚‚โ‚„ยฒeโ‚„

=> 2 * (Bโ‚ƒโ‚„Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚„Bโ‚ƒโ‚eโ‚ - Bโ‚ƒโ‚„ยฒeโ‚„ - Bโ‚โ‚„Bโ‚โ‚‚eโ‚‚ + Bโ‚โ‚„Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚„ยฒeโ‚„ + Bโ‚‚โ‚„Bโ‚โ‚‚eโ‚ - Bโ‚‚โ‚„Bโ‚‚โ‚ƒeโ‚ƒ - Bโ‚‚โ‚„ยฒeโ‚„)

Simplify

v'  = (sยฒ - pยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚โ‚‚ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ + Bโ‚ƒโ‚„ยฒ) eโ‚„
    + 2 * s * (-Bโ‚ƒโ‚„eโ‚ƒ -Bโ‚โ‚„eโ‚ -Bโ‚‚โ‚„eโ‚‚)
    + 2 * p * (-Bโ‚โ‚‚eโ‚ƒ - Bโ‚‚โ‚ƒeโ‚ - Bโ‚ƒโ‚eโ‚‚)
    + 2 * (Bโ‚ƒโ‚„Bโ‚‚โ‚ƒeโ‚‚ - Bโ‚ƒโ‚„Bโ‚ƒโ‚eโ‚ - Bโ‚ƒโ‚„ยฒeโ‚„ - Bโ‚โ‚„Bโ‚โ‚‚eโ‚‚ + Bโ‚โ‚„Bโ‚ƒโ‚eโ‚ƒ - Bโ‚โ‚„ยฒeโ‚„ + Bโ‚‚โ‚„Bโ‚โ‚‚eโ‚ - Bโ‚‚โ‚„Bโ‚‚โ‚ƒeโ‚ƒ - Bโ‚‚โ‚„ยฒeโ‚„)

eโ‚„ Parts

(sยฒ - pยฒ + Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ - Bโ‚ƒโ‚„ยฒ - Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ) eโ‚„

eโ‚ Parts

2 * (s * -Bโ‚โ‚„ + p * -Bโ‚‚โ‚ƒ -Bโ‚ƒโ‚„Bโ‚ƒโ‚ + Bโ‚‚โ‚„Bโ‚โ‚‚) eโ‚

eโ‚‚ Parts

2 * (s * -Bโ‚‚โ‚„ + p * -Bโ‚ƒโ‚ + Bโ‚ƒโ‚„Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚โ‚‚) eโ‚‚

eโ‚ƒ Parts

2 * (s * -Bโ‚ƒโ‚„ + p * -Bโ‚โ‚‚ + Bโ‚โ‚„Bโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚‚โ‚ƒ) eโ‚ƒ

Combine with v' eโ‚ eโ‚‚ eโ‚ƒ

v'โ‚ = (sยฒ - pยฒ - Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ - Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ - Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) * vโ‚
    + 2 * (s * -Bโ‚โ‚‚ + p * -Bโ‚ƒโ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚โ‚„) * vโ‚‚
    + 2 * (s * Bโ‚ƒโ‚ + p * Bโ‚‚โ‚„ + Bโ‚‚โ‚ƒBโ‚โ‚‚ - Bโ‚ƒโ‚„Bโ‚โ‚„) * vโ‚ƒ
    + 2 * (s * -Bโ‚โ‚„ + p * -Bโ‚‚โ‚ƒ -Bโ‚ƒโ‚„Bโ‚ƒโ‚ + Bโ‚‚โ‚„Bโ‚โ‚‚) * vโ‚„

v'โ‚‚ = 2 * (s * Bโ‚โ‚‚ + p * Bโ‚ƒโ‚„ + Bโ‚ƒโ‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚‚โ‚„) * vโ‚
    + (sยฒ - pยฒ - Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ + Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ) * vโ‚‚
    + 2 * (s * -Bโ‚‚โ‚ƒ + p * -Bโ‚โ‚„ + Bโ‚ƒโ‚Bโ‚โ‚‚ - Bโ‚ƒโ‚„Bโ‚‚โ‚„) * vโ‚ƒ
    + 2 * (s * -Bโ‚‚โ‚„ + p * -Bโ‚ƒโ‚ + Bโ‚ƒโ‚„Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚โ‚‚) * vโ‚„

v'โ‚ƒ = 2 * (s * -Bโ‚ƒโ‚ + p * -Bโ‚‚โ‚„ + Bโ‚โ‚‚Bโ‚‚โ‚ƒ - Bโ‚โ‚„Bโ‚ƒโ‚„) * vโ‚
    + 2 * (s * Bโ‚‚โ‚ƒ + p * Bโ‚โ‚„ + Bโ‚โ‚‚Bโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚ƒโ‚„) * vโ‚‚
    + (sยฒ - pยฒ + Bโ‚โ‚‚ยฒ - Bโ‚‚โ‚ƒยฒ - Bโ‚ƒโ‚ยฒ - Bโ‚ƒโ‚„ยฒ + Bโ‚โ‚„ยฒ + Bโ‚‚โ‚„ยฒ) * vโ‚ƒ
    + 2 * (s * -Bโ‚ƒโ‚„ + p * -Bโ‚โ‚‚ + Bโ‚โ‚„Bโ‚ƒโ‚ - Bโ‚‚โ‚„Bโ‚‚โ‚ƒ) * vโ‚„

v'โ‚„ = 2 * (s * Bโ‚โ‚„ + p * Bโ‚‚โ‚ƒ + Bโ‚โ‚‚Bโ‚‚โ‚„ - Bโ‚ƒโ‚Bโ‚ƒโ‚„) * vโ‚
    + 2 * (s * Bโ‚‚โ‚„ + p * Bโ‚ƒโ‚ - Bโ‚โ‚‚Bโ‚โ‚„ + Bโ‚‚โ‚ƒBโ‚ƒโ‚„) * vโ‚‚
    + 2 * (s * Bโ‚ƒโ‚„ + p * Bโ‚โ‚‚ - Bโ‚‚โ‚ƒBโ‚‚โ‚„ + Bโ‚ƒโ‚Bโ‚โ‚„) * vโ‚ƒ
    + (sยฒ - pยฒ + Bโ‚โ‚‚ยฒ + Bโ‚‚โ‚ƒยฒ + Bโ‚ƒโ‚ยฒ - Bโ‚ƒโ‚„ยฒ - Bโ‚โ‚„ยฒ - Bโ‚‚โ‚„ยฒ) * vโ‚„

Code (old eโ‚โ‚‚!)

static rotateVector4HB(r: Rot4, v: Vec4): Vec4 {
    const s = r[0], xy = r[1], yz = r[2], zx = r[3],
        zw = r[4], xw = r[5], yw = r[6], p = r[7];

    // Helper squares
    const s_2 = s * s;
    const xy_2 = xy * xy, yz_2 = yz * yz, zx_2 = zx * zx;
    const zw_2 = zw * zw, xw_2 = xw * xw, yw_2 = yw * yw;
    const p_2 = p * p;

    const out = new Float32Array(4);

    // (sยฒ - Iยฒ)v  + 2s(v ยท B) + 2I(v โˆง B) + 2(v ยท B)B  - vBยฒ

    // ((())) looks stupid but makes it WGSL-safe (no PEMDAS)

    out[0] = ((s_2 - p_2 - xy_2 + yz_2 - zx_2 + zw_2 - xw_2 + yw_2) * v[0])
        + (2 * ((s * -xy) + (p * -zw) + (yz * zx) - (yw * xw)) * v[1])
        + (2 * ((s * zx) + (p * yw) + (yz * xy) - (zw * xw)) * v[2])
        + (2 * ((s * -xw) + (p * -yz) - (zw * zx) + (yw * xy)) * v[3]);

    out[1] = (2 * ((s * xy) + (p * zw) + (zx * yz) - (xw * yw)) * v[0])
        + ((s_2 - p_2 - xy_2 - yz_2 + zx_2 + zw_2 + xw_2 - yw_2) * v[1])
        + (2 * ((s * -yz) + (p * -xw) + (zx * xy) - (zw * yw)) * v[2])
        + (2 * ((s * -yw) + (p * -zx) + (zw * yz) - (xw * xy)) * v[3]);

    out[2] = (2 * ((s * -zx) + (p * -yw) + (xy * yz) - (xw * zw)) * v[0])
        + (2 * ((s * yz) + (p * xw) + (xy * zx) - (yw * zw)) * v[1])
        + ((s_2 - p_2 + xy_2 - yz_2 - zx_2 - zw_2 + xw_2 + yw_2) * v[2])
        + (2 * ((s * -zw) + (p * -xy) + (xw * zx) - (yw * yz)) * v[3]);

    out[3] = (2 * ((s * xw) + (p * yz) + (xy * yw) - (zx * zw)) * v[0])
        + (2 * ((s * yw) + (p * zx) - (xy * xw) + (yz * zw)) * v[1])
        + (2 * ((s * zw) + (p * xy) - (yz * yw) + (zx * xw)) * v[2])
        + ((s_2 - p_2 + xy_2 + yz_2 + zx_2 - zw_2 - xw_2 - yw_2) * v[3]);

    return out;
}

To export this as a matrix thats really easy, just remember you want COLUMN mayor.

So 0-3 are from vโ‚ to vโ‚„ onto v'โ‚

static toMat4HB(r: Rot4): Mat4 {
    const s = r[0], xy = r[1], yz = r[2], zx = r[3],
        zw = r[4], xw = r[5], yw = r[6], p = r[7];

    // Helper squares
    const s_2 = s * s;
    const xy_2 = xy * xy, yz_2 = yz * yz, zx_2 = zx * zx;
    const zw_2 = zw * zw, xw_2 = xw * xw, yw_2 = yw * yw;
    const p_2 = p * p;

    const out = MAT4_IDENTITY.slice();

    // all vโ‚™ parts IN TO OUT v'โ‚ (0-3) to v'โ‚„ (12-15) - COLUMN MAYOR!!

    // COLUMN 0 (Basis X: v=[1, 0, 0, 0])  
    out[0] = (s_2 - p_2 - xy_2 + yz_2 - zx_2 + zw_2 - xw_2 + yw_2);
    out[1] = 2 * ((s * xy) + (p * zw) + (zx * yz) - (xw * yw));
    out[2] = 2 * ((s * -zx) + (p * -yw) + (xy * yz) - (xw * zw));
    out[3] = 2 * ((s * xw) + (p * yz) + (xy * yw) - (zx * zw));

    // COLUMN 1 (Basis Y: v=[0, 1, 0, 0])
    out[4] = 2 * ((s * -xy) + (p * -zw) + (yz * zx) - (yw * xw));
    out[5] = (s_2 - p_2 - xy_2 - yz_2 + zx_2 + zw_2 + xw_2 - yw_2);
    out[6] = 2 * ((s * yz) + (p * xw) + (xy * zx) - (yw * zw));
    out[7] = 2 * ((s * yw) + (p * zx) - (xy * xw) + (yz * zw));

    // COLUMN 2 (Basis Z: v=[0, 0, 1, 0])
    out[8] = 2 * ((s * zx) + (p * yw) + (yz * xy) - (zw * xw));
    out[9] = 2 * ((s * -yz) + (p * -xw) + (zx * xy) - (zw * yw));
    out[10] = (s_2 - p_2 + xy_2 - yz_2 - zx_2 - zw_2 + xw_2 + yw_2);
    out[11] = 2 * ((s * zw) + (p * xy) - (yz * yw) + (zx * xw));

    // COLUMN 3 (Basis W: v=[0, 0, 0, 1])
    out[12] = 2 * ((s * -xw) + (p * -yz) - (zw * zx) + (yw * xy));
    out[13] = 2 * ((s * -yw) + (p * -zx) + (zw * yz) - (xw * xy));
    out[14] = 2 * ((s * -zw) + (p * -xy) + (xw * zx) - (yw * yz));
    out[15] = (s_2 - p_2 + xy_2 + yz_2 + zx_2 - zw_2 - xw_2 - yw_2);

    return out;
}

Rร—R

R1 ร— R2 - the SANE Heidelberg way (i think)

Im sure you can short this somehow but after all its expanding to 64 terms and will cancel 8 i think .. dono. ill just do it manually

R1*R2 = (R1[0] + R1[1] eโ‚โ‚‚ + R1[2] eโ‚‚โ‚ƒ + R1[3] eโ‚ƒโ‚ + R1[4] eโ‚ƒโ‚„ + R1[5] eโ‚โ‚„ + R1[6] eโ‚‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„)
      * (R2[0] + R2[1] eโ‚โ‚‚ + R2[2] eโ‚‚โ‚ƒ + R2[3] eโ‚ƒโ‚ + R2[4] eโ‚ƒโ‚„ + R2[5] eโ‚โ‚„ + R2[6] eโ‚‚โ‚„ + R2[7] eโ‚โ‚‚โ‚ƒโ‚„)

      = R1[0]     R2[0] + R1[0]     R2[1] eโ‚โ‚‚ + R1[0]     R2[2] eโ‚‚โ‚ƒ + R1[0]     R2[3] eโ‚ƒโ‚ + R1[0]     R2[4] eโ‚ƒโ‚„ + R1[0]     R2[5] eโ‚โ‚„ + R1[0]     R2[6] eโ‚‚โ‚„ + R1[0]     R2[7] eโ‚โ‚‚โ‚ƒโ‚„

      + R1[1] eโ‚โ‚‚ R2[0] + R1[1] eโ‚โ‚‚ R2[1] eโ‚โ‚‚ + R1[1] eโ‚โ‚‚ R2[2] eโ‚‚โ‚ƒ + R1[1] eโ‚โ‚‚ R2[3] eโ‚ƒโ‚ + R1[1] eโ‚โ‚‚ R2[4] eโ‚ƒโ‚„ + R1[1] eโ‚โ‚‚ R2[5] eโ‚โ‚„ + R1[1] eโ‚โ‚‚ R2[6] eโ‚‚โ‚„ + R1[1] eโ‚โ‚‚ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[2] eโ‚‚โ‚ƒ R2[0] + R1[2] eโ‚‚โ‚ƒ R2[1] eโ‚โ‚‚ + R1[2] eโ‚‚โ‚ƒ R2[2] eโ‚‚โ‚ƒ + R1[2] eโ‚‚โ‚ƒ R2[3] eโ‚ƒโ‚ + R1[2] eโ‚‚โ‚ƒ R2[4] eโ‚ƒโ‚„ + R1[2] eโ‚‚โ‚ƒ R2[5] eโ‚โ‚„ + R1[2] eโ‚‚โ‚ƒ R2[6] eโ‚‚โ‚„ + R1[2] eโ‚‚โ‚ƒ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[3] eโ‚ƒโ‚ R2[0] + R1[3] eโ‚ƒโ‚ R2[1] eโ‚โ‚‚ + R1[3] eโ‚ƒโ‚ R2[2] eโ‚‚โ‚ƒ + R1[3] eโ‚ƒโ‚ R2[3] eโ‚ƒโ‚ + R1[3] eโ‚ƒโ‚ R2[4] eโ‚ƒโ‚„ + R1[3] eโ‚ƒโ‚ R2[5] eโ‚โ‚„ + R1[3] eโ‚ƒโ‚ R2[6] eโ‚‚โ‚„ + R1[3] eโ‚ƒโ‚ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[4] eโ‚ƒโ‚„ R2[0] + R1[4] eโ‚ƒโ‚„ R2[1] eโ‚โ‚‚ + R1[4] eโ‚ƒโ‚„ R2[2] eโ‚‚โ‚ƒ + R1[4] eโ‚ƒโ‚„ R2[3] eโ‚ƒโ‚ + R1[4] eโ‚ƒโ‚„ R2[4] eโ‚ƒโ‚„ + R1[4] eโ‚ƒโ‚„ R2[5] eโ‚โ‚„ + R1[4] eโ‚ƒโ‚„ R2[6] eโ‚‚โ‚„ + R1[4] eโ‚ƒโ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[5] eโ‚โ‚„ R2[0] + R1[5] eโ‚โ‚„ R2[1] eโ‚โ‚‚ + R1[5] eโ‚โ‚„ R2[2] eโ‚‚โ‚ƒ + R1[5] eโ‚โ‚„ R2[3] eโ‚ƒโ‚ + R1[5] eโ‚โ‚„ R2[4] eโ‚ƒโ‚„ + R1[5] eโ‚โ‚„ R2[5] eโ‚โ‚„ + R1[5] eโ‚โ‚„ R2[6] eโ‚‚โ‚„ + R1[5] eโ‚โ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[6] eโ‚‚โ‚„ R2[0] + R1[6] eโ‚‚โ‚„ R2[1] eโ‚โ‚‚ + R1[6] eโ‚‚โ‚„ R2[2] eโ‚‚โ‚ƒ + R1[6] eโ‚‚โ‚„ R2[3] eโ‚ƒโ‚ + R1[6] eโ‚‚โ‚„ R2[4] eโ‚ƒโ‚„ + R1[6] eโ‚‚โ‚„ R2[5] eโ‚โ‚„ + R1[6] eโ‚‚โ‚„ R2[6] eโ‚‚โ‚„ + R1[6] eโ‚‚โ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„

      + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[0] + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[1] eโ‚โ‚‚ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[2] eโ‚‚โ‚ƒ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[3] eโ‚ƒโ‚ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[4] eโ‚ƒโ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[5] eโ‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[6] eโ‚‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„

First lets solve all same planes to -1 / clean all eโ‚˜โ‚™ยฒ to -1

R1*R2 = (R1[0] + R1[1] eโ‚โ‚‚ + R1[2] eโ‚‚โ‚ƒ + R1[3] eโ‚ƒโ‚ + R1[4] eโ‚ƒโ‚„ + R1[5] eโ‚โ‚„ + R1[6] eโ‚‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„)
      * (R2[0] + R2[1] eโ‚โ‚‚ + R2[2] eโ‚‚โ‚ƒ + R2[3] eโ‚ƒโ‚ + R2[4] eโ‚ƒโ‚„ + R2[5] eโ‚โ‚„ + R2[6] eโ‚‚โ‚„ + R2[7] eโ‚โ‚‚โ‚ƒโ‚„)

      = R1[0]     R2[0]     + R1[0]     R2[1] eโ‚โ‚‚   + R1[0]     R2[2] eโ‚‚โ‚ƒ   + R1[0]     R2[3] eโ‚ƒโ‚   + R1[0]     R2[4] eโ‚ƒโ‚„   + R1[0]     R2[5] eโ‚โ‚„   + R1[0]     R2[6] eโ‚‚โ‚„   + R1[0]     R2[7] eโ‚โ‚‚โ‚ƒโ‚„

      + R1[1] eโ‚โ‚‚ R2[0]     - R1[1]     R2[1]       + R1[1] eโ‚โ‚‚ R2[2] eโ‚‚โ‚ƒ   + R1[1] eโ‚โ‚‚ R2[3] eโ‚ƒโ‚   + R1[1] eโ‚โ‚‚ R2[4] eโ‚ƒโ‚„   + R1[1] eโ‚โ‚‚ R2[5] eโ‚โ‚„   + R1[1] eโ‚โ‚‚ R2[6] eโ‚‚โ‚„   + R1[1] eโ‚โ‚‚ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[2] eโ‚‚โ‚ƒ R2[0]     + R1[2] eโ‚‚โ‚ƒ R2[1] eโ‚โ‚‚   - R1[2]     R2[2]       + R1[2] eโ‚‚โ‚ƒ R2[3] eโ‚ƒโ‚   + R1[2] eโ‚‚โ‚ƒ R2[4] eโ‚ƒโ‚„   + R1[2] eโ‚‚โ‚ƒ R2[5] eโ‚โ‚„   + R1[2] eโ‚‚โ‚ƒ R2[6] eโ‚‚โ‚„   + R1[2] eโ‚‚โ‚ƒ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[3] eโ‚ƒโ‚ R2[0]     + R1[3] eโ‚ƒโ‚ R2[1] eโ‚โ‚‚   + R1[3] eโ‚ƒโ‚ R2[2] eโ‚‚โ‚ƒ   - R1[3]     R2[3]       + R1[3] eโ‚ƒโ‚ R2[4] eโ‚ƒโ‚„   + R1[3] eโ‚ƒโ‚ R2[5] eโ‚โ‚„   + R1[3] eโ‚ƒโ‚ R2[6] eโ‚‚โ‚„   + R1[3] eโ‚ƒโ‚ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[4] eโ‚ƒโ‚„ R2[0]     + R1[4] eโ‚ƒโ‚„ R2[1] eโ‚โ‚‚   + R1[4] eโ‚ƒโ‚„ R2[2] eโ‚‚โ‚ƒ   + R1[4] eโ‚ƒโ‚„ R2[3] eโ‚ƒโ‚   - R1[4]     R2[4]       + R1[4] eโ‚ƒโ‚„ R2[5] eโ‚โ‚„   + R1[4] eโ‚ƒโ‚„ R2[6] eโ‚‚โ‚„   + R1[4] eโ‚ƒโ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[5] eโ‚โ‚„ R2[0]     + R1[5] eโ‚โ‚„ R2[1] eโ‚โ‚‚   + R1[5] eโ‚โ‚„ R2[2] eโ‚‚โ‚ƒ   + R1[5] eโ‚โ‚„ R2[3] eโ‚ƒโ‚   + R1[5] eโ‚โ‚„ R2[4] eโ‚ƒโ‚„   - R1[5]     R2[5]       + R1[5] eโ‚โ‚„ R2[6] eโ‚‚โ‚„   + R1[5] eโ‚โ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[6] eโ‚‚โ‚„ R2[0]     + R1[6] eโ‚‚โ‚„ R2[1] eโ‚โ‚‚   + R1[6] eโ‚‚โ‚„ R2[2] eโ‚‚โ‚ƒ   + R1[6] eโ‚‚โ‚„ R2[3] eโ‚ƒโ‚   + R1[6] eโ‚‚โ‚„ R2[4] eโ‚ƒโ‚„   + R1[6] eโ‚‚โ‚„ R2[5] eโ‚โ‚„   - R1[6]     R2[6]       + R1[6] eโ‚‚โ‚„ R2[7] eโ‚โ‚‚โ‚ƒโ‚„

      + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[0]   + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[1] eโ‚โ‚‚ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[2] eโ‚‚โ‚ƒ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[3] eโ‚ƒโ‚ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[4] eโ‚ƒโ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[5] eโ‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[6] eโ‚‚โ‚„ + R1[7]     R2[7]

Thats 6 so 3 + 2 + 1 swaps for Iยฒ then how the axis square

eโ‚โ‚‚โ‚ƒโ‚„ยฒ = eโ‚โ‚‚โ‚ƒโ‚„โ‚โ‚‚โ‚ƒโ‚„ = -eโ‚โ‚‚โ‚ƒโ‚โ‚„โ‚‚โ‚ƒโ‚„ = eโ‚โ‚‚โ‚โ‚ƒโ‚„โ‚‚โ‚ƒโ‚„ = -eโ‚‚โ‚ƒโ‚„โ‚‚โ‚ƒโ‚„ = eโ‚‚โ‚ƒโ‚‚โ‚„โ‚ƒโ‚„ = -eโ‚ƒโ‚„โ‚ƒโ‚„ = 1

Lets do all plane multipications sharing an axis

R1*R2 = (R1[0] + R1[1] eโ‚โ‚‚ + R1[2] eโ‚‚โ‚ƒ + R1[3] eโ‚ƒโ‚ + R1[4] eโ‚ƒโ‚„ + R1[5] eโ‚โ‚„ + R1[6] eโ‚‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„)
      * (R2[0] + R2[1] eโ‚โ‚‚ + R2[2] eโ‚‚โ‚ƒ + R2[3] eโ‚ƒโ‚ + R2[4] eโ‚ƒโ‚„ + R2[5] eโ‚โ‚„ + R2[6] eโ‚‚โ‚„ + R2[7] eโ‚โ‚‚โ‚ƒโ‚„)

      = R1[0]     R2[0]     + R1[0]     R2[1] eโ‚โ‚‚   + R1[0]     R2[2] eโ‚‚โ‚ƒ   + R1[0]     R2[3] eโ‚ƒโ‚   + R1[0]     R2[4] eโ‚ƒโ‚„   + R1[0]     R2[5] eโ‚โ‚„   + R1[0]     R2[6] eโ‚‚โ‚„   + R1[0]     R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      //                                                                                                                                                                      eโ‚โ‚‚โ‚โ‚‚โ‚ƒโ‚„ = -eโ‚ƒโ‚„
      + R1[1] eโ‚โ‚‚ R2[0]     - R1[1]     R2[1]       - R1[1]     R2[2] eโ‚ƒโ‚   + R1[1]     R2[3] eโ‚‚โ‚ƒ   + R1[1]     R2[4] eโ‚โ‚‚โ‚ƒโ‚„ - R1[1]     R2[5] eโ‚‚โ‚„   + R1[1]     R2[6] eโ‚โ‚„   - R1[1]     R2[7] eโ‚ƒโ‚„
      //                                                                                                                      eโ‚‚โ‚ƒโ‚โ‚„ = -eโ‚‚โ‚โ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚„                          eโ‚‚โ‚ƒโ‚โ‚‚โ‚ƒโ‚„ = -eโ‚ƒโ‚‚โ‚โ‚‚โ‚ƒโ‚„ = eโ‚ƒโ‚โ‚ƒโ‚„ = -eโ‚โ‚„
      + R1[2] eโ‚‚โ‚ƒ R2[0]     + R1[2]     R2[1] eโ‚ƒโ‚   - R1[2]     R2[2]       - R1[2]     R2[3] eโ‚โ‚‚   + R1[2]     R2[4] eโ‚‚โ‚„   + R1[2]     R2[5] eโ‚โ‚‚โ‚ƒโ‚„ - R1[2]     R2[6] eโ‚ƒโ‚„   - R1[2]     R2[7] eโ‚โ‚„
      //                                                                                                                                              eโ‚ƒโ‚โ‚‚โ‚„ = -eโ‚โ‚ƒโ‚‚โ‚„ = eโ‚โ‚‚โ‚ƒโ‚„  eโ‚ƒโ‚‚โ‚ƒโ‚„ = -eโ‚‚โ‚„
      + R1[3] eโ‚ƒโ‚ R2[0]     - R1[3]     R2[1] eโ‚‚โ‚ƒ   + R1[3]     R2[2] eโ‚โ‚‚   - R1[3]     R2[3]       - R1[3]     R2[4] eโ‚โ‚„   + R1[3]     R2[5] eโ‚ƒโ‚„   + R1[3]     R2[6] eโ‚โ‚‚โ‚ƒโ‚„ - R1[3]     R2[7] eโ‚‚โ‚„
      //                      eโ‚ƒโ‚„โ‚โ‚‚ = -eโ‚ƒโ‚โ‚„โ‚‚ = eโ‚โ‚ƒโ‚„โ‚‚ = -eโ‚โ‚ƒโ‚‚โ‚„ = eโ‚โ‚‚โ‚ƒโ‚„                                                                                                         eโ‚ƒโ‚„โ‚โ‚‚โ‚ƒโ‚„ = -eโ‚ƒโ‚โ‚„โ‚‚โ‚ƒโ‚„ = eโ‚โ‚ƒโ‚„โ‚‚โ‚ƒโ‚„ = -eโ‚โ‚ƒโ‚‚โ‚„โ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚„โ‚ƒโ‚„ = -eโ‚โ‚‚
      + R1[4] eโ‚ƒโ‚„ R2[0]     + R1[4]     R2[1] eโ‚โ‚‚โ‚ƒโ‚„ - R1[4]     R2[2] eโ‚‚โ‚„   + R1[4]     R2[3] eโ‚โ‚„   - R1[4]     R2[4]       - R1[4]     R2[5] eโ‚ƒโ‚   + R1[4]     R2[6] eโ‚‚โ‚ƒ   - R1[4]     R2[7] eโ‚โ‚‚
      //                                              eโ‚โ‚„โ‚‚โ‚ƒ = -eโ‚โ‚‚โ‚„โ‚ƒ = eโ‚โ‚‚โ‚ƒโ‚„                                                                                                  eโ‚โ‚„โ‚โ‚‚โ‚ƒโ‚„ = -eโ‚„โ‚‚โ‚ƒโ‚„ = eโ‚‚โ‚„โ‚ƒโ‚„ = -eโ‚‚โ‚ƒ
      + R1[5] eโ‚โ‚„ R2[0]     + R1[5]     R2[1] eโ‚‚โ‚„   + R1[5]     R2[2] eโ‚โ‚‚โ‚ƒโ‚„ - R1[5]     R2[3] eโ‚ƒโ‚„   + R1[5]     R2[4] eโ‚ƒโ‚   - R1[5]     R2[5]       - R1[5]     R2[6] eโ‚โ‚‚   - R1[5]     R2[7] eโ‚‚โ‚ƒ
      //                                                                      eโ‚‚โ‚„โ‚ƒโ‚ = -eโ‚‚โ‚ƒโ‚„โ‚ = eโ‚‚โ‚ƒโ‚โ‚„ = -eโ‚‚โ‚โ‚ƒโ‚„ = eโ‚โ‚‚โ‚ƒโ‚„                                                         eโ‚‚โ‚„โ‚โ‚‚โ‚ƒโ‚„ = -eโ‚‚โ‚โ‚„โ‚‚โ‚ƒโ‚„ = eโ‚‚โ‚โ‚‚โ‚„โ‚ƒโ‚„ = -eโ‚โ‚„โ‚ƒโ‚„ = eโ‚โ‚ƒ = -eโ‚ƒโ‚
      + R1[6] eโ‚‚โ‚„ R2[0]     - R1[6]     R2[1] eโ‚โ‚„   + R1[6]     R2[2] eโ‚ƒโ‚„   + R1[6]     R2[3] eโ‚โ‚‚โ‚ƒโ‚„ - R1[6]     R2[4] eโ‚‚โ‚ƒ   + R1[6]     R2[5] eโ‚โ‚‚   - R1[6]     R2[6]       - R1[6]     R2[7] eโ‚ƒโ‚
      //
      //                      eโ‚โ‚‚โ‚ƒโ‚„โ‚โ‚‚ = -eโ‚โ‚‚โ‚ƒโ‚โ‚„โ‚‚ = eโ‚โ‚‚โ‚ƒโ‚โ‚‚โ‚„ = -eโ‚โ‚‚โ‚โ‚ƒโ‚‚โ‚„ = eโ‚โ‚‚โ‚โ‚‚โ‚ƒโ‚„ = -eโ‚ƒโ‚„
      //                                              eโ‚โ‚‚โ‚ƒโ‚„โ‚‚โ‚ƒ = -eโ‚โ‚‚โ‚ƒโ‚‚โ‚„โ‚ƒ = eโ‚โ‚‚โ‚ƒโ‚‚โ‚ƒโ‚„ = -eโ‚โ‚„
      //                                                                      eโ‚โ‚‚โ‚ƒโ‚„โ‚ƒโ‚ = -eโ‚โ‚‚โ‚„โ‚ = eโ‚‚โ‚โ‚„โ‚ = -eโ‚‚โ‚„
      //                                                                                            eโ‚โ‚‚โ‚ƒโ‚„โ‚ƒโ‚„ = -eโ‚โ‚‚            eโ‚โ‚‚โ‚ƒโ‚„โ‚โ‚„ = -eโ‚โ‚‚โ‚ƒโ‚ = eโ‚โ‚‚โ‚โ‚ƒ = -eโ‚‚โ‚ƒ
      //                                                                                                                                              eโ‚โ‚‚โ‚ƒโ‚„โ‚‚โ‚„ = -eโ‚โ‚‚โ‚ƒโ‚‚ = eโ‚โ‚ƒ = -eโ‚ƒโ‚
      + R1[7] eโ‚โ‚‚โ‚ƒโ‚„ R2[0]   - R1[7]     R2[1] eโ‚ƒโ‚„   - R1[7]     R2[2] eโ‚โ‚„   - R1[7]     R2[3] eโ‚‚โ‚„   - R1[7]     R2[4] eโ‚โ‚‚   - R1[7]     R2[5] eโ‚‚โ‚ƒ   - R1[7]     R2[6] eโ‚ƒโ‚   + R1[7]     R2[7]

clean up and no notes (btw i made 4 mistakes here before having it checked for correctness)

R1*R2 = (R1[0] + R1[1] eโ‚โ‚‚ + R1[2] eโ‚‚โ‚ƒ + R1[3] eโ‚ƒโ‚ + R1[4] eโ‚ƒโ‚„ + R1[5] eโ‚โ‚„ + R1[6] eโ‚‚โ‚„ + R1[7] eโ‚โ‚‚โ‚ƒโ‚„)
      * (R2[0] + R2[1] eโ‚โ‚‚ + R2[2] eโ‚‚โ‚ƒ + R2[3] eโ‚ƒโ‚ + R2[4] eโ‚ƒโ‚„ + R2[5] eโ‚โ‚„ + R2[6] eโ‚‚โ‚„ + R2[7] eโ‚โ‚‚โ‚ƒโ‚„)

      = R1[0] R2[0]     + R1[0] R2[1] eโ‚โ‚‚   + R1[0] R2[2] eโ‚‚โ‚ƒ   + R1[0] R2[3] eโ‚ƒโ‚   + R1[0] R2[4] eโ‚ƒโ‚„   + R1[0] R2[5] eโ‚โ‚„   + R1[0] R2[6] eโ‚‚โ‚„   + R1[0] R2[7] eโ‚โ‚‚โ‚ƒโ‚„
      + R1[1] R2[0] eโ‚โ‚‚ - R1[1] R2[1]       - R1[1] R2[2] eโ‚ƒโ‚   + R1[1] R2[3] eโ‚‚โ‚ƒ   + R1[1] R2[4] eโ‚โ‚‚โ‚ƒโ‚„ - R1[1] R2[5] eโ‚‚โ‚„   + R1[1] R2[6] eโ‚โ‚„   - R1[1] R2[7] eโ‚ƒโ‚„
      + R1[2] R2[0] eโ‚‚โ‚ƒ + R1[2] R2[1] eโ‚ƒโ‚   - R1[2] R2[2]       - R1[2] R2[3] eโ‚โ‚‚   + R1[2] R2[4] eโ‚‚โ‚„   + R1[2] R2[5] eโ‚โ‚‚โ‚ƒโ‚„ - R1[2] R2[6] eโ‚ƒโ‚„   - R1[2] R2[7] eโ‚โ‚„
      + R1[3] R2[0] eโ‚ƒโ‚ - R1[3] R2[1] eโ‚‚โ‚ƒ   + R1[3] R2[2] eโ‚โ‚‚   - R1[3] R2[3]       - R1[3] R2[4] eโ‚โ‚„   + R1[3] R2[5] eโ‚ƒโ‚„   + R1[3] R2[6] eโ‚โ‚‚โ‚ƒโ‚„ - R1[3] R2[7] eโ‚‚โ‚„
      + R1[4] R2[0] eโ‚ƒโ‚„ + R1[4] R2[1] eโ‚โ‚‚โ‚ƒโ‚„ - R1[4] R2[2] eโ‚‚โ‚„   + R1[4] R2[3] eโ‚โ‚„   - R1[4] R2[4]       - R1[4] R2[5] eโ‚ƒโ‚   + R1[4] R2[6] eโ‚‚โ‚ƒ   - R1[4] R2[7] eโ‚โ‚‚
      + R1[5] R2[0] eโ‚โ‚„ + R1[5] R2[1] eโ‚‚โ‚„   + R1[5] R2[2] eโ‚โ‚‚โ‚ƒโ‚„ - R1[5] R2[3] eโ‚ƒโ‚„   + R1[5] R2[4] eโ‚ƒโ‚   - R1[5] R2[5]       - R1[5] R2[6] eโ‚โ‚‚   - R1[5] R2[7] eโ‚‚โ‚ƒ
      + R1[6] R2[0] eโ‚‚โ‚„ - R1[6] R2[1] eโ‚โ‚„   + R1[6] R2[2] eโ‚ƒโ‚„   + R1[6] R2[3] eโ‚โ‚‚โ‚ƒโ‚„ - R1[6] R2[4] eโ‚‚โ‚ƒ   + R1[6] R2[5] eโ‚โ‚‚   - R1[6] R2[6]       - R1[6] R2[7] eโ‚ƒโ‚

      + R1[7] R2[0] eโ‚โ‚‚โ‚ƒโ‚„ - R1[7] R2[1] eโ‚ƒโ‚„   - R1[7] R2[2] eโ‚โ‚„   - R1[7] R2[3] eโ‚‚โ‚„   - R1[7] R2[4] eโ‚โ‚‚   - R1[7] R2[5] eโ‚‚โ‚ƒ   - R1[7] R2[6] eโ‚ƒโ‚   + R1[7] R2[7]

Collect

R'[0] s     = R1[0] R2[0] - R1[1] R2[1] - R1[2] R2[2] - R1[3] R2[3] - R1[4] R2[4] - R1[5] R2[5] - R1[6] R2[6] + R1[7] R2[7]
R'[1] eโ‚โ‚‚   = R1[0] R2[1] + R1[1] R2[0] - R1[2] R2[3] + R1[3] R2[2] - R1[4] R2[7] - R1[5] R2[6] + R1[6] R2[5] - R1[7] R2[4]
R'[2] eโ‚‚โ‚ƒ   = R1[0] R2[2] + R1[1] R2[3] + R1[2] R2[0] - R1[3] R2[1] + R1[4] R2[6] - R1[5] R2[7] - R1[6] R2[4] - R1[7] R2[5]
R'[3] eโ‚ƒโ‚   = R1[0] R2[3] - R1[1] R2[2] + R1[2] R2[1] + R1[3] R2[0] - R1[4] R2[5] + R1[5] R2[4] - R1[6] R2[7] - R1[7] R2[6]
R'[4] eโ‚ƒโ‚„   = R1[0] R2[4] - R1[1] R2[7] - R1[2] R2[6] + R1[3] R2[5] + R1[4] R2[0] - R1[5] R2[3] + R1[6] R2[2] - R1[7] R2[1]
R'[5] eโ‚โ‚„   = R1[0] R2[5] + R1[1] R2[6] - R1[2] R2[7] - R1[3] R2[4] + R1[4] R2[3] + R1[5] R2[0] - R1[6] R2[1] - R1[7] R2[2]
R'[6] eโ‚‚โ‚„   = R1[0] R2[6] - R1[1] R2[5] + R1[2] R2[4] - R1[3] R2[7] - R1[4] R2[2] + R1[5] R2[1] + R1[6] R2[0] - R1[7] R2[3]
R'[7] eโ‚โ‚‚โ‚ƒโ‚„ = R1[0] R2[7] + R1[1] R2[4] + R1[2] R2[5] + R1[3] R2[6] + R1[4] R2[1] + R1[5] R2[2] + R1[6] R2[3] + R1[7] R2[0]

Code (old eโ‚โ‚‚!)

static multiplyHB(a: Rot4, b: Rot4): Rot4 {

    const s1 = a[0], xy1 = a[1], yz1 = a[2], zx1 = a[3], zw1 = a[4], xw1 = a[5], yw1 = a[6], p1 = a[7];
    const s2 = b[0], xy2 = b[1], yz2 = b[2], zx2 = b[3], zw2 = b[4], xw2 = b[5], yw2 = b[6], p2 = b[7];

    const s = (s1 * s2) - (xy1 * xy2) - (yz1 * yz2) - (zx1 * zx2) - (zw1 * zw2) - (xw1 * xw2) - (yw1 * yw2) + (p1 * p2);
    const exy = (s1 * xy2) + (xy1 * s2) - (yz1 * zx2) + (zx1 * yz2) - (zw1 * p2) - (xw1 * yw2) + (yw1 * xw2) - (p1 * zw2);
    const eyz = (s1 * yz2) + (xy1 * zx2) + (yz1 * s2) - (zx1 * xy2) + (zw1 * yw2) - (xw1 * p2) - (yw1 * zw2) - (p1 * xw2);
    const ezx = (s1 * zx2) - (xy1 * yz2) + (yz1 * xy2) + (zx1 * s2) - (zw1 * xw2) + (xw1 * zw2) - (yw1 * p2) - (p1 * yw2);
    const ezw = (s1 * zw2) - (xy1 * p2) - (yz1 * yw2) + (zx1 * xw2) + (zw1 * s2) - (xw1 * zx2) + (yw1 * yz2) - (p1 * xy2);
    const exw = (s1 * xw2) + (xy1 * yw2) - (yz1 * p2) - (zx1 * zw2) + (zw1 * zx2) + (xw1 * s2) - (yw1 * xy2) - (p1 * yz2);
    const eyw = (s1 * yw2) - (xy1 * xw2) + (yz1 * zw2) - (zx1 * p2) - (zw1 * yz2) + (xw1 * xy2) + (yw1 * s2) - (p1 * zx2);
    const exyzw = (s1 * p2) + (xy1 * zw2) + (yz1 * xw2) + (zx1 * yw2) + (zw1 * xy2) + (xw1 * yz2) + (yw1 * zx2) + (p1 * s2);

    const out = new Float32Array([s, exy, eyz, ezx, ezw, exw, eyw, exyzw]);

    return out;

}

New Code for eโ‚‚โ‚ƒ eโ‚ƒโ‚ eโ‚โ‚‚ eโ‚โ‚„ eโ‚‚โ‚„ eโ‚ƒโ‚„

// MARK: Rotate

/**
 * Rotates a vector 'v' by rotor 'r' using the Sandwich Product RฬƒvR
 * Derived manually
 * 
 */
static rotateVector4(r: Rot4, v: Vec4): Vec4 {
    const s = r[0], yz = r[1], zx = r[2], xy = r[3],
        xw = r[4], yw = r[5], zw = r[6], p = r[7];

    // Helper squares
    const s_2 = s * s;
    const yz_2 = yz * yz, zx_2 = zx * zx, xy_2 = xy * xy;
    const xw_2 = xw * xw, yw_2 = yw * yw, zw_2 = zw * zw;
    const p_2 = p * p;

    const out = new Float32Array(4);

    // (sยฒ - Iยฒ)v  + 2s(v ยท B) + 2I(v โˆง B) + 2(v ยท B)B  - vBยฒ

    // ((())) looks stupid but makes it wgsl-safe

    out[0] = ((s_2 - p_2 - xy_2 + yz_2 - zx_2 + zw_2 - xw_2 + yw_2) * v[0])
        + (2 * ((s * -xy) + (p * -zw) + (yz * zx) - (yw * xw)) * v[1])
        + (2 * ((s * zx) + (p * yw) + (yz * xy) - (zw * xw)) * v[2])
        + (2 * ((s * -xw) + (p * -yz) - (zw * zx) + (yw * xy)) * v[3]);

    out[1] = (2 * ((s * xy) + (p * zw) + (zx * yz) - (xw * yw)) * v[0])
        + ((s_2 - p_2 - xy_2 - yz_2 + zx_2 + zw_2 + xw_2 - yw_2) * v[1])
        + (2 * ((s * -yz) + (p * -xw) + (zx * xy) - (zw * yw)) * v[2])
        + (2 * ((s * -yw) + (p * -zx) + (zw * yz) - (xw * xy)) * v[3]);

    out[2] = (2 * ((s * -zx) + (p * -yw) + (xy * yz) - (xw * zw)) * v[0])
        + (2 * ((s * yz) + (p * xw) + (xy * zx) - (yw * zw)) * v[1])
        + ((s_2 - p_2 + xy_2 - yz_2 - zx_2 - zw_2 + xw_2 + yw_2) * v[2])
        + (2 * ((s * -zw) + (p * -xy) + (xw * zx) - (yw * yz)) * v[3]);

    out[3] = (2 * ((s * xw) + (p * yz) + (xy * yw) - (zx * zw)) * v[0])
        + (2 * ((s * yw) + (p * zx) - (xy * xw) + (yz * zw)) * v[1])
        + (2 * ((s * zw) + (p * xy) - (yz * yw) + (zx * xw)) * v[2])
        + ((s_2 - p_2 + xy_2 + yz_2 + zx_2 - zw_2 - xw_2 - yw_2) * v[3]);

    return out;
}

// MARK: Export

static toMat4(r: Rot4): Mat4 {
    const s = r[0], yz = r[1], zx = r[2], xy = r[3],
        xw = r[4], yw = r[5], zw = r[6], p = r[7];

    // Helper squares
    const s_2 = s * s;
    const yz_2 = yz * yz, zx_2 = zx * zx, xy_2 = xy * xy;
    const xw_2 = xw * xw, yw_2 = yw * yw, zw_2 = zw * zw;
    const p_2 = p * p;

    const out = MAT4_IDENTITY.slice();

    // all vโ‚™ parts IN TO OUT v'โ‚ to v'โ‚„ - COLUMN MAYOR!!

    // COLUMN 0 (Basis X: v=[1, 0, 0, 0])  
    out[0] = (s_2 - p_2 - xy_2 + yz_2 - zx_2 + zw_2 - xw_2 + yw_2);
    out[1] = 2 * ((s * xy) + (p * zw) + (zx * yz) - (xw * yw));
    out[2] = 2 * ((s * -zx) + (p * -yw) + (xy * yz) - (xw * zw));
    out[3] = 2 * ((s * xw) + (p * yz) + (xy * yw) - (zx * zw));

    // COLUMN 1 (Basis Y: v=[0, 1, 0, 0])
    out[4] = 2 * ((s * -xy) + (p * -zw) + (yz * zx) - (yw * xw));
    out[5] = (s_2 - p_2 - xy_2 - yz_2 + zx_2 + zw_2 + xw_2 - yw_2);
    out[6] = 2 * ((s * yz) + (p * xw) + (xy * zx) - (yw * zw));
    out[7] = 2 * ((s * yw) + (p * zx) - (xy * xw) + (yz * zw));

    // COLUMN 2 (Basis Z: v=[0, 0, 1, 0])
    out[8] = 2 * ((s * zx) + (p * yw) + (yz * xy) - (zw * xw));
    out[9] = 2 * ((s * -yz) + (p * -xw) + (zx * xy) - (zw * yw));
    out[10] = (s_2 - p_2 + xy_2 - yz_2 - zx_2 - zw_2 + xw_2 + yw_2);
    out[11] = 2 * ((s * zw) + (p * xy) - (yz * yw) + (zx * xw));

    // COLUMN 3 (Basis W: v=[0, 0, 0, 1])
    out[12] = 2 * ((s * -xw) + (p * -yz) - (zw * zx) + (yw * xy));
    out[13] = 2 * ((s * -yw) + (p * -zx) + (zw * yz) - (xw * xy));
    out[14] = 2 * ((s * -zw) + (p * -xy) + (xw * zx) - (yw * yz));
    out[15] = (s_2 - p_2 + xy_2 + yz_2 + zx_2 - zw_2 - xw_2 - yw_2);

    return out;
}

// MARK: Rร—R

// Rotor4-Rotor4 Product
static multiply(a: Rot4, b: Rot4): Rot4 {

    const s1 = a[0], yz1 = a[1], zx1 = a[2], xy1 = a[3], xw1 = a[4], yw1 = a[5], zw1 = a[6], p1 = a[7];
    const s2 = b[0], yz2 = b[1], zx2 = b[2], xy2 = b[3], xw2 = b[4], yw2 = b[5], zw2 = b[6], p2 = b[7];

    const s = (s1 * s2) - (xy1 * xy2) - (yz1 * yz2) - (zx1 * zx2) - (zw1 * zw2) - (xw1 * xw2) - (yw1 * yw2) + (p1 * p2);
    const eyz = (s1 * yz2) + (xy1 * zx2) + (yz1 * s2) - (zx1 * xy2) + (zw1 * yw2) - (xw1 * p2) - (yw1 * zw2) - (p1 * xw2);
    const exy = (s1 * xy2) + (xy1 * s2) - (yz1 * zx2) + (zx1 * yz2) - (zw1 * p2) - (xw1 * yw2) + (yw1 * xw2) - (p1 * zw2);
    const ezx = (s1 * zx2) - (xy1 * yz2) + (yz1 * xy2) + (zx1 * s2) - (zw1 * xw2) + (xw1 * zw2) - (yw1 * p2) - (p1 * yw2);
    const exw = (s1 * xw2) + (xy1 * yw2) - (yz1 * p2) - (zx1 * zw2) + (zw1 * zx2) + (xw1 * s2) - (yw1 * xy2) - (p1 * yz2);
    const eyw = (s1 * yw2) - (xy1 * xw2) + (yz1 * zw2) - (zx1 * p2) - (zw1 * yz2) + (xw1 * xy2) + (yw1 * s2) - (p1 * zx2);
    const ezw = (s1 * zw2) - (xy1 * p2) - (yz1 * yw2) + (zx1 * xw2) + (zw1 * s2) - (xw1 * zx2) + (yw1 * yz2) - (p1 * xy2);
    const exyzw = (s1 * p2) + (xy1 * zw2) + (yz1 * xw2) + (zx1 * yw2) + (zw1 * xy2) + (xw1 * yz2) + (yw1 * zx2) + (p1 * s2);

    const out = new Float32Array([s, eyz, ezx, exy, exw, eyw, ezw, exyzw]);

    return out;

}

Current PTF

Hintergrund ändern. Verbraucht keinen oder einen ๐Ÿช.

Verknüpften Viewport öffnen

๐ŸŽฎ Steuerung
Dokumentation ๐Ÿ•น๏ธ
Sie sind leider kein Entwickler :(

Content Nodes Amount

Diligence / PTF Amount

FPS

Vertex-Count