I’ve just discovered Processing, and I’m playing around with it because it seems cool.
I’m trying to draw ~30 lines of symmetry in a circle.
Well, more specifically, I’m drawing ~30 lines of symmetry in three overlapping circles, then drawing lines from the centerpoint of the 3 circles combined to the points on the circles where lines of symmetry exist.
My problem is that a circle (ellipse(240,240,120,120)); is not round. Due to the way Processing generates ellipses, the circles are ‘more round’ in some places than others.
The smooth() command is not doing too much for me, likely due to the fact that I’m working on a not-too-impressive laptop.
Is there any way to list all the points at which, for example, an ellipse() places a pixel? if I’m working with smooth(0), then all ellipses and lines are of single pixel width, which means I could simply draw from my center point to every tenth pixel drawn on the circle, for example, but I don’t know if this exists so I’m having a hard time googling it.
Thanks in advance for any help that can be provided - I’m loving processing so far.
IMHO you’re over-complicating this. Don’t try to use the output image that is drawn as input to work out where to draw other things. You already know where your circles are - because you are drawing them there. Similarly, you know where the lines of symmetry are - because you are drawing them. You don’t need to look at the drawing of your circles and lines to work out where they intersect, because you can work that out by doing some math.
PVector[] points = new PVector[90];
PVector[] centers = new PVector[3];
void setup() {
size(600, 200);
centers[0] = new PVector(100, 100);
centers[1] = new PVector(300, 100);
centers[2] = new PVector(500, 100);
int p = 0;
for ( int i = 0; i < 3; i++) {
for ( int t = 0; t < 30; t++) {
points[p] = new PVector( centers[i].x + 90 * cos(TWO_PI/30.0*t), centers[i].y + 90 * sin(TWO_PI/30.0*t));
p++;
}
}
}
void draw() {
background(0);
stroke(255);
noFill();
ellipse( centers[0].x, centers[0].y, 180, 180 );
ellipse( centers[1].x, centers[1].y, 180, 180 );
ellipse( centers[2].x, centers[2].y, 180, 180 );
for ( int i = 0; i < 3; i++) {
for ( int p = 0; p < points.length; p++) {
line( centers[i].x, centers[i].y, points[p].x, points[p].y);
}
}
}