Skip to content

Instantly share code, notes, and snippets.

View d3x0r's full-sized avatar

Jim B d3x0r

  • Las Vegas
View GitHub Profile
@d3x0r
d3x0r / CMakeLists.txt
Created June 23, 2023 23:54
Test Mouse Cursor hiding (windows)
cmake_minimum_required(VERSION 3.1)
PROJECT( test )
add_executable( test_hide_cursor test_cursors.cc )
add_executable( test_wait_cursor test_wait.cc )
@d3x0r
d3x0r / script.js
Last active April 13, 2022 18:23 — forked from onosendi/script.js
function sleep() {
return new Promise((resolve) => {
setTimeout(resolve, 2000);
});
}
async function foo() {
while(1) {
const bar = // really big array
await sleep();
@d3x0r
d3x0r / README.md
Created February 12, 2022 02:12
General Project Updates

Projects

Some of my projects.

@d3x0r
d3x0r / AAA-Matrix.md
Last active July 8, 2020 07:21
Discussion regarding matrix composition from angle-angle-angle vectors

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 0s and 1s 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

@d3x0r
d3x0r / twist.js
Last active July 1, 2020 21:19
Twist JS Function combined
// 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
@d3x0r
d3x0r / Math.md
Last active June 19, 2020 03:33
a^2 + b^2 / c^2 <=M (=1)
 a^2 + b^2    (1)
 ---------
     c^2

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

@d3x0r
d3x0r / PathTest.js
Created June 15, 2020 12:57
Test Graph
//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) }
@d3x0r
d3x0r / lnQuat.js
Last active June 11, 2020 04:30
compute initial log quaternion
// 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;
@d3x0r
d3x0r / ABOUT.md
Created June 8, 2020 18:34
Node BackingStore Debug Crash

You can download this gist as a single repository.

build

node-gyp configure --debug
node-gyp build --debug
@d3x0r
d3x0r / ComplexNumberTest.html
Last active May 26, 2020 03:17
Testing/Learning DualComplex numbers...
<HTML>
<BODY>
<CANVAS WIDTH=1000 height=1000 ID="testSurface" style="width:500px;height:500px"></CANVAS>
<p> for (A+Be)+(C+De)i
<p> for (<SPAN ID="Aval">A</SPAN>+<SPAN ID="Bval">A</SPAN>e)+(<SPAN ID="Cval">A</SPAN>+<SPAN ID="Dval">D</SPAN>e)i
<p> A <input type="range" min="-100" max="100" id="A"></input>
<p> B <input type="range" min="-100" max="100" id="B"></input>
<p> C <input type="range" min="-100" max="100" id="C"></input>
<p> D <input type="range" min="-100" max="100" id="D"></input>