Last active
December 24, 2017 02:03
-
-
Save Octogonapus/3254044f51b38f752cd49b4a326728d6 to your computer and use it in GitHub Desktop.
Place CSGs along an ellipse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSG getEllipse(double xRadius, double yRadius, double z) { | |
List<Vector3d> points = []; | |
for (double i = 0; i < 2 * Math.PI; i += 0.01) { | |
points.add(new Vector3d((xRadius*yRadius*Math.cos(i)) / Math.sqrt((Math.pow((yRadius*Math.cos(i)), 2) + Math.pow((xRadius*Math.sin(i)), 2))), | |
(xRadius*yRadius*Math.sin(i)) / Math.sqrt((Math.pow((yRadius*Math.cos(i)), 2) + Math.pow((xRadius*Math.sin(i)), 2))), | |
0)); | |
} | |
return Extrude.points(new Vector3d(0, 0, z), points); | |
} | |
return getEllipse(8, 4, 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment