{{ message }}

Instantly share code, notes, and snippets.

# Jim Bd3x0r

• Las Vegas
Last active Jul 8, 2020
Discussion regarding matrix composition from angle-angle-angle vectors
View AAA-Matrix.md

This is an alternative method to get a basis from a quaternion (log quaternion)... or from angle/angle/angle. This is built by rotating the constant vectors (1,0,0), (0,1,0), (0,0,1) via standard quaternion rotation, and reducing common factors. The `0`s and `1`s collapse out a lot of the terms of apply. It ends up being less work to get the 3 vector basis than to rotate a single point; although if you USE the basis to multiply with the point; that increases the work to excess of just rotating a vector directly...

This is the base form... the steps will be broken out for phases of substitution. As implemented here https://github.com/d3x0r/STFRPhysics/blob/master/3d/src/dual-quat.js#L347

Last active Jul 1, 2020
Twist JS Function combined
View twist.js
 // this = { x: xAngle, y:yAngle, z:zAngle, nL: |x|+|y|+|z|, nR:sqrt( xx+yy+zz ) } // nR = normRectangular // nL = normLinear function twistQuaternion(theta) { // function getBasis() { // computes xyz basis vectors (matrix) // this is angle-angle-angle log-quaternion
Last active Jun 19, 2020
a^2 + b^2 / c^2 <=M (=1)
View Math.md
`````` a^2 + b^2    (1)
---------
c^2
``````

Law of cosines, replace C in terms of A and B and Theta...

Created Jun 15, 2020
Test Graph
View PathTest.js
 //const JSOX = require( "./jsox.js" ); let nodes = 0; function node() { nodes++; this.id = nodes; this.mates = []; } node.prototype.add = function(n) { this.mates.push(n) } node.prototype.isEdge = function(x) { return this.mates.find(m=>m===x) }
Last active Jun 11, 2020
compute initial log quaternion
View lnQuat.js
 // theta - angle in radians, d = {x, y, z } direction/unnormalized function lnQuat( theta, d ){ // if no rotation, then nothing. const dl = 1/Math.sqrt( d.x*d.x + d.y*d.y + d.z*d.z ); // 1/ d length = normalize d const t = theta/2; const ct2 = Math.cos( t ); // sqrt( 1/2(1 + cos theta)) - half angle subst const st2 = Math.sin( t ); // sqrt( 1/2(1 - cos theta)) - half angle subst const w = ct2; const x = dl * d.x * st2;
Created Jun 8, 2020
Node BackingStore Debug Crash

build

``````node-gyp configure --debug
node-gyp build --debug
``````
Last active May 26, 2020
Testing/Learning DualComplex numbers...
View ComplexNumberTest.html


for (A+Be)+(C+De)i

for (A+Ae)+(A+De)i

A

B

C

D

Last active May 18, 2020
Trust in the Optimizer ???
View test.c
 // test available here // https://godbolt.org/z/EiXxwW // This is the basic function int upTree( int N ) { int n; for( n = 0; n < 32; n++ ) if( !(N&(1<
Last active May 10, 2020
Get the preferred folding direction for a quad; assuming 'best' is 'contains most inner space'
This function calculat(ed) the lengths of the diagonals of the quad `p1 -> p3` and `p2 -> p4`, and resulted with a fold on the shortest of the diagonals. That works in some cases.