public final class SphericalCap extends Object implements SolidShape
This class implements the SolidShape interface, so it provides the expected : intersection with a line, distance from the surface of the shape, intersection points...
SolidShape
// A half-sphere :
// - sphere at the origin, radius 1.
// - plane (x,y), the normal is the z unit vector
final Sphere originSphere = new Sphere(new Vector3D(0., 0., 0.) , 1.);
final Plane xyPlane = new Plane(new Vector3D(0., 0., 1.));
final SphericalCap halfSphere = new SphericalCap(originSphere, xyPlane);
Constructor and Description |
---|
SphericalCap(Sphere s,
Plane p)
|
Modifier and Type | Method and Description |
---|---|
Vector3D[] |
closestPointTo(Line line)
Computes the points of the shape and the line realizing
the shortest distance.
|
double |
distanceTo(Line line)
Gives the distance from the line to the spherical cap.
When the line intersects the spherical cap, the distance is 0. |
Vector3D[] |
getIntersectionPoints(Line line)
Returns a list of intersection points between the line and the spherical cap.
Only the border points are given. |
boolean |
intersects(Line line)
Returns true when the line intersects the spherical cap.
|
String |
toString()
Get a representation for this sphere.
|
public SphericalCap(Sphere s, Plane p)
s
- the sphere enclosing the spherical capp
- plane delimiting the spherical cap.
This plane must intersect with the sphere by more than a single point, if not
the spherical cap is considered undefined. The direction of the plane is used to determine in which
side the
spherical cap is : it is on the side of the normal vector.public boolean intersects(Line line)
intersects
in interface Shape
line
- to intersectShape.intersects(Line)
public double distanceTo(Line line)
distanceTo
in interface Shape
line
- to get the distance fromShape.distanceTo(Line)
public Vector3D[] getIntersectionPoints(Line line)
getIntersectionPoints
in interface Shape
line
- to intersectShape.getIntersectionPoints(Line)
public Vector3D[] closestPointTo(Line line)
closestPointTo
in interface Shape
line
- the lineCopyright © 2017 CNES. All rights reserved.