mirror of
https://github.com/Xevion/processing-projects.git
synced 2025-12-06 01:15:57 -06:00
equilateral triangle sketch
This commit is contained in:
31
visuals/EquilateralTriangle/EquilateralTriangle.pyde
Normal file
31
visuals/EquilateralTriangle/EquilateralTriangle.pyde
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
def setup():
|
||||||
|
size(750, 750)
|
||||||
|
noLoop()
|
||||||
|
|
||||||
|
def equiTriangle(center, side):
|
||||||
|
|
||||||
|
altitude = side * (sqrt(3) / 2.0)
|
||||||
|
AM = (2.0/3.0) * altitude
|
||||||
|
BF = (1.0 / 2.0) * side
|
||||||
|
FM = (1.0 / 3.0) * altitude
|
||||||
|
|
||||||
|
a = (center[0], center[1] + AM)
|
||||||
|
b = (center[0] - BF, center[1] - FM)
|
||||||
|
c = (center[0] + BF, center[1] - FM)
|
||||||
|
|
||||||
|
return a, b, c
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
def draw():
|
||||||
|
global i
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
# background(204)
|
||||||
|
translate(width / 2.0, height / 2.0)
|
||||||
|
rotate(radians(i))
|
||||||
|
|
||||||
|
a, b, c = equiTriangle((0, 0), i)
|
||||||
|
triangle(a[0], a[1], b[0], b[1], c[0], c[1])
|
||||||
|
|
||||||
|
def mouseClicked():
|
||||||
|
loop()
|
||||||
2
visuals/EquilateralTriangle/sketch.properties
Normal file
2
visuals/EquilateralTriangle/sketch.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mode=Python
|
||||||
|
mode.id=jycessing.mode.PythonMode
|
||||||
@@ -6,4 +6,6 @@ All my projects attempting to create vivid or interesting visuals using the Proc
|
|||||||
|
|
||||||
## Sketches
|
## Sketches
|
||||||
|
|
||||||
- **CircleIntersection** Plots circles in places where others aren't, expoonentially becoming slower and slower with each successfully located spot. Somewhat buggy and needs tuning to become much faster using a better algorithm, and probably better methods for deciding where spots are (less random, more organized manner).
|
- **CircleIntersection** Plots circles in places where others aren't, expoonentially becoming slower and slower with each successfully located spot. Somewhat buggy and needs tuning to become much faster using a better algorithm, and probably better methods for deciding where spots are (less random, more organized manner).
|
||||||
|
|
||||||
|
- **EquilateralTriangle** Places squares in increasing size whilst rotating.
|
||||||
Reference in New Issue
Block a user