So here’s where I’m at right now. Working on a test script for debugging/figuring this out.
I have a script that can create an array of lines, but the main issue I’m having is it actually getting the proper x and y after rotation. (or maybe it’s not actually rotating, I’m not sure.)
ArrayList<Lines> lines;
float rot = 0.0;
Lines test = new Lines(0, 0, 0, 50, rot);
void setup() {
size(1920, 1080);
background(0);
lines = new ArrayList<Lines>(1000);
}
void draw() {
stroke(255);
strokeWeight(2);
//test.createShape();
for (int i = 0; i < 100; i++) {
rot = radians(i);
lines.add(i, new Lines(0 + i, 0 + i, 0, 100 + i, rot));
lines.get(i).createShape().rotate(rot);
beginShape();
for (int j = 0; j < lines.get(i).createShape().getVertexCount(); j++) {
vertex(lines.get(i).createShape().getVertexX(j), lines.get(i).createShape().getVertexY(j));
}
endShape();
shape(lines.get(i).createShape());
println(lines.get(i).createShape().getVertexCount());
}
}
class Lines {
float x1, x2, y1, y2, rot;
PShape shapey = new PShape();
Lines(float x1_, float x2_, float y1_, float y2_, float rot_){
x1 = x1_;
x2 = x2_;
y1 = y1_;
y2 = y2_;
rot = rot_;
shapey.beginShape();
shapey.vertex(x1, y1);
shapey.vertex(x2, y2);
shapey.endShape();
shapey.rotate(90);
}
PShape createShape(){
return shapey;
}
}
I also tried using your example but for a 2 vertex object, but couldn’t get the rotation to work there.
from what I’m seeing in the processing reference this should be working, so I must be missing something here.