pontos & boxes -> points

main
Alexandre B A Villares 2018-06-17 15:34:07 -03:00
rodzic ff0e7f23fd
commit 1b0fc1ec39
3 zmienionych plików z 20 dodań i 21 usunięć

Wyświetl plik

@ -4,7 +4,7 @@ String SKETCH_NAME = "s167"; // 180615
import peasy.*;
PeasyCam cam;
ArrayList<PVector> pontos;
ArrayList<PVector> points;
ArrayList<PVector[]> lines;
float space;
@ -15,7 +15,7 @@ void setup() {
cam.setMinimumDistance(100);
cam.setMaximumDistance(1000);
pontos = new ArrayList<PVector>();
points = new ArrayList<PVector>();
lines = new ArrayList<PVector[]>();
int gridDim = 10;
@ -26,12 +26,12 @@ void setup() {
float x = space/2 + ix * space - width/2 + random(-2, 2);
float y = space/2 + iy * space - width/2 + random(-2, 2);
float z = space/2 + iz * space - width/2 + random(-2, 2);
pontos.add(new PVector(x, y, z));
points.add(new PVector(x, y, z));
}
}
}
for (PVector p : pontos) {
for (PVector op : pontos) {
for (PVector p : points) {
for (PVector op : points) {
if (dist(p.x, p.y, p.z, op.x, op.y, op.z) < space) {
lines.add(new PVector[]{p, op});
}
@ -43,7 +43,7 @@ void setup() {
void draw() {
//rotateY(frameCount/1000.);
background(200);
for (PVector p : pontos) {
for (PVector p : points) {
pushMatrix();
translate(p.x, p.y, p.z);
fill(0);

Wyświetl plik

@ -3,7 +3,7 @@ SKETCH_NAME = "s167" # 180615
add_library('peasycam')
pontos, lines = [], []
points, lines = [], []
def setup():
global space
@ -21,24 +21,23 @@ def setup():
x = space / 2 + ix * space - width / 2 + random(-2, 2)
y = space / 2 + iy * space - width / 2 + random(-2, 2)
z = space / 2 + iz * space - width / 2 + random(-2, 2)
pontos.append(PVector(x, y, z))
for p in pontos:
for op in pontos:
points.append(PVector(x, y, z))
for p in points:
for op in points:
stroke(200, 0, 100)
if (dist( p.x, p.y, p.z,
op.x, op.y, op.z) < space * 1):
lines.append((p.x, p.y, p.z, op.x, op.y, op.z))
lines.append((p, op))
def draw():
background(200)
for p in pontos:
for p in points:
pushMatrix()
translate(p.x, p.y, p.z)
fill(0)
noStroke()
box(4)
popMatrix()
for l in lines:
for (p1, p2) in lines:
stroke(200, 0, 100)
px, py, pz, ox, oy, oz = l
line(px, py, pz, ox, oy, oz)
line(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z)

Wyświetl plik

@ -1,9 +1,9 @@
# Alexandre B A Villares - https://abav.lugaralgum.com / sketch - a - day
SKETCH_NAME = "s167" # 180615
SKETCH_NAME = "s168" # 180616
add_library('peasycam')
boxes, lines, walls = [], [], []
points, lines, walls = [], [], []
def setup():
global space
@ -22,9 +22,9 @@ def setup():
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)
boxes.append(PVector(x, y, z))
for p in boxes:
for op in boxes:
points.append(PVector(x, y, z))
for p in points:
for op in points:
if p != op:
stroke(200, 0, 100)
if (dist(p.x, p.y, p.z,
@ -60,7 +60,7 @@ def draw():
stroke(200, 0, 100)
line(p.x, p.y, p.z, op.x, op.y, op.z)
for p in boxes:
for p in points:
pushMatrix()
translate(p.x, p.y, p.z)
fill(0)