CI Ring/Torus

https://www.dropbox.com/s/arwm3c7uw20sylp/stroked%20circle%20with%20aspect%20ratio.qtz

Made a composition that uses a cikernel to draw a stroked circle (torus) with aspect ratio control.


//gtoledo 2013
float torus( const in vec2 p, const in float r1, const in float r2 ){
vec2 q = vec2(length(p.xy)-r1);
return length(q)-r2;
}

kernel vec4 points(__color ringColor, vec2 resolution, float majRadius, float minRadius, float aspectRatio,vec2 shift, float ringSize, float steps){

float epsilon=000001;
vec2 p = ((destCoord()/resolution.xy)- vec2( 0.5, 0.5 ))*(1./ringSize);
p.y /= aspectRatio;
  float x=p.x-shift.x;
  float y=p.y-shift.y;

  float a= 1.-torus(vec2(x,y),majRadius,minRadius);

    vec3 d=(vec3(a)/abs(steps+1.+epsilon));//dim

    return vec4(vec3(d)*ringColor.rgb,1.0);
  }