de.jreality.geometry

## Class SphereUtility

• public class SphereUtility
extends Object
Static methods for generating approximations to spheres. The approximations are based either on subdividing a cube, or subdividing an icosahedron. These methods are used for example in the package de.jreality.jogl for quick rendering of spherical representations of points.

Warning: the approximation methods here have an upper limit on the fineness of the approximation which they are prepared to calculate. These limits should problably be removed.

Author:
Charles Gunn
• ### Field Detail

• #### SPHERE_COARSE

public static int SPHERE_COARSE
• #### SPHERE_FINE

public static int SPHERE_FINE
• #### SPHERE_FINER

public static int SPHERE_FINER
• #### SPHERE_FINEST

public static int SPHERE_FINEST
• #### SPHERE_SUPERFINE

public static int SPHERE_SUPERFINE
• #### SPHERE_WAYFINE

public static int SPHERE_WAYFINE
• ### Method Detail

• #### dispose

public static void dispose()
• #### tessellatedIcosahedronSphere

public static IndexedFaceSet tessellatedIcosahedronSphere(int i)
• #### tessellatedIcosahedronSphere

public static IndexedFaceSet tessellatedIcosahedronSphere(int i,
boolean sharedInstance)
Return a tessellated icosahedron of order i. That is, the triangular faces of an icosahedron are binary subdivided i times, the vertices are projected onto the unit sphere, and the result is returned. If sharedInstance is true, then the returned copy is a shared instance which should not be written on. The resulting polyhedra has 20*(4^i) faces. If i>7, it is clamped to 7 and the result is returned.
Parameters:
i -
sharedInstance -
Returns:
• #### getTC

public static double[][] getTC(double[][] sphere)
• #### getTC

public static double[][] getTC(double[][] sphere,
int[] channels)
• #### tessellatedCubeSphere

public static SceneGraphComponent tessellatedCubeSphere(int i)
Return a tessellated cube of order i. That is, the square faces of an cube are evenly subdivided into i2 smaller squares, and the vertices are projected onto the unit sphere. If sharedInstance is true, then the returned copy is a shared instance which should not be written on. The resulting polyhedra has 6*(i2) faces.If i>15, it is clamped to 15 and the result is returned.
Parameters:
i -
Returns:
• #### tessellatedCubeSphere

public static SceneGraphComponent tessellatedCubeSphere(int i,
boolean sharedInstance)
• #### getSphereBoundingBox

public static Rectangle3D getSphereBoundingBox()
Return a standard bounding box for a unit sphere.
Returns:
• #### sphericalPatch

public static IndexedFaceSet sphericalPatch(double cU,
double cV,
double uSize,
double vSize,
int xDetail,
int yDetail,
• #### sphericalPatchFactory

double cV,
double uSize,
double vSize,
int xDetail,
int yDetail,
Generate a spherical patch. (cU, cV) specify the center of the patch in spherical angles (longitude, latitude) in radians.
Parameters:
cU -
cV -
uSize - wdith of the patch (longitude)
vSize - height of the patch (latitude)
n - number of sample points in u
m - number of sample points in v
r - radius of the sphere
Returns:
• #### colorizeSphere

public static void colorizeSphere(PointSet ps,
double[] center,