public class QuadraticUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
OUTSIDE
Special value, equal to
Double.MAX_VALUE , that indicates a
point is outside a particular solid. |
Constructor and Description |
---|
QuadraticUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
circleTangentPoints(Point3d t0,
Point3d t1,
Point3d px,
double r)
Cpmputes the two tangent points
t0 and t1
between a circle of radius r and a point px
exterior to it. |
static double |
ellipsoidPenetrationDistance(Vector3d nrm,
Vector3d pos,
double a,
double b,
double c,
double amax)
Computes the distance from a point to the surface of an ellipsoid,
along with the associated normal.
|
static double |
ellipsoidPenetrationDistance(Vector3d nrm,
Vector3d pos,
double a,
double b,
double c,
double tol,
double amax,
IntHolder numIters) |
static void |
ellipsoidSurfaceTangent(Point3d pt,
Point3d p0,
Point3d p1,
double a,
double b,
double c)
Find the point
pt for an axis-aligned ellipsoid that
is tangent to the line p0 -pt and closest
to the line defined by p0 and p1 . |
static boolean |
ellipsoidSurfaceTangentInPlane(Point3d pt,
Point3d pa,
Point3d p0,
Vector3d nrm,
double a,
double b,
double c)
Find the point
pt on an axis-aligned ellipsoid that
is tangent to the line pa -pt , lies
in the plane defined by p0 and nrm ,
and is nearest to p0 . |
static double |
nearestPointEllipse(Vector2d p,
double a,
double b,
Vector2d qp)
Find the point
p on an ellipse closest to a query point
qp , and return the corresponding distance. |
static double |
nearestPointEllipsoid(Vector3d p,
double a,
double b,
double c,
Vector3d qp)
Find the point
p on an ellipsoid closest to
qp , and return the corresponding distance. |
public static double OUTSIDE
Double.MAX_VALUE
, that indicates a
point is outside a particular solid.public static int circleTangentPoints(Point3d t0, Point3d t1, Point3d px, double r)
t0
and t1
between a circle of radius r
and a point px
exterior to it. The circle is assumed to be centered at the origin and
lie in the x-y plane, and so the z coordinate of px
is
ignored. The method returns the number of distinct tangent points, which
is normally 2. If px
lies on the circle, there is only one
tangent (which is equal to px
) and the method returns 1. If
px
lies inside the circle, there are no tangent points, the
method returns 0, and t0
and t1
are undefined.t0
- returns the first tangent pointt1
- returns the second tangent pointpx
- point for which the tangents should be computedr
- circle radiuspublic static double ellipsoidPenetrationDistance(Vector3d nrm, Vector3d pos, double a, double b, double c, double amax)
a
defined by
x^2 y^2 z^2 a = --- + --- + --- a^2 b^2 c^2exceeds
amax
, the method returns
OUTSIDE
and the normal is not computed.public static double ellipsoidPenetrationDistance(Vector3d nrm, Vector3d pos, double a, double b, double c, double tol, double amax, IntHolder numIters)
public static void ellipsoidSurfaceTangent(Point3d pt, Point3d p0, Point3d p1, double a, double b, double c)
pt
for an axis-aligned ellipsoid that
is tangent to the line p0
-pt
and closest
to the line defined by p0
and p1
.public static boolean ellipsoidSurfaceTangentInPlane(Point3d pt, Point3d pa, Point3d p0, Vector3d nrm, double a, double b, double c)
pt
on an axis-aligned ellipsoid that
is tangent to the line pa
-pt
, lies
in the plane defined by p0
and nrm
,
and is nearest to p0
.
The method works by projecting the ellipsoid into either YZ, ZX, or XY planes, depending on which is closest to the plane in question, and then finding the tangent points for the associated ellipse.
public static double nearestPointEllipse(Vector2d p, double a, double b, Vector2d qp)
p
on an ellipse closest to a query point
qp
, and return the corresponding distance. The distance is
positive if qp
is outside the ellipse, and negative if it is
inside.
Modified from "Distance from a Point to an Ellipse, an Ellipsoidm or a
Hyperellipsoid", by David Eberly.public static double nearestPointEllipsoid(Vector3d p, double a, double b, double c, Vector3d qp)
p
on an ellipsoid closest to
qp
, and return the corresponding distance. The distance is
positive if qp
is outside the ellipsoid, and negative if it
is inside.
Modified from "Distance from a Point to an Ellipse, an Ellipsoidm or a
Hyperellipsoid", by David Eberly.