#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# Why does this effect occur with ortho?

edited June 2017

I have a letter A, which goes in a spiral when you look at it from the top. All those positions that form the A are stored in a PShape as points. When I draw them in ortho mode I get really strange results:

why does that happen?

Tagged:

• which goes in a spiral when you look at it from the top. ... why does that happen?

Please share your code or a small sample sketch demonstrating the problem in order to get better feedback. There are so many things that "goes in a spiral" could mean.

1. You said you were in ortho mode, but the letter is free-rotated -- are you also using peasycam?
2. When you say "why does that happen" what do you mean by "that" specifically?
3. You have shown several different images, what do you do differently in order to get each image?
• edited June 2017

Here is the code and the 2 images used. Change the rotateZ to see the effect. In the OP i doubled them every time.

``````ArrayList<PVector> vecs = new ArrayList<PVector>();
PShape s;

void setup() {
size(800, 800, P3D);
foo();

s = createShape();
s.beginShape(POINTS);
s.stroke(255);
s.strokeWeight(0.5);
for (PVector v : vecs) {
s.vertex(v.x, v.y, v.z);
}
s.endShape();

}

void draw() {
ortho();
background(0);

translate(width/2, width/2, 500);
//translate(mouseX, mouseY, 0);

//translate(-(160/2), -(150/2), 0);
scale(0.5);
rotateZ(0.01);
//for (PVector v : vecs) {
//  point(v.x, v.y, v.z);
//}
shape(s);

surface.setTitle(""+frameRate);

}

void foo() {

int idx = 0;
for (int z = 0; z < a.height; z++) {
for (int x = 0; x < a.width; x++) {

int c1 = a.pixels[idx];
idx += 1;
if (c1 == -1) continue; // white

for (int y = 0; y < a.height; y++) {
int c2 = b.pixels[x + y*a.width];
if (c2 == -1) continue; // white
}

}
}

}
``````

• which image is which?

``````PImage a = loadImage("3_B.png");
``````

tells us nothing!

• (the spiral is the first one.)

if you add peasycam (and comment out the ortho) you can kind of see what it's doing - it's a point cloud and the interference between the layers is causing patterns. it's worse with ortho because all the distance layers get collapsed to one layer.

``````import peasy.*;

ArrayList<PVector> vecs = new ArrayList<PVector>();
PShape s;
PeasyCam cam;

void setup() {
size(800, 800, P3D);
foo();
cam = new PeasyCam(this, 100);

s = createShape();
s.beginShape(POINTS);
s.stroke(255);
s.strokeWeight(0.5);
for (PVector v : vecs) {
s.vertex(v.x, v.y, v.z);
}
s.endShape();
}

void draw() {
//ortho();
background(0);
shape(s);
}

void foo() {

int idx = 0;
for (int z = 0; z < a.height; z++) {
for (int x = 0; x < a.width; x++) {

int c1 = a.pixels[idx];
idx += 1;
if (c1 == -1) continue; // white

for (int y = 0; y < a.height; y++) {
int c2 = b.pixels[x + y*a.width];
if (c2 == -1) continue; // white
}
}
}
}
``````
• It seems to be more then interference, cause with a rotation of 0 I see nothing.

• That's because with no rotation all the pixels line up as they should, next to each other, making it appear solid.

(Guessing a bit here)

• That still makes no sense. Cause with 0 rotation I see nothing for example.