Modifier and Type | Field and Description |
---|---|
protected Point |
center |
protected double |
radius |
Constructor and Description |
---|
Sphere(Circle c)
creates a sphere with the specified circle as equator
|
Sphere(CTetrahedron tetr) |
Sphere(double x,
double y,
double z,
double radius) |
Sphere(Point[] ps) |
Sphere(Point center,
double radius)
Constructs a sphere with the specified center and the specified radius.
|
Sphere(Point p0,
Point p1,
Point p2,
Point p3) |
Sphere(PointWeighted p)
Constructs a sphere with the weighted point as center and a radius with
the square root of the points weight.
|
Modifier and Type | Method and Description |
---|---|
Sphere |
clone()
Returns a deep clone of this sphere.
|
static double |
computeSphere_fast(Point p0,
Point p1,
Point p2,
Point p3,
Point center)
Calculates the radius and center of the sphere touching the four specified points.
|
void |
contains(java.util.List<Vertex> points,
double eps) |
boolean |
contains(Point p)
Returns true if the given point is in the sphere.
|
boolean |
containsNone(java.util.List<Point> points)
Returns true if none of the given points is in the sphere.
|
boolean |
containsNoneButAtMostOne(Vertex v,
java.util.List<Vertex> points) |
int |
containsNumber(java.util.List<Vertex> points)
Returns number of points inside the sphere
|
PointList |
generatePointsOnSphere(int n)
TODO: Comment, move up and test
|
PointList |
generateRandomPointsOnSphere(int n)
TODO: Comment, move up and test
|
Point |
getCenter()
Get the center
|
LineSegment |
getIntersection(Line line)
Gets the secant on the line.
|
static Circle |
getIntersection(Sphere s1,
Sphere s2) |
java.lang.Double |
getIntersectionAngle(Circle c,
Point p,
Vector dir) |
Point[] |
getIntersections(Circle c) |
static Point[] |
getIntersections(Sphere s1,
Sphere s2,
Sphere s3)
Find the two, one or zero points that is at the intersection of the three sphere shells.
|
static Sphere |
getMinSphere(Circle c)
Get the sphere with the specified circle as equator
|
static Sphere |
getMinSphere(PointList points)
Gets the smallest sphere containing a set of points.
|
static Sphere |
getMinSphere(Point p1,
Point p2)
Get the smallest sphere through two given points.
|
static Sphere |
getMinSphere(Point p0,
Point p1,
Point p2)
Get the smallest sphere through three points.
|
static Sphere |
getMinSphere(Point p0,
Point p1,
Point p2,
Point p3)
Constructs the sphere through four points.
|
double |
getRadius()
Get the radius
|
double |
getRadiusSquared()
Get the squared radius
|
double |
getSurfaceArea()
Get the surface area
|
double |
getVolume()
Get the volume
|
double[] |
intersectionParameters(Line line)
Returns the two line-parameters that indicate where
line intersects
this sphere. |
boolean |
isEmpty(java.util.List<Vertex> points,
double eps)
returns TRUE if the interior of the sphere (for a given eps reduction of the radius) is empty
|
boolean |
isEmpty(Point[] points,
double eps) |
boolean |
isInside(Point p)
Returns true if the point is inside this sphere
|
boolean |
isInside(Point p,
double eps)
Returns true iff the squared distance from the point to the sphere center is less than the squared
radius minus
eps |
boolean |
isIntersected(Sphere sphere)
Returns true if this sphere is intersected or touched by another sphere.
|
boolean |
overlaps(Volume vol)
Returns true if the sphere overlaps with
vol . |
double |
powerDistance(Point p)
Gets the squared distance of a point from a sphere surface
(negative if the point is inside the sphere).
|
void |
setCenter(Point center) |
void |
setCenter(Point p0,
Point p1,
Point p2,
Point p3) |
void |
setRadius(double radius) |
void |
toConsole()
Writes this sphere to
System.out . |
void |
toConsole(int dec)
Writes this sphere to
System.out with dec decimals precision. |
java.lang.String |
toString()
Return a string representation of this sphere.
|
java.lang.String |
toString(int dec)
Return a string representation of this sphere with
dec decimals precision |
static double |
unionVolume_Grid(java.util.Collection<Sphere> spheres)
Estimate the volume of the union of a set of spheres.
|
protected Point center
protected double radius
public Sphere(Point center, double radius)
public Sphere(double x, double y, double z, double radius)
public Sphere(Point[] ps)
public Sphere(CTetrahedron tetr)
public Sphere(PointWeighted p)
public Sphere(Circle c)
public static double computeSphere_fast(Point p0, Point p1, Point p2, Point p3, Point center)
center!=null
the coordinates of center
are overwritten
with the coordinates of the circumsphere. Uses 46 "heavy" operations (multiplication/division).public double getRadius()
public double getRadiusSquared()
public double getSurfaceArea()
public boolean isInside(Point p)
public boolean isInside(Point p, double eps)
eps
public boolean isEmpty(Point[] points, double eps)
public boolean isEmpty(java.util.List<Vertex> points, double eps)
public void contains(java.util.List<Vertex> points, double eps)
public void setCenter(Point center)
public void setRadius(double radius)
public boolean isIntersected(Sphere sphere)
public LineSegment getIntersection(Line line)
public double[] intersectionParameters(Line line)
line
intersects
this sphere. TODO: Coordinate line-intersection methods (see above).public boolean containsNone(java.util.List<Point> points)
public int containsNumber(java.util.List<Vertex> points)
public boolean containsNoneButAtMostOne(Vertex v, java.util.List<Vertex> points)
public boolean contains(Point p)
public double powerDistance(Point p)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int dec)
dec
decimals precisionpublic void toConsole()
System.out
.public void toConsole(int dec)
System.out
with dec
decimals precision.public boolean overlaps(Volume vol)
vol
. TODO: Implement for all volumes.public Sphere clone()
public static Sphere getMinSphere(Circle c)
public static Sphere getMinSphere(Point p1, Point p2)
public static Sphere getMinSphere(Point p0, Point p1, Point p2)
public static Sphere getMinSphere(Point p0, Point p1, Point p2, Point p3)
public static Sphere getMinSphere(PointList points)
public static Point[] getIntersections(Sphere s1, Sphere s2, Sphere s3)
public static double unionVolume_Grid(java.util.Collection<Sphere> spheres)
public PointList generateRandomPointsOnSphere(int n)
public PointList generatePointsOnSphere(int n)