public class Sphere extends Shape3D
Sphere
class defines a 3 dimensional sphere with the specified size.
A Sphere
is a 3D geometry primitive created with a given radius.
It is centered at the origin.Type | Property and Description |
---|---|
DoubleProperty |
radius
Defines the radius of the Sphere.
|
cullFaceProperty, drawModeProperty, materialProperty
Modifier and Type | Class and Description |
---|---|
private static class |
Sphere.SphereKey |
Shape3D.Key
Modifier and Type | Field and Description |
---|---|
(package private) static int |
DEFAULT_DIVISIONS |
(package private) static double |
DEFAULT_RADIUS |
private int |
divisions |
private TriangleMesh |
mesh |
private DoubleProperty |
radius
Defines the radius of the Sphere.
|
Constructor and Description |
---|
Sphere()
Creates a new instance of
Sphere with radius of 1.0. |
Sphere(double radius)
Creates a new instance of
Sphere with the given radius. |
Sphere(double radius,
int divisions)
Creates a new instance of
Sphere with the given radius and number
of divisions. |
Modifier and Type | Method and Description |
---|---|
private static int |
correctDivisions(int div) |
(package private) static TriangleMesh |
createMesh(int div,
float r) |
private boolean |
doComputeContains(double localX,
double localY) |
private BaseBounds |
doComputeGeomBounds(BaseBounds bounds,
BaseTransform tx) |
private boolean |
doComputeIntersects(PickRay pickRay,
PickResultChooser pickResult) |
private NGNode |
doCreatePeer() |
private void |
doUpdatePeer() |
int |
getDivisions()
Retrieves the divisions attribute use to generate this sphere.
|
double |
getRadius()
Gets the value of the property radius.
|
DoubleProperty |
radiusProperty()
Defines the radius of the Sphere.
|
void |
setRadius(double value)
Sets the value of the property radius.
|
cullFaceProperty, drawModeProperty, getCullFace, getDrawMode, getMaterial, materialProperty, setCullFace, setDrawMode, setMaterial
public final DoubleProperty radiusProperty
getRadius()
,
setRadius(double)
static final int DEFAULT_DIVISIONS
static final double DEFAULT_RADIUS
private int divisions
private TriangleMesh mesh
private DoubleProperty radius
public Sphere()
Sphere
with radius of 1.0.
The resolution defaults to 64 divisions along the sphere's axes.public Sphere(double radius)
Sphere
with the given radius.
The resolution defaults to 64 divisions along the sphere's axes.radius
- Radiuspublic Sphere(double radius, int divisions)
Sphere
with the given radius and number
of divisions.
The resolution is defined in terms of number of subdivisions along the
sphere's axes. More divisions lead to more finely tesselated objects.
Note that divisions should be at least 1. Any value less than that will be
clamped to 1.radius
- Radiusdivisions
- Divisionspublic final void setRadius(double value)
public final double getRadius()
public final DoubleProperty radiusProperty()
getRadius()
,
setRadius(double)
public int getDivisions()
private NGNode doCreatePeer()
private void doUpdatePeer()
private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx)
private boolean doComputeContains(double localX, double localY)
private boolean doComputeIntersects(PickRay pickRay, PickResultChooser pickResult)
private static int correctDivisions(int div)
static TriangleMesh createMesh(int div, float r)