src/abstractions/Creature.js
// each anchor position from two different grid configurations (cube and plane)
each anchor position from two different grid configurations (cube and plane)
each anchor position from two different grid configurations ( cube and plane )
createAnchors (length = Store.creature.anchorsLength.get()) {
    const CUBE = arrayPoints.cube(length)
    const PLANE = shuffle(arrayPoints.plane(length), Prng.random)
    const anchors = []
    for (let index = 0; index < length; index++) {
      const anchor = new Anchor({ addTo: this.anchor })
      anchor.positions = { CUBE: CUBE[index], PLANE: PLANE[index] }
      anchor.dot = new Shape({
        addTo: anchor,
        color: 'white',
        translate: { z: -0.1 },
        path: [{ x: 0.5, y: 0.5 }, { x: -0.5, y: 0.5 }, { x: -0.5, y: -0.5 }, { x: 0.5, y: -0.5 }],
        scale: 0
      })
      anchors.push(anchor)
    }
    anchors.forEach(anchor => {
      anchor.cubeMirror = anchors.find(candidate => {
        const { x, y, z } = candidate.positions.CUBE
        return anchor.positions.CUBE.y === y &&
          anchor.positions.CUBE.z === z &&
          anchor.positions.CUBE.x === -x
      })
    })
    return anchors
  }
createAnchors ( length = Store . creature . anchorsLength . get ( ) ) { const CUBE = arrayPoints . cube ( length ) const PLANE = shuffle ( arrayPoints . plane ( length ) , Prng . random ) const anchors = [ ] for ( let index = 0 ; index < length ; index ++ ) { const anchor = new Anchor ( { addTo : this . anchor } ) anchor . positions = { CUBE : CUBE [ index ] , PLANE : PLANE [ index ] } anchor . dot = new Shape ( { addTo : anchor , color : 'white' , translate : { z : - 0.1 } , path : [ { x : 0.5 , y : 0.5 } , { x : - 0.5 , y : 0.5 } , { x : - 0.5 , y : - 0.5 } , { x : 0.5 , y : - 0.5 } ] , scale : 0 } ) anchors . push ( anchor ) } anchors . forEach ( anchor => { anchor . cubeMirror = anchors . find ( candidate => { const { x , y , z } = candidate . positions . CUBE return anchor . positions . CUBE . y === y && anchor . positions . CUBE . z === z && anchor . positions . CUBE . x === - x } ) } ) return anchors }
each anchor position from two different grid configurations (cube and plane)
each anchor position from two different grid configurations ( cube and plane )