Skip to content

Instantly share code, notes, and snippets.

@companje
Created March 25, 2024 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save companje/c434f5046ae658be42f39370f2feeef3 to your computer and use it in GitHub Desktop.
Save companje/c434f5046ae658be42f39370f2feeef3 to your computer and use it in GitHub Desktop.
Orientate circle on sphere
//...
PVector axis = PVector.cross(lens, new PVector(0, 0, -1), null);
float angle = PVector.angleBetween(lens, new PVector(0, 0, 1));
pushMatrix();
rotate(angle, axis.x, axis.y, axis.z);
translate(0, 0, height/2-3);
noFill();
stroke(0);
strokeWeight(5);
hint(DISABLE_DEPTH_TEST);
circle(0, 0, 2*lens.radius*height/2);
hint(ENABLE_DEPTH_TEST);
popMatrix();
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment