1 package eu.mihosoft.vrl.v3d;
3 import java.util.ArrayList;
7 double Radius, w, a, b, FocalLength;
18 return (a * x * x) + (b * x);
20 return (x * x) / (FocalLength * 4.0);
26 throw new NumberFormatException(
"radius can not be negative");
28 if (Math.abs(a) == 0) {
29 throw new RuntimeException(
"A value in parabola must be non zero");
39 if (Math.abs(Focus) == 0) {
40 throw new RuntimeException(
"A value in parabola must be non zero");
48 ArrayList<Vector3d> points =
new ArrayList<>();
50 for (
double i = 0; i <= 1; i += 0.05) {
51 double x = Radius * i;
60 ArrayList<Vector3d> points =
new Parabola().fromEquation(Radius, a, b).getpoints();
64 ArrayList<Vector3d> pointsOut =
new ArrayList<>();
65 for (
double i = 0; i <= 360; i += 10) {
68 pointsOut.add(p.transformed(transform));
71 return eu.mihosoft.vrl.v3d.ext.quickhull3d.HullUtil.hull(pointsOut);
74 public static CSG cone(
double Radius,
double height) {
77 public static CSG cone(
double Radius,
double height,
double b) {
85 double a=(height-(b*Radius))/(Radius*Radius);
86 ArrayList<Vector3d> points =
new Parabola().fromEquation(Radius, a, b).getpoints();
89 ArrayList<Vector3d> pointsOut =
new ArrayList<>();
90 for (
double i = 0; i <= 360; i += 10) {
93 pointsOut.add(p.transformed(transform));
96 return eu.mihosoft.vrl.v3d.ext.quickhull3d.HullUtil.hull(pointsOut);
100 ArrayList<Vector3d> points =
new Parabola().fromFocalLength(Radius, FocalLength).getpoints();
104 ArrayList<Vector3d> pointsOut =
new ArrayList<>();
105 for (
double i = 0; i <= 360; i += 10) {
108 pointsOut.add(p.transformed(transform));
111 return eu.mihosoft.vrl.v3d.ext.quickhull3d.HullUtil.hull(pointsOut);
CSG rotx(Number degreesToRotate)
static CSG points(Vector3d dir, List< Vector3d > points)
static CSG cone(double Radius, double height)
Parabola fromFocalLength(double Radius, double Focus)
static CSG extrudeByEquation(double Radius, double a, double b, double thickness)
static CSG coneByFocalLength(double Radius, double FocalLength)
ArrayList< Vector3d > getpoints()
static CSG coneByHeight(double Radius, double height, double b)
static CSG coneByEquation(double Radius, double a, double b)
double computeY(double x)
static CSG coneByHeight(double Radius, double height)
static CSG cone(double Radius, double height, double b)
Parabola fromEquation(double Radius, double a, double b)