Skip to content

Commit

Permalink
169
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Jun 17, 2018
1 parent 1b0fc1e commit 8085f17
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ Hi! I'm [Alexandre Villares](https://abav.lugaralgum.com), let's see if I can ma

If you enjoy this, make a small donation [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HCGAKACDMVNV2) or with [Patreon](https://patreon.com/arteprog)

----

![s169](s169/s169.png)

169:[code](https://github.com/villares/sketch-a-day/tree/master/s169) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

Now same Z lines can form floors.

----

![s168](s168/s168.png)

168:[code](https://github.com/villares/sketch-a-day/tree/master/s168) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

No random movent in Z so no line connections in Z, comparing some lines to make translucent 'walls'.
No random movement in Z so no line connections between different (Z) levels. Comparing lines with different Zs to create translucent 'walls'.

----

Expand Down
Binary file added s169/s169.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions s169/s169.pyde
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Alexandre B A Villares - https://abav.lugaralgum.com / sketch - a - day
SKETCH_NAME = "s169" # 180617

add_library('peasycam')

points, lines, walls, floors = [], [], [], []

def setup():
global space
size(600, 600, P3D)
# hint(DISABLE_DEPTH_TEST)
strokeWeight(2)
# noSmooth()
cam = PeasyCam(this, 100)
cam.setMinimumDistance(100)
cam.setMaximumDistance(1000)
grid_dim = 10
space = width / grid_dim

for ix in range(grid_dim):
for iy in range(grid_dim):
for iz in range(grid_dim):
x = space / 2 + ix * space - width / 2 + random(2)
y = space / 2 + iy * space - width / 2 + random(2)
z = space / 2 + iz * space - width / 2 # + random(-2, 2)
points.append(PVector(x, y, z))

for p1 in points:
for p2 in points:
if p1 != p2:
stroke(200, 0, 100)
if (dist(p1.x, p1.y, p1.z,
p2.x, p2.y, p2.z) < space * 1):
lines.append((p1, p2))

for (p1, p2) in lines:
for (p3, p4) in lines:
if p1 != p3 and p1 != p4 and p2 != p3 and p2 != p4:
# walls
if p1.z == p2.z and p3.z == p4.z and p1.z != p3.z:
if (dist(p1.x, p1.y, p1.z,
p3.x, p3.y, p3.z) < space + 3 and
dist(p2.x, p2.y, p2.z,
p4.x, p4.y, p4.z) < space + 3):
walls.append((p1, p2, p3, p4))
# floors
if p1.z == p2.z and p3.z == p4.z and p1.z == p3.z:
if (dist(p1.x, p1.y, p1.z,
p3.x, p3.y, p3.z) < space + 3 and
dist(p2.x, p2.y, p2.z,
p4.x, p4.y, p4.z) < space + 3):
floors.append((p1, p2, p3, p4))

println(len(floors))


def draw():
background(200)
noStroke()

fill(0, 0, 200, 100)
for (p1, p2, p3, p4) in walls:
beginShape()
vertex(p1.x, p1.y, p1.z)
vertex(p2.x, p2.y, p2.z)
vertex(p4.x, p4.y, p4.z)
vertex(p3.x, p3.y, p3.z)
endShape(CLOSE)

fill(200, 100, 0)
for (p1, p2, p3, p4) in floors:
beginShape()
vertex(p1.x, p1.y, p1.z)
vertex(p2.x, p2.y, p2.z)
vertex(p4.x, p4.y, p4.z)
vertex(p3.x, p3.y, p3.z)
endShape(CLOSE)

for (p1, p2) in lines:
stroke(200, 0, 100)
line(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z)

for p in points:
pushMatrix()
translate(p.x, p.y, p.z)
fill(0)
noStroke()
box(2)
popMatrix()

0 comments on commit 8085f17

Please sign in to comment.