Class Sphere
- java.lang.Object
-
- pro.streem.ar.sceneform.collision.CollisionShape
-
- pro.streem.ar.sceneform.collision.Sphere
-
public class Sphere extends CollisionShape
Mathematical representation of a sphere. Used to perform intersection and collision tests against spheres.
-
-
Constructor Summary
Constructors Constructor Description 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.Sphere(float radius, Vector3 center)Create a sphere with a specified center and radius.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanboxIntersection(Box box)Vector3getCenter()Get a copy of the sphere's center.floatgetRadius()Get the radius of the sphere.SpheremakeCopy()protected booleanrayIntersection(Ray ray, RayHit result)voidsetCenter(Vector3 center)Set the center of this sphere.voidsetRadius(float radius)Set the radius of the sphere.protected booleanshapeIntersection(CollisionShape shape)protected booleansphereIntersection(Sphere sphere)-
Methods inherited from class pro.streem.ar.sceneform.collision.CollisionShape
onChanged
-
-
-
-
Constructor Detail
-
Sphere
public Sphere()
Create a sphere with a center of (0,0,0) and a radius of 1.
-
Sphere
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
-
Sphere
public Sphere(float radius, Vector3 center)Create a sphere with a specified center and radius.- Parameters:
radius- the radius of the spherecenter- the center of the sphere
-
-
Method Detail
-
setCenter
public void setCenter(Vector3 center)
Set the center of this sphere.- Parameters:
center- the new center of the sphere- See Also:
getCenter()
-
getCenter
public Vector3 getCenter()
Get a copy of the sphere's center.- Returns:
- a new vector that represents the sphere's center
- See Also:
setCenter(Vector3)
-
setRadius
public void setRadius(float radius)
Set the radius of the sphere.- Parameters:
radius- the new radius of the sphere- See Also:
getRadius()
-
getRadius
public float getRadius()
Get the radius of the sphere.- Returns:
- the radius of the sphere
- See Also:
setRadius(float)
-
makeCopy
public Sphere makeCopy()
- Specified by:
makeCopyin classCollisionShape
-
rayIntersection
protected boolean rayIntersection(Ray ray, RayHit result)
- Specified by:
rayIntersectionin classCollisionShape
-
shapeIntersection
protected boolean shapeIntersection(CollisionShape shape)
- Specified by:
shapeIntersectionin classCollisionShape
-
sphereIntersection
protected boolean sphereIntersection(Sphere sphere)
- Specified by:
sphereIntersectionin classCollisionShape
-
boxIntersection
protected boolean boxIntersection(Box box)
- Specified by:
boxIntersectionin classCollisionShape
-
-