Shape, java.io.Serializablepublic class Hypersphere extends java.lang.Object implements Shape, java.io.Serializable
| Modifier and Type | Field | Description |
|---|---|---|
protected double |
radius |
| Constructor | Description |
|---|---|
Hypersphere(int D) |
Creates hypersphere of the given dimension, positioned at the origin.
|
Hypersphere(int D,
double radius) |
Creates hypersphere of the given dimension and radius, positioned at the origin.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
contains(Vector r) |
Returns true if the given point lies on or in the sphere.
|
int |
D() |
Returns the spatial dimension of the shape.
|
Vector |
getPosition() |
|
double |
getRadius() |
|
double |
getVolume() |
Returns the (hyper-)volume of the enclosed region.
|
void |
setPosition(Vector position) |
Sets the position of the shape, which typically represents some central
point within it.
|
void |
setRadius(double radius) |
public Hypersphere(int D)
public Hypersphere(int D,
double radius)
public double getVolume()
Shapepublic final int D()
Shapepublic boolean contains(Vector r)
public double getRadius()
public void setRadius(double radius)
radius - The radius to set.public Vector getPosition()
public void setPosition(Vector position)
ShapesetPosition in interface Shapeposition - The new position, which is copied to an internal vector.