Here’s some code I’m using to generate a color wheel (you can copy-paste this into your PDE and it should run just fine):
void setup() {
size(500, 500);
noStroke();
background(255);
colorMode(HSB, 360, 100, 100);
}
void draw() {
cw(width/2, height/2, 200, 5);
}
void cw(float x, float y, float r, float spacer) {
pushMatrix(); translate(x, y); rotate(radians(-90));
for(int i = 0; i < 360; i+= spacer) {
float x1 = pcx(r, i); float x2 = pcx(r, i+1.5 + spacer);
float y1 = pcy(r, i); float y2 = pcy(r, i+1.5 + spacer);
noStroke();
fill(i, 80, 90);
triangle(0, 0, x1, y1, x2, y2);
}
fill(0, 0, 100); ellipse(0, 0, r*1.05, r*1.05);
popMatrix();
}
float pcx(float r, float theta) { return r * cos(radians(theta)); }
float pcy(float r, float theta) { return r * sin(radians(theta)); }
I want to flip this output horizontally, so that it would look like this:
I’ve tried scale(-1, 1)
followed by translate
but to no avail.
Would be very grateful if you help me out with this. Thank you.