float xCenter = 600 /2;
float yCenter = 600 /2;
float scale = 200;
float[] innerX; // store xPoints for the 6 points on the inner circle
float[] innerY; // store yPoints for the 6 points on the inner circle
float[] outerX;
float[] outerY;
void setup() {
size(600, 600); // width x height
noFill();
rectMode(CENTER);
ellipseMode(CENTER);
innerX = new float[7];
innerY = new float[7];
outerX = new float[7];
outerY = new float[7];
}
void draw() {
background(255);
noLoop();
translate(xCenter, yCenter);
calculateNinnerPoints(6, 1);
calculateNoutterPoints(6, 0.5);
// Inner circle
strokeWeight(8);
ellipse(0, 0, scale, scale);
for (int count = 0; count < 7; count ++) {
stroke(#85931E);//couleur vert
strokeWeight(8);
ellipse(innerX[count], innerY[count], scale, scale);
}
for (int count = 0; count < 7; count ++) {
stroke(#DCE01D);//couleur jaune
strokeWeight(4);
ellipse(innerX[count], innerY[count], scale, scale);
stroke(#1A0EE0);//couleur bleu
ellipse(0, 0, scale, scale);
}
// White Overlays
fill(255, 0, 0);
stroke(255);
strokeWeight(1.5);
save("motifislamic1.png");
} // end Draw
void calculateNinnerPoints(float numPoints, float scaleFactor) {
// calculate and store n points around the outer circle
int counter = 0;
double step = radians(360/numPoints);
float h = 0;
float k = 0;
float r = scale * scaleFactor / 2 ;
for (float theta=0; theta < 2 * PI; theta += step) {
float x = h + r * cos(theta);
float y = k - r * sin(theta);
// store the calculated coordinates
innerX[counter] = x;
innerY[counter] = y;
counter ++;
}
} // end calculateNinnerPoints
void calculateNoutterPoints(float numPoints, float scaleFactor) {
// calculate and store n points around the outer circle
int counter = 0;
double step = radians(360/numPoints);
float h = 0;
float k = 0;
float r = scale * scaleFactor ;
for (float theta=0; theta < 2 * PI; theta += step) {
float x = h + r * cos(theta);
float y = k - r * sin(theta);
// store the calculated coordinates
outerX[counter] = x;
outerY[counter] = y;
if (counter == 2) {
fill(255, 0, 255);
} else
{
noFill();
}
counter ++;
}
} // end calculateNoutterPoints
Hello,
Welcome to the community.
Please format your code:
https://discourse.processing.org/faq#format-your-code
:)
Hello,
The flower inside? I will assume the circle in the middle.
Try using fill() before and noFill() after the circle inside; see the references for details.
Also look up references to pushStyle() and popStyle(); sometimes I juset use push() and pop().
You may want to look up stroke() and noStroke() while you are at it.
One of the best tools in a programmer’s tool chest is knowing the resources available to you and learning to navigate, filter, and use them.
A short list of resources to peruse:
Resources < Click here to expand !
Explore the resources available here:
-
The Processing website has references, examples, tutorials, links to resources, etc.
https://processing.org/ -
The Processing PDE (IDE) has lots to offer!
An exploration of the menu bar will reveal what is available; libraries, tools, local examples, and other goodies are in there. -
The Coding Train < Experience the unbridled enthusiasm of Daniel Shiffman
https://shiffman.net/
https://www.youtube.com/user/shiffman
https://thecodingtrain.com/ -
Happy Coding
Processing Tutorials - Happy Coding -
The source code can give insight if you are adventurous:
GitHub - processing/processing: Source code for the Processing Core and Development Environment (PDE) -
Explore Processing on GitHub:
Processing Foundation · GitHub
processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub < Many of the Processing functions are here! -
The Processing Foundation
https://processingfoundation.org/
Check out the menu.
In the education menu, there is a reference to the Coding Train. -
And the Internet.
:)
:)