Class Sphere.SphereMeshApproximationBuilder
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.threed.shape.Sphere.SphereMeshApproximationBuilder
-
- Enclosing class:
- Sphere
private static final class Sphere.SphereMeshApproximationBuilder extends java.lang.Object
Internal class used to construct geodesic mesh sphere approximations. The class begins with an octahedron inscribed in the sphere and then subdivides each triangular face a specified number of times.
-
-
Field Summary
Fields Modifier and Type Field Description private SimpleTriangleMesh.Builder
builder
Mesh builder object.private Sphere
sphere
The sphere that an approximation is being created for.private int
subdivisions
The number of triangular subdivisions to use.
-
Constructor Summary
Constructors Constructor Description SphereMeshApproximationBuilder(Sphere sphere, int subdivisions)
Construct a new builder for creating a mesh approximation of the given sphere.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addSubdivided(Vector3D p1, Vector3D p2, Vector3D p3, int level)
Recursively subdivide and add triangular faces between the given outer boundary points.SimpleTriangleMesh
build()
Build the mesh approximation of the configured sphere.
-
-
-
Field Detail
-
sphere
private final Sphere sphere
The sphere that an approximation is being created for.
-
subdivisions
private final int subdivisions
The number of triangular subdivisions to use.
-
builder
private final SimpleTriangleMesh.Builder builder
Mesh builder object.
-
-
Constructor Detail
-
SphereMeshApproximationBuilder
SphereMeshApproximationBuilder(Sphere sphere, int subdivisions)
Construct a new builder for creating a mesh approximation of the given sphere.- Parameters:
sphere
- the sphere to create an approximation ofsubdivisions
- the number of triangle subdivisions to use in mesh creation
-
-
Method Detail
-
build
public SimpleTriangleMesh build()
Build the mesh approximation of the configured sphere.- Returns:
- the mesh approximation of the configured sphere
-
-