static tri_to_sqr_coords(origin_d, [x, y, z]) {
    // NOTE: simplify if-elses by checking position parameter before entering the equation
    // console.log({x, y, z});
    if (![0, 1].includes(origin_d)) {
      return console.error(`${origin_d} is not a correct position parameter`);
    }

    if (origin_d === 0) {
      origin_d = -1;
    } else if (origin_d === 1) {
      origin_d = 1;
    } // if x, y, x are all whole numbers


    if (x % 1 === 0 && y % 1 === 0 && z % 1 === 0) {
      x = z - x;
      y = -origin_d * y;

      if (origin_d === 1) {
        origin_d = 1;
      } else if (origin_d === -1) {
        origin_d = 2;
      }

      let x_axis_d = (x % 2 + origin_d) % 2;
      let y_axis_d = (y % 2 + origin_d) % 2;
      let d = ((x_axis_d + y_axis_d) % 2 + origin_d) % 2;
      return {
        x,
        y,
        d
      };
    } // FIXME: look at below code
    // This is idiotic, find another way
    // if(x % 1 === 0.5 || y % 1 === 0.5 || z % 1 === 0.5) {
    // 	x = z - x;
    // 	y = -origin_d * y;
    // 	if(origin_d ===  1) { origin_d = 1; } else
    // 	if(origin_d === -1) { origin_d = 2; }
    // 	let x_axis_d = (x % 2 + origin_d) % 2;
    // 	let y_axis_d = (y % 2 + origin_d) % 2;
    // 	let d = ((x_axis_d + y_axis_d) % 2 + origin_d) % 2;
    // 	return { x, y, d }
    // }

  }
// while output d is the orientation of module given it's coords and origin_d
while output d is the orientation of module given it's coords and origin_d
while output d is the orientation of module given it ' s coords and origin_d
static tri_to_sqr_coords(origin_d, [x, y, z]) {
    if (![0, 1].includes(origin_d)) {
      return console.error(`${origin_d} is not a correct position parameter`);
    }
    if (origin_d === 0) {
      origin_d = -1;
    } else if (origin_d === 1) {
      origin_d = 1;
    } 
    if (x % 1 === 0 && y % 1 === 0 && z % 1 === 0) {
      x = z - x;
      y = -origin_d * y;
      if (origin_d === 1) {
        origin_d = 1;
      } else if (origin_d === -1) {
        origin_d = 2;
      }
      let x_axis_d = (x % 2 + origin_d) % 2;
      let y_axis_d = (y % 2 + origin_d) % 2;
      let d = ((x_axis_d + y_axis_d) % 2 + origin_d) % 2;
      return {
        x,
        y,
        d
      };
    } 
  }
static tri_to_sqr_coords ( origin_d , [ x , y , z ] ) { if ( ! [ 0 , 1 ] . includes ( origin_d ) ) { return console . error ( ` ${ origin_d } ` ) ; } if ( origin_d === 0 ) { origin_d = - 1 ; } else if ( origin_d === 1 ) { origin_d = 1 ; } if ( x % 1 === 0 && y % 1 === 0 && z % 1 === 0 ) { x = z - x ; y = - origin_d * y ; if ( origin_d === 1 ) { origin_d = 1 ; } else if ( origin_d === - 1 ) { origin_d = 2 ; } let x_axis_d = ( x % 2 + origin_d ) % 2 ; let y_axis_d = ( y % 2 + origin_d ) % 2 ; let d = ( ( x_axis_d + y_axis_d ) % 2 + origin_d ) % 2 ; return { x , y , d } ; } }
while output d is the orientation of module given it's coords and origin_d
while output d is the orientation of module given it ' s coords and origin_d
// NOTE: simplify if-elses by checking position parameter before entering the equation // console.log({x, y, z}); // if x, y, x are all whole numbers // FIXME: look at below code // This is idiotic, find another way // if(x % 1 === 0.5 || y % 1 === 0.5 || z % 1 === 0.5) { // 	x = z - x; // 	y = -origin_d * y; // 	if(origin_d ===  1) { origin_d = 1; } else // 	if(origin_d === -1) { origin_d = 2; } // 	let x_axis_d = (x % 2 + origin_d) % 2; // 	let y_axis_d = (y % 2 + origin_d) % 2; // 	let d = ((x_axis_d + y_axis_d) % 2 + origin_d) % 2; // 	return { x, y, d } // }