Most visited

Recently visited

Sphere

public class Sphere
extends Geometry

java.lang.Object
   ↳ com.viro.core.Geometry
     ↳ com.viro.core.Sphere


Sphere defines a spherical shape, e.g. where every point on the surface is equidistant from the center. The center of the Sphere is placed at the origin. The surface of the Sphere is approximated by setHeightSegmentCount and setWidthSegmentCount. These define the number of divisions made along the surface to approximate the sphere.

Summary

Public constructors

Sphere(float radius)

Construct a new Sphere.

Sphere(float radius, int widthSegmentCount, int heightSegmentCount, boolean facesOutward)

Construct a new, fully parameterized Sphere.

Public methods

void dispose()

Release native resources associated with this Sphere.

boolean getFacesOutward()

Return true if the Sphere faces outward, meaning its exterior is visible.

int getHeightSegmentCount()

Get the number of segments used to approximate the Sphere across its latitude.

float getRadius()

Return the radius of the Sphere.

int getWidthSegmentCount()

Get the number of segments used to approximate the Sphere across its longitude.

void setFacesOutward(boolean facesOutward)

Set whether the Sphere faces outward or inward.

void setHeightSegmentCount(int heightSegmentCount)

Set the number of segments to use to approximate the Sphere across its latitude.

void setRadius(float radius)

Set the radius of the Sphere.

void setWidthSegmentCount(int widthSegmentCount)

Set the number of segments to use to approximate the Sphere across its longitude.

Public constructors

Sphere

Sphere (float radius)

Construct a new Sphere. The Sphere will use the default segment approximation and will face outward.

Parameters
radius float: The radius of the Sphere.

Sphere

Sphere (float radius, 
                int widthSegmentCount, 
                int heightSegmentCount, 
                boolean facesOutward)

Construct a new, fully parameterized Sphere.

Parameters
radius float: The radius of the Sphere.

widthSegmentCount int: The number of segments around the circumference of the Sphere.

heightSegmentCount int: The number of segments from the south pole to the north pole of the Sphere.

facesOutward boolean: True to have the Sphere face outward.

Public methods

dispose

void dispose ()

Release native resources associated with this Sphere.

getFacesOutward

boolean getFacesOutward ()

Return true if the Sphere faces outward, meaning its exterior is visible. If false, then the Sphere's interior will be visible.

Returns
boolean True if the Sphere faces outward.

getHeightSegmentCount

int getHeightSegmentCount ()

Get the number of segments used to approximate the Sphere across its latitude.

Returns
int The number of segments.

getRadius

float getRadius ()

Return the radius of the Sphere.

Returns
float The radius of the Sphere.

getWidthSegmentCount

int getWidthSegmentCount ()

Get the number of segments used to approximate the Sphere across its longitude.

Returns
int The number of segments.

setFacesOutward

void setFacesOutward (boolean facesOutward)

Set whether the Sphere faces outward or inward.

Outward is typically used if the Sphere is to be used as a "ball" or similar object in the scene. Inward is used if the Sphere is meant to be a globe enclosing the user (e.g. the user is inside the Sphere).

Parameters
facesOutward boolean: True to make the Sphere face outward.

setHeightSegmentCount

void setHeightSegmentCount (int heightSegmentCount)

Set the number of segments to use to approximate the Sphere across its latitude.

This is the number of segments from the Sphere's south pole to its north pole. Higher segment counts more closely resemble a true sphere, but come at a performance and memory cost.

Parameters
heightSegmentCount int: The number of width segments to use.

setRadius

void setRadius (float radius)

Set the radius of the Sphere.

Parameters
radius float: The radius.

setWidthSegmentCount

void setWidthSegmentCount (int widthSegmentCount)

Set the number of segments to use to approximate the Sphere across its longitude.

This is the number of segments across the Sphere's circumference. Higher segment counts more closely resemble a true sphere, but come at a performance and memory cost.

Parameters
widthSegmentCount int: The number of width segments to use.

Hooray!