In initControlPoints()
, you could change it to:
for( int i=0; i<N; i++ ) {
float ang = TAU*i/N;
int x = (int)((0.5 + 0.4*cos(ang)) * 65536);
int y = (int)((0.5 + 0.4*sin(ang)) * 65536);
color c = color( 360.0*i/N, 100, 100 );
inputs.pixels[ i ] = (x << 16) | y;
inputs.pixels[ i+N ] = c;
}
If you want some randomness, you would want to randomly generate and store N hue values in an array, sort it, and read them out in order when filling the input.pixels
.
float[] hues = new float[N];
for( int i=0; i<N; i++ ) hues[i] = random(360);
hues = sort( hues );
for( int i=0; i<N; i++ ) {
float ang = TAU*i/N;
float r = random( 0.2, 0.5 );
int x = (int)((0.5 + r*cos(ang)) * 65536);
int y = (int)((0.5 + r*sin(ang)) * 65536);
color c = color( hues[i], 100, 100 );
inputs.pixels[ i ] = (x << 16) | y;
inputs.pixels[ i+N ] = c;
}