AI-generated Key Takeaways
-
Sphereis a mathematical representation used for intersection and collision tests. -
It provides constructors to create spheres with specified centers and radii, defaulting to (0,0,0) and radius 1 if not provided.
-
Public methods allow access and modification of the sphere's center and radius.
-
Sphereinherits methods fromCollisionShapeandObjectfor broader functionality. -
It's primarily used within the Sceneform library for 3D interactions and collision detection.
Mathematical representation of a sphere. Used to perform intersection and collision tests against spheres.
Public Constructors
|
Sphere()
Create a sphere with a center of (0,0,0) and a radius of 1.
|
|
|
Sphere(float radius)
Create a sphere with a center of (0,0,0) and a specified radius.
|
|
Public Methods
| Vector3 |
getCenter()
Get a copy of the sphere's center.
|
| float |
getRadius()
Get the radius of the sphere.
|
| Sphere |
makeCopy()
|
| void | |
| void |
setRadius(float radius)
Set the radius of the sphere.
|
Inherited Methods
Public Constructors
public Sphere ()
Create a sphere with a center of (0,0,0) and a radius of 1.
public Sphere (float radius)
Create a sphere with a center of (0,0,0) and a specified radius.
Parameters
| radius | the radius of the sphere |
|---|
public Sphere (float radius, Vector3 center)
Create a sphere with a specified center and radius.
Parameters
| radius | the radius of the sphere |
|---|---|
| center | the center of the sphere |
Public Methods
public Vector3 getCenter ()
Get a copy of the sphere's center.
Returns
- a new vector that represents the sphere's center