Magnetic class of attractors


left, right and full variants



MagneticRight
spiral01a.sca

Magnetic Left

magnetic class with left shift variation

Magnetic base algorithm

    // starting point P0 = vec3(0.0, 0.0, 0.0);
    vec3 vM[nMagnet], kM[nMagnet]; //coefficients randomly generated

    vec3 v  = point;     // actual point Pn
    vec3 vp = vec3(0.f); // destination  Pn+1

    for(int i = 0; i < nMagnet; i++) {
        vec3 vo = vM[i] - v;
        float dotProd = dot(vo,vo);
        vec3 vTmp = kM[i] * (vo / dotProd);
        vp+=transform(vTmp,i);
    }


where the transform functions are, in base to selection:

 


Magnetic rotation right

    vec3 transform(const vec3 &vx, int i) {
        switch(i%3) {
            case 0 :  return vx;
            case 1 :  return vec3(vx.z,vx.x,vx.y);
            case 2 :  return vec3(vx.y,vx.z,vx.x);
        }
        return vx;
    }

 

 

 


Magnetic rotation left

    vec3 transform(const vec3 &vx, int i) {
        switch(i%3) {
            case 0 :  return vx;
            case 1 :  return vec3(vx.y,vx.z,vx.x);
            case 2 :  return vec3(vx.z,vx.x,vx.y);
        }
        return vx;
    }

 

 

 


Magnetic full permutated

    vec3 transform(const vec3 &vx, int i) {
        switch(i%6) {
            case 0 :  return vx;
            case 1 :  return vec3(vx.y,vx.z,vx.x);
            case 2 :  return vec3(vx.z,vx.x,vx.y);
            case 3 :  return vec3(vx.x,vx.z,vx.y);
            case 4 :  return vec3(vx.z,vx.y,vx.x);
            case 5 :  return vec3(vx.y,vx.x,vx.z);
        }
        return vx;
    }

 

 

 

 


Magnetic straight

    vec3 transform(const vec3 &vx, int i)
    {
        return vx;
    }