Class Sphere.SphereMeshApproximationBuilder
java.lang.Object
org.apache.commons.geometry.euclidean.threed.shape.Sphere.SphereMeshApproximationBuilder
- Enclosing class:
Sphere
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
FieldsModifier and TypeFieldDescriptionprivate final SimpleTriangleMesh.Builder
Mesh builder object.private final Sphere
The sphere that an approximation is being created for.private final int
The number of triangular subdivisions to use. -
Constructor Summary
ConstructorsConstructorDescriptionSphereMeshApproximationBuilder
(Sphere sphere, int subdivisions) Construct a new builder for creating a mesh approximation of the given sphere. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addSubdivided
(Vector3D p1, Vector3D p2, Vector3D p3, int level) Recursively subdivide and add triangular faces between the given outer boundary points.build()
Build the mesh approximation of the configured sphere.
-
Field Details
-
sphere
The sphere that an approximation is being created for. -
subdivisions
private final int subdivisionsThe number of triangular subdivisions to use. -
builder
Mesh builder object.
-
-
Constructor Details
-
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 Details
-
build
Build the mesh approximation of the configured sphere.- Returns:
- the mesh approximation of the configured sphere
-
addSubdivided
Recursively subdivide and add triangular faces between the given outer boundary points.- Parameters:
p1
- first pointp2
- second pointp3
- third pointlevel
- recursion level; counts up
-