-
Notifications
You must be signed in to change notification settings - Fork 0
/
StrangeCircles.pde
66 lines (56 loc) · 1.68 KB
/
StrangeCircles.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
class StrengeCircles
{
float angle = 0.0001;
float radius = 0.01, angleChange = 0.1;
int amount = 1000, numberOfCircles = 30;
PVector[] point = new PVector[amount];
PVector[] center = new PVector[numberOfCircles];
Function[] fun = new Function[3];
StrengeCircles(float rad, float angleChange_, int amo)
{
amount = amo;
radius = rad;
angleChange = angleChange_;
for (int i = 0; i < numberOfCircles; i++)
{
center[i] = new PVector(0, 0);
}
for (int i = 0; i < amount; i++)
{
point[i] = new PVector(1, 1);
}
fun[0] = new Function(angle, angle);
fun[1] = new Function(point[curIndex].x, point[curIndex].x);
fun[2] = new Function(point[curIndex].y, point[curIndex].y);
}
void reset()
{
angle = 0.0000;
for (int i = 0; i<point.length; i++)
{
point[i] = new PVector(0, 0);
}
}
void calculations()
{
for (int i = 0; i < amount; i++)
{
point[i].x = radius * cos(angle);
point[i].y = radius * sin(angle);
angle += angleChange;
}
}
void drawing()
{
for (int i = 0; i < amount; i++)
{
translate(point[i].y, point[i].x);
//finding the smallest and largest limit values used to change the color of objects
fun[0].findingTheItem(angle);
fun[1].findingTheItem(point[i].x);
fun[2].findingTheItem(point[i].y);
stroke((map(angle, fun[0].smallestItem, fun[0].largestItem, 10, 255)), (map(point[i].x, fun[1].smallestItem, fun[1].largestItem, 10, 255)), (map(point[i].y, fun[2].smallestItem, fun[2].largestItem, 10, 255)));
point(point[i].x, point[i].y);
}
}
}