Skip to content

Instantly share code, notes, and snippets.

@tatmos
Created October 23, 2021 22:42
Show Gist options
  • Save tatmos/2cebad41c2f7a13fe4bc25f07644b9de to your computer and use it in GitHub Desktop.
Save tatmos/2cebad41c2f7a13fe4bc25f07644b9de to your computer and use it in GitHub Desktop.
ビーズ12個のobj出力用processingファイル
import nervoussystem.obj.*;
boolean record = false;
int ssize = 50;
int llength = 80;
void setup() {
size(400, 400,P3D);
}
void draw() {
background(0);
if (record) {
beginRecord("nervoussystem.obj.OBJExport", "filename.obj");
}
translate(width/2,height/2,0);
//rotateY(45);
rotateY(radians(mouseX));
//sphere(ssize);
pushMatrix();
DrawP2();
popMatrix();
pushMatrix();
rotateY(radians(90));
rotateX(radians(90));
DrawP2();
popMatrix();
pushMatrix();
rotateY(radians(90));
rotateX(radians(90));
rotateY(radians(90));
rotateX(radians(90));
DrawP2();
popMatrix();
if (record) {
endRecord();
record = false;
}
}
void DrawP2()
{
pushMatrix();
DrawP(mouseY);
popMatrix();
pushMatrix();
rotateZ(radians(180));
DrawP(mouseY);
popMatrix();
}
void DrawP(float angle)
{
pushMatrix();
rotateX(radians(angle));
pushMatrix();
translate(0,llength,0);
sphere(ssize);
popMatrix();
popMatrix();
pushMatrix();
rotateX(-radians(angle));
pushMatrix();
translate(0,llength,0);
sphere(ssize);
popMatrix();
popMatrix();
}
void mousePressed() {
record = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment