public final class Sphere extends Object implements IEllipsoid, CrossSectionProvider, Serializable
This is a describing class for a 3D spherical shape, with some algorithm to compute intersections and distances to some other objects.
Shape.distanceTo(Line)
,
Shape.intersects(Line)
,
Serialized FormCreation with a double and a Vector3D : Vector3D center = new Vector3D(1.0, 6.0, -2.0); Sphere sphere = new Sphere(center, 2.0); Intersection with a line : boolean intersects = sphere.intersects(line);
Constructor and Description |
---|
Sphere(double inSurface)
Build a sphere centered in [0, 0, 0] from its projected surface.
|
Sphere(Vector3D inCenter,
double inRadius)
Build a sphere from its radius and the position of its center
|
Modifier and Type | Method and Description |
---|---|
Vector3D[] |
closestPointTo(Line line)
Computes the points of the shape and the line realizing
the shortest distance.
|
Vector3D |
closestPointTo(Vector3D point)
Computes the point, on the ellipsoid surface, that is the closest to a point of space.
|
double |
distanceTo(Line line)
Computes the distance to a line.
|
double |
distanceTo(Vector3D point)
Computes the distance to a point of space.
|
Vector3D |
getCenter()
Get ellipsoids' center
|
double |
getCrossSection(Vector3D direction)
Computes the cross section from the direction
defined by a Vector3D.
|
Vector3D[] |
getIntersectionPoints(Line line)
Compute the intersection points with a line.
|
Vector3D |
getNormal(Vector3D point)
Computes the normal vector to the surface
|
double |
getRadius() |
static double |
getRadiusFromSurface(double surface)
Get radius from surface value.
|
double |
getSemiA()
Get semi axis A
|
double |
getSemiB()
Get semi axis B
|
double |
getSemiC()
Get semi axis C
|
double |
getSurface()
Get surface
|
static double |
getSurfaceFromRadius(double radius)
Get surface from radius value.
|
boolean |
intersects(Line line)
Tests the intersection with a line.
|
String |
toString()
Get a representation for this sphere.
|
public Sphere(Vector3D inCenter, double inRadius)
inCenter
- the center of the sphereinRadius
- the radius of the sphereIllegalArgumentException
- if the radius is negativepublic Sphere(double inSurface)
inSurface
- the sphere transversal surfacepublic double getRadius()
public Vector3D getCenter()
IEllipsoid
getCenter
in interface IEllipsoid
public boolean intersects(Line line)
intersects
in interface Shape
line
- the linepublic double distanceTo(Line line)
distanceTo
in interface Shape
line
- the linepublic double distanceTo(Vector3D point)
point
- the pointpublic Vector3D[] getIntersectionPoints(Line line)
getIntersectionPoints
in interface Shape
line
- the linepublic Vector3D[] closestPointTo(Line line)
closestPointTo
in interface Shape
line
- the linepublic Vector3D closestPointTo(Vector3D point)
closestPointTo
in interface IEllipsoid
point
- the point expressed in standard basispublic Vector3D getNormal(Vector3D point)
getNormal
in interface IEllipsoid
point
- Point as a Vector3Dpublic String toString()
public double getCrossSection(Vector3D direction)
getCrossSection
in interface CrossSectionProvider
direction
- the direction vectorpublic double getSemiA()
getSemiA
in interface IEllipsoid
public double getSemiB()
getSemiB
in interface IEllipsoid
public double getSemiC()
getSemiC
in interface IEllipsoid
public double getSurface()
public static double getSurfaceFromRadius(double radius)
radius
- radiuspublic static double getRadiusFromSurface(double surface)
surface
- surfaceCopyright © 2021 CNES. All rights reserved.