Package geomss.geom
Class AbstractCurve<T extends AbstractCurve>
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<T>
-
- Type Parameters:
T
- The sub-type of this AbstractCurve.
- All Implemented Interfaces:
Curve<T>
,GeomElement<T>
,ParametricGeometry<T>
,Transformable<T>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
- Direct Known Subclasses:
CSTCurve
,LinearComboCurve
,LineSegment
,NurbsCurve
,SubrangeCurve
public abstract class AbstractCurve<T extends AbstractCurve> extends AbstractGeomElement<T> implements Curve<T>
The interface and implementation in common to all curves.Modified by: Joseph A. Huwaldt
- Version:
- February 18, 2025
- Author:
- Joseph A. Huwaldt, Date: May 15, 2009
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static double
GTOL
Generic/default tolerance for use in root finders, etc.-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Constructor Summary
Constructors Constructor Description AbstractCurve()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PointString<SubrangePoint>
extractGrid(GridRule gridRule, java.util.List<java.lang.Double> spacing)
Return a string of points that are gridded onto the curve using the specified spacing and gridding rule.Parameter<javax.measure.quantity.Length>
getArcLength(double eps)
Return the total arc length of this curve.Parameter<javax.measure.quantity.Length>
getArcLength(double s1, double s2, double eps)
Return the arc length of a segment of this curve.Parameter<javax.measure.quantity.Length>
getArcLength(GeomPoint s1, GeomPoint s2, double eps)
Return the arc length of a segment of this curve.Vector<javax.measure.quantity.Dimensionless>
getBinormal(double s)
Return the binormal vector for the given parametric distance along the curve.Vector<javax.measure.quantity.Dimensionless>
getBinormal(GeomPoint s)
Return the binormal vector for the given parametric distance along the curve.PointString<SubrangePoint>
getClosest(Curve curve, double tol)
Returns the closest points (giving the minimum distance) between this curve and the specified curve.SubrangePoint
getClosest(GeomPlane plane, double tol)
Returns the closest points (giving the minimum distance) between this curve and the specified plane.SubrangePoint
getClosest(GeomPoint point, double tol)
Returns the closest point on this curve to the specified point.SubrangePoint
getClosest(GeomPoint point, double near, double tol)
Returns the closest point on this curve to the specified point near the specified parametric position.PointString<SubrangePoint>
getClosest(Surface surface, double tol)
Returns the closest points (giving the minimum distance) between this curve and the specified surface.PointString<SubrangePoint>
getClosest(java.util.List<? extends GeomPoint> points, double tol)
Returns the closest points on this curve to the specified list of points.Parameter
getCurvature(double s)
Return the curvature (kappa = 1/rho; where rho = the radius of curvature) of the curve at the parametric positions
.Parameter
getCurvature(GeomPoint s)
Return the curvature (kappa = 1/rho; where rho = the radius of curvature) of the curve at the parametric positions
.java.util.List<java.util.List<Vector<javax.measure.quantity.Length>>>
getDerivatives(GeomPoint s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric position(s) on a parametric object for the given parametric position on the object,d^{grade}p(s)/d^{grade}s
.Parameter<javax.measure.quantity.Area>
getEnclosedArea(GeomPoint refPnt, double eps)
Return the signed area of the region enclosed or subtended by a planar curve relative to the specified reference point.SubrangePoint
getFarthest(GeomPoint point, double tol)
Returns the farthest point on this curve from the specified point.SubrangePoint
getFarthest(GeomPoint point, double near, double tol)
Returns the farthest point on this curve from the specified point near the specified parametric position.PointString<SubrangePoint>
getFarthest(java.util.List<? extends GeomPoint> points, double tol)
Returns the farthest points on this curve to the specified list of points.SubrangePoint
getLimitPoint(int dim, boolean max, double tol)
Returns the most extreme point, either minimum or maximum, in the specified coordinate direction on this curve.int
getParDimension()
Returns the number of parametric dimensions of the geometry element.SubrangePoint
getPoint(double s)
Return a subrange point on the curve for the given parametric distance along the curve.SubrangePoint
getPoint(GeomPoint s)
Return a subrange point on the curve for the given parametric distance along the curve.SubrangePoint
getPointAtArcLength(Parameter<javax.measure.quantity.Length> targetArcLength, double tol)
Return a subrange point at the position on the curve with the specified arc-length.Vector<javax.measure.quantity.Dimensionless>
getPrincipalNormal(double s)
Return the principal normal vector for the given parametric distance,s
, along the curve.Vector<javax.measure.quantity.Dimensionless>
getPrincipalNormal(GeomPoint s)
Return the principal normal vector for the given parametric distance,s
, along the curve.Point
getRealPoint(GeomPoint s)
Calculate a point on the curve for the given parametric distance along the curve.Vector<javax.measure.quantity.Length>
getSDerivative(double s, int grade)
Calculate a derivative with respect to parametric distance of the given grade on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s
.java.util.List<Vector<javax.measure.quantity.Length>>
getSDerivatives(GeomPoint s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric distance on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s
.SubrangePoint
getTangencyPoint(GeomPoint point, double near, double tol)
A point is found along this curve that when connected by a straight line to the given point in space, the resulting line is tangent to this curve.Vector<javax.measure.quantity.Dimensionless>
getTangent(double s)
Return the tangent vector for the given parametric distance along the curve.Vector<javax.measure.quantity.Dimensionless>
getTangent(GeomPoint s)
Return the tangent vector for the given parametric distance along the curve.Parameter
getTorsion(double s)
Return the torsion of the curve at the parametric positions
.Parameter
getTorsion(GeomPoint s)
Return the torsion of the curve at the parametric positions
.Parameter
getVariationOfCurvature(double s)
Return the variation of curvature or rate of change of curvature (VOC or dKappa(s)/ds) at the parametric positions
.Parameter
getVariationOfCurvature(GeomPoint s)
Return the variation of curvature or rate of change of curvature (VOC or dKappa(s)/ds) at the parametric positions
.PointString<SubrangePoint>
gridToTolerance(Parameter<javax.measure.quantity.Length> tol)
Return a string of points that are gridded onto the curve with the number of points and spacing chosen to result in straight line segments between the points that have mid-points that are all within the specified tolerance of this curve.GeomList<PointString<SubrangePoint>>
intersect(Curve curve, Parameter<javax.measure.quantity.Length> tol)
Return the intersection between another curve and this curve.PointString<SubrangePoint>
intersect(GeomPlane plane, double tol)
Return the intersection between a plane and this curve.PointString<SubrangePoint>
intersect(GeomPoint L0, GeomVector Ldir, Parameter<javax.measure.quantity.Length> tol)
Return the intersection between an infinite line and this curve.GeomList<PointString<SubrangePoint>>
intersect(LineSegment line, Parameter<javax.measure.quantity.Length> tol)
Return the intersection between a line segment and this curve.GeomList<PointString<SubrangePoint>>
intersect(Surface surface, Parameter<javax.measure.quantity.Length> tol)
Return the intersections between a surface and this curve.boolean
isCircular(Parameter<javax.measure.quantity.Length> tol)
Returnstrue
if this curve is a circular arc to within the specified tolerance.boolean
isDegenerate(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this curve is degenerate (i.e.: has length less than the specified tolerance).boolean
isLine(Parameter<javax.measure.quantity.Length> tol)
Returnstrue
if this curve is a line to within the specified tolerance.boolean
isPlanar(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this curve is planar orfalse
if it is not.GeomList<T>
splitAt(GeomPoint s)
Split this curve at the specified parametric position returning a list containing two curves (a lower curve with smaller parametric positions than "s" and an upper curve with larger parametric positions).-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, equals, getAllUserData, getID, getName, getUserData, hashCode, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString, toText
-
Methods inherited from interface geomss.geom.Curve
copy, copyToReal, getRealPoint, getSDerivatives, reverse, splitAt, to, toDimension, toNurbs
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getBoundsMax, getBoundsMin, getID, getName, getPhyDimension, getUnit, getUserData, isValid, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, size, toText
-
Methods inherited from interface geomss.geom.Transformable
getTransformed
-
-
-
-
Field Detail
-
GTOL
public static final double GTOL
Generic/default tolerance for use in root finders, etc.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractCurve
public AbstractCurve()
-
-
Method Detail
-
getParDimension
public int getParDimension()
Returns the number of parametric dimensions of the geometry element. This implementation always returns 1.- Specified by:
getParDimension
in interfaceGeomElement<T extends AbstractCurve>
- Returns:
- The number of parametric dimensions of this geometry element.
-
splitAt
public GeomList<T> splitAt(GeomPoint s)
Split this curve at the specified parametric position returning a list containing two curves (a lower curve with smaller parametric positions than "s" and an upper curve with larger parametric positions).- Specified by:
splitAt
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- The parametric position where this curve should be split (must not be 0 or 1!). Must be a 1-dimensional point with a value in the range 0 to 1.0, non-inclusive. Units are ignored.- Returns:
- A list containing two curves: 0 == the lower curve, 1 == the upper curve.
-
getPoint
public SubrangePoint getPoint(double s)
Return a subrange point on the curve for the given parametric distance along the curve.- Specified by:
getPoint
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- parametric distance to calculate a point for (0.0 to 1.0 inclusive).- Returns:
- The subrange point or
null
if the parameter is not in a valid range.
-
getPoint
public SubrangePoint getPoint(GeomPoint s)
Return a subrange point on the curve for the given parametric distance along the curve.- Specified by:
getPoint
in interfaceCurve<T extends AbstractCurve>
- Specified by:
getPoint
in interfaceParametricGeometry<T extends AbstractCurve>
- Parameters:
s
- parametric distance to calculate a point for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The subrange point
-
getRealPoint
public Point getRealPoint(GeomPoint s)
Calculate a point on the curve for the given parametric distance along the curve.- Specified by:
getRealPoint
in interfaceCurve<T extends AbstractCurve>
- Specified by:
getRealPoint
in interfaceParametricGeometry<T extends AbstractCurve>
- Parameters:
s
- parametric distance to calculate a point for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- calculated point
-
getDerivatives
public java.util.List<java.util.List<Vector<javax.measure.quantity.Length>>> getDerivatives(GeomPoint s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric position(s) on a parametric object for the given parametric position on the object,d^{grade}p(s)/d^{grade}s
.Example:
1st derivative (grade = 1), this returns[p(s), dp(s)/ds]
;
2nd derivative (grade = 2), this returns[p(s), dp(s)/ds, d^2p(s)/d^2s]
; etc.- Specified by:
getDerivatives
in interfaceCurve<T extends AbstractCurve>
- Specified by:
getDerivatives
in interfaceParametricGeometry<T extends AbstractCurve>
- Parameters:
s
- parametric position to calculate the derivatives for. Must match the parametric dimension of this parametric surface and have each value in the range 0 to 1.0. Units are ignored.grade
- The maximum grade to calculate the derivatives for (1=1st derivative, 2=2nd derivative, etc)- Returns:
- A list of lists of derivatives (one list for each parametric dimension). Each list contains derivatives up to the specified grade at the specified parametric position. Example: for a surface list element 0 is the array of derivatives in the 1st parametric dimension (s), then 2nd list element is the array of derivatives in the 2nd parametric dimension (t).
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0.
-
getSDerivatives
public java.util.List<Vector<javax.measure.quantity.Length>> getSDerivatives(GeomPoint s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric distance on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s
.Example:
1st derivative (grade = 1), this returns[p(s), dp(s)/ds]
;
2nd derivative (grade = 2), this returns[p(s), dp(s)/ds, d^2p(s)/d^2s]
; etc.- Specified by:
getSDerivatives
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- parametric distance to calculate the derivatives for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.grade
- The maximum grade to calculate the derivatives for (1=1st derivative, 2=2nd derivative, etc)- Returns:
- A list of derivatives up to the specified grade of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0.
-
getSDerivative
public Vector<javax.measure.quantity.Length> getSDerivative(double s, int grade)
Calculate a derivative with respect to parametric distance of the given grade on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s
.Example:
1st derivative (grade = 1), this returnsdp(s)/ds
;
2nd derivative (grade = 2), this returnsd^2p(s)/d^2s
; etc.Note: Cartesian space derivatives can be calculated as follows:
derivative = curve.getSDerivative(s, 1); dy/dx = (dy/ds)/(dx/ds) = derivative.getValue(1)/derivative.getValue(0), dy/dz = (dy/ds)/(dz/ds) = derivative.getValue(1)/derivative.getValue(2), etc
- Specified by:
getSDerivative
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate a derivative for (0.0 to 1.0 inclusive).grade
- The grade to calculate the derivative for (1=1st derivative, 2=2nd derivative, etc)- Returns:
- The specified derivative of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0.
-
getTangent
public Vector<javax.measure.quantity.Dimensionless> getTangent(double s)
Return the tangent vector for the given parametric distance along the curve. This vector contains the normalized 1st derivative of the curve with respect to parametric distance in each component direction: dx/ds/|dp(s)/ds|, dy/ds/|dp(s)/ds|, dz/ds/|dp(s)/ds|, etc.Note: Cartesian space derivatives can be calculated as follows:
tangent = curve.getTangent(s); dy/dx = (dy/ds)/(dx/ds) = tangent.getValue(1)/tangent.getValue(0), dy/dz = (dy/ds)/(dz/ds) = tangent.getValue(1)/tangent.getValue(2), etc
- Specified by:
getTangent
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate a tangent vector for (0.0 to 1.0 inclusive).- Returns:
- The tangent vector of the curve at the specified parametric position.
-
getTangent
public Vector<javax.measure.quantity.Dimensionless> getTangent(GeomPoint s)
Return the tangent vector for the given parametric distance along the curve. This vector contains the normalized 1st derivative of the curve with respect to parametric distance in each component direction: dx/ds/|dp(s)/ds|, dy/ds/|dp(s)/ds|, dz/ds/|dp(s)/ds|, etc.Note: Cartesian space derivatives can be calculated as follows:
tangent = curve.getTangent(s); dy/dx = (dy/ds)/(dx/ds) = tangent.getValue(1)/tangent.getValue(0), dy/dz = (dy/ds)/(dz/ds) = tangent.getValue(1)/tangent.getValue(2), etc
- Specified by:
getTangent
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate a tangent vector for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The tangent vector of the curve at the specified parametric position.
-
getPrincipalNormal
public Vector<javax.measure.quantity.Dimensionless> getPrincipalNormal(double s)
Return the principal normal vector for the given parametric distance,s
, along the curve. This vector is normal to the curve, lies in the normal plane (is perpendicular to the tangent vector), and points toward the center of curvature at the specified point.- Specified by:
getPrincipalNormal
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the principal normal vector for (0.0 to 1.0 inclusive).- Returns:
- The principal normal vector of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the curve does not have a 2nd derivative with respect tos
(if the curve is locally a straight line segment -- this means there are an infinite number of possible principal normal vectors).
-
getPrincipalNormal
public Vector<javax.measure.quantity.Dimensionless> getPrincipalNormal(GeomPoint s)
Return the principal normal vector for the given parametric distance,s
, along the curve. This vector is normal to the curve, lies in the normal plane (is perpendicular to the tangent vector), and points toward the center of curvature at the specified point.- Specified by:
getPrincipalNormal
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the principal normal vector for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The principal normal vector of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the curve does not have a 2nd derivative with respect tos
(if the curve is locally a straight line segment -- this means there are an infinite number of possible principal normal vectors).
-
getBinormal
public Vector<javax.measure.quantity.Dimensionless> getBinormal(double s) throws DimensionException
Return the binormal vector for the given parametric distance along the curve. This vector is normal to the curve ats
, lies in the normal plane (is perpendicular to the tangent vector), and is perpendicular to the principal normal vector. Together, the tangent vector, principal normal vector, and binormal vector form a useful orthogonal frame.- Specified by:
getBinormal
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the binormal vector for (0.0 to 1.0 inclusive).- Returns:
- The binormal vector of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the curve does not have a 2nd derivative with respect tos
(if the curve is locally a straight line segment).DimensionException
- if the curve does not have at least 3 physical dimensions.
-
getBinormal
public Vector<javax.measure.quantity.Dimensionless> getBinormal(GeomPoint s) throws DimensionException
Return the binormal vector for the given parametric distance along the curve. This vector is normal to the curve ats
, lies in the normal plane (is perpendicular to the tangent vector), and is perpendicular to the principal normal vector. Together, the tangent vector, principal normal vector, and binormal vector form a useful orthogonal frame.- Specified by:
getBinormal
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the binormal vector for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The binormal vector of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the curve does not have a 2nd derivative with respect tos
(if the curve is locally a straight line segment).DimensionException
- if the curve does not have at least 3 physical dimensions.
-
getCurvature
public Parameter getCurvature(double s)
Return the curvature (kappa = 1/rho; where rho = the radius of curvature) of the curve at the parametric positions
. The curvature vector (vector from p(s) to the center of curvature) can be constructed from:k = rhoi*ni
ork = curve.getPrincipalNormal(s).divide(curve.getCurvature(s));
- Specified by:
getCurvature
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the curvature for (0.0 to 1.0 inclusive).- Returns:
- The curvature of the curve at the specified parametric position in units of 1/Length.
-
getCurvature
public Parameter getCurvature(GeomPoint s)
Return the curvature (kappa = 1/rho; where rho = the radius of curvature) of the curve at the parametric positions
. The curvature vector (vector from p(s) to the center of curvature) can be constructed from:k = rhoi*ni
ork = curve.getPrincipalNormal(s).divide(curve.getCurvature(s));
- Specified by:
getCurvature
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the curvature for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The curvature of the curve at the specified parametric position in units of 1/Length.
-
getVariationOfCurvature
public Parameter getVariationOfCurvature(double s)
Return the variation of curvature or rate of change of curvature (VOC or dKappa(s)/ds) at the parametric positions
.- Specified by:
getVariationOfCurvature
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the variation of curvature for (0.0 to 1.0 inclusive).- Returns:
- The variation of curvature of the curve at the specified parametric position in units of 1/Length.
-
getVariationOfCurvature
public Parameter getVariationOfCurvature(GeomPoint s)
Return the variation of curvature or rate of change of curvature (VOC or dKappa(s)/ds) at the parametric positions
.- Specified by:
getVariationOfCurvature
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the variation of curvature for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The variation of curvature of the curve at the specified parametric position in units of 1/Length.
-
getTorsion
public Parameter getTorsion(double s)
Return the torsion of the curve at the parametric positions
. The torsion is a measure of the rotation or twist about the tangent vector.- Specified by:
getTorsion
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the torsion for (0.0 to 1.0 inclusive).- Returns:
- The torsion of the curve at the specified parametric position in units of 1/Length.
-
getTorsion
public Parameter getTorsion(GeomPoint s)
Return the torsion of the curve at the parametric positions
. The torsion is a measure of the rotation or twist about the tangent vector.- Specified by:
getTorsion
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s
- Parametric distance to calculate the torsion for. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.- Returns:
- The torsion of the curve at the specified parametric position in units of 1/Length.
-
getArcLength
public Parameter<javax.measure.quantity.Length> getArcLength(double eps)
Return the total arc length of this curve.- Specified by:
getArcLength
in interfaceCurve<T extends AbstractCurve>
- Parameters:
eps
- The desired fractional accuracy on the arc-length.- Returns:
- The total arc length of the curve.
-
getArcLength
public Parameter<javax.measure.quantity.Length> getArcLength(double s1, double s2, double eps)
Return the arc length of a segment of this curve.- Specified by:
getArcLength
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s1
- The starting parametric distance along the curve to begin the arc-length calculation from.s2
- The ending parametric distance along the curve to end the arc-length calculation at.eps
- The desired fractional accuracy on the arc-length.- Returns:
- The arc length of the specified segment of the curve.
-
getArcLength
public Parameter<javax.measure.quantity.Length> getArcLength(GeomPoint s1, GeomPoint s2, double eps)
Return the arc length of a segment of this curve.- Specified by:
getArcLength
in interfaceCurve<T extends AbstractCurve>
- Parameters:
s1
- The starting parametric distance along the curve to begin the arc-length calculation from. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.s2
- The ending parametric distance along the curve to end the arc-length calculation at. Must be a 1-dimensional point with a value in the range 0 to 1.0. Units are ignored.eps
- The desired fractional accuracy on the arc-length.- Returns:
- The arc length of the specified segment of the curve.
-
getPointAtArcLength
public SubrangePoint getPointAtArcLength(Parameter<javax.measure.quantity.Length> targetArcLength, double tol)
Return a subrange point at the position on the curve with the specified arc-length. If the requested arc-length is ≤ 0, the start of the curve is returned. If the requested arc length is > the total arc length of the curve, then the end point is returned.- Specified by:
getPointAtArcLength
in interfaceCurve<T extends AbstractCurve>
- Parameters:
targetArcLength
- The target arc length to find in meters.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- A subrange point on the curve at the specified arc-length position.
-
getTangencyPoint
public SubrangePoint getTangencyPoint(GeomPoint point, double near, double tol)
A point is found along this curve that when connected by a straight line to the given point in space, the resulting line is tangent to this curve. This method should only be used if this curve is a planar curve that is C1 (slope) continuous, and convex with respect to the point. The given point should be in the plane of the curve. If it is not, it will be projected into the plane of the curve.- Specified by:
getTangencyPoint
in interfaceCurve<T extends AbstractCurve>
- Parameters:
point
- The point that the tangent on the curve is to be found relative to.near
- The parametric distance on the curve (0-1) that serves as an initial guess at the location of the tangent point.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- The point on this curve that is tangent to the curve and the supplied point.
-
extractGrid
public PointString<SubrangePoint> extractGrid(GridRule gridRule, java.util.List<java.lang.Double> spacing)
Return a string of points that are gridded onto the curve using the specified spacing and gridding rule.- Specified by:
extractGrid
in interfaceCurve<T extends AbstractCurve>
- Parameters:
gridRule
- Specifies whether the subdivision spacing is applied with respect to arc-length in real space or parameter space.spacing
- A list of values used to define the subdivision spacing.gridRule
specifies whether the subdivision spacing is applied with respect to arc-length in real space or parameter space. If the spacing is arc-length, then the values are interpreted as fractions of the arc length of the curve from 0 to 1.- Returns:
- A string of subrange points gridded onto the curve at the specified parametric positions.
-
gridToTolerance
public PointString<SubrangePoint> gridToTolerance(Parameter<javax.measure.quantity.Length> tol)
Return a string of points that are gridded onto the curve with the number of points and spacing chosen to result in straight line segments between the points that have mid-points that are all within the specified tolerance of this curve.- Specified by:
gridToTolerance
in interfaceCurve<T extends AbstractCurve>
- Parameters:
tol
- The maximum distance that a straight line between gridded points may deviate from this curve. May not be null.- Returns:
- A string of subrange points gridded onto the curve.
-
intersect
public PointString<SubrangePoint> intersect(GeomPlane plane, double tol)
Return the intersection between a plane and this curve.- Specified by:
intersect
in interfaceCurve<T extends AbstractCurve>
- Parameters:
plane
- The plane to intersect with this curve.tol
- Fractional tolerance (in parameter space) to refine the point positions to.- Returns:
- A PointString containing zero or more subrange points made by the intersection of this curve with the specified plane. If no intersection is found, an empty PointString is returned.
-
intersect
public PointString<SubrangePoint> intersect(GeomPoint L0, GeomVector Ldir, Parameter<javax.measure.quantity.Length> tol)
Return the intersection between an infinite line and this curve.- Specified by:
intersect
in interfaceCurve<T extends AbstractCurve>
- Parameters:
L0
- A point on the line (origin of the line).Ldir
- The direction vector for the line (does not have to be a unit vector).tol
- Tolerance (in physical space) to refine the point positions to.- Returns:
- A PointString containing zero or more subrange points made by the intersection of this curve with the specified line. If no intersection is found, an empty PointString is returned.
-
intersect
public GeomList<PointString<SubrangePoint>> intersect(LineSegment line, Parameter<javax.measure.quantity.Length> tol)
Return the intersection between a line segment and this curve.- Specified by:
intersect
in interfaceCurve<T extends AbstractCurve>
- Parameters:
line
- The line segment to intersect.tol
- Tolerance (in physical space) to refine the point positions to.- Returns:
- A list containing two PointString instances each containing zero or more subrange points, on this curve and the input line segment respectively, made by the intersection of this curve with the specified line segment. If no intersections are found a list of two empty PointStrings are returned.
-
intersect
public GeomList<PointString<SubrangePoint>> intersect(Curve curve, Parameter<javax.measure.quantity.Length> tol)
Return the intersection between another curve and this curve.- Specified by:
intersect
in interfaceCurve<T extends AbstractCurve>
- Parameters:
curve
- The curve to intersect with this curve.tol
- Tolerance (in physical space) to refine the point positions to.- Returns:
- A list containing two PointString instances each containing zero or more subrange points, on this curve and the input curve respectively, made by the intersection of this curve with the specified curve. If no intersections are found a list of two empty PointStrings are returned.
-
intersect
public GeomList<PointString<SubrangePoint>> intersect(Surface surface, Parameter<javax.measure.quantity.Length> tol)
Return the intersections between a surface and this curve.- Specified by:
intersect
in interfaceCurve<T extends AbstractCurve>
- Parameters:
surface
- The surface to intersect with this curve.tol
- Tolerance (in physical space) to refine the point positions to.- Returns:
- A list containing two PointString instances each containing zero or more subrange points, on this curve and the input surface respectively, made by the intersection of this curve with the specified surface. If no intersections are found a list of two empty PointStrings are returned.
-
getClosest
public SubrangePoint getClosest(GeomPoint point, double tol)
Returns the closest point on this curve to the specified point.- Specified by:
getClosest
in interfaceCurve<T extends AbstractCurve>
- Specified by:
getClosest
in interfaceParametricGeometry<T extends AbstractCurve>
- Parameters:
point
- The point to find the closest point on this curve to.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- The point on this curve that is closest to the specified point.
-
getClosest
public SubrangePoint getClosest(GeomPoint point, double near, double tol)
Returns the closest point on this curve to the specified point near the specified parametric position. This may not return the global closest point!- Specified by:
getClosest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
point
- The point to find the closest point on this curve to.near
- The parametric position where the search for the closest point should be started.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- The point on this curve that is closest to the specified point near the specified parametric position.
-
getClosest
public PointString<SubrangePoint> getClosest(java.util.List<? extends GeomPoint> points, double tol)
Returns the closest points on this curve to the specified list of points.- Specified by:
getClosest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
points
- The list of points to find the closest points on this curve to.tol
- Fractional tolerance (in parameter space) to refine the point positions to.- Returns:
- The list of
SubrangePoint
objects on this curve that are closest to the specified points.
-
getFarthest
public SubrangePoint getFarthest(GeomPoint point, double tol)
Returns the farthest point on this curve from the specified point.- Specified by:
getFarthest
in interfaceCurve<T extends AbstractCurve>
- Specified by:
getFarthest
in interfaceParametricGeometry<T extends AbstractCurve>
- Parameters:
point
- The point to find the farthest point on this curve from.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- The
SubrangePoint
on this curve that is farthest from the specified point.
-
getFarthest
public SubrangePoint getFarthest(GeomPoint point, double near, double tol)
Returns the farthest point on this curve from the specified point near the specified parametric position. This may not return the global farthest point!- Specified by:
getFarthest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
point
- The point to find the farthest point on this curve from.near
- The parametric position where the search for the farthest point should be started.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- The
SubrangePoint
on this curve that is farthest from the specified point.
-
getFarthest
public PointString<SubrangePoint> getFarthest(java.util.List<? extends GeomPoint> points, double tol)
Returns the farthest points on this curve to the specified list of points.- Specified by:
getFarthest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
points
- The list of points to find the farthest points on this curve to.tol
- Fractional tolerance (in parameter space) to refine the point positions to.- Returns:
- The list of
SubrangePoint
objects on this curve that are farthest from the specified points.
-
getClosest
public PointString<SubrangePoint> getClosest(Curve curve, double tol)
Returns the closest points (giving the minimum distance) between this curve and the specified curve. If the specified curve intersects this curve, then the 1st intersection found is returned (not all the intersections are found and there is no guarantee about which intersection will be returned). If the specified curve is parallel to this curve (all points are equidistant away), then any point between the two curves could be returned as the "closest".- Specified by:
getClosest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
curve
- The curve to find the closest points between this curve and that one.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- A list containing two SubrangePoint objects that represent the closest point on this curve (index 0) and the closest point on the specified curve (index 1).
-
getClosest
public PointString<SubrangePoint> getClosest(Surface surface, double tol)
Returns the closest points (giving the minimum distance) between this curve and the specified surface. If this curve intersects the specified surface, then the 1st intersection found is returned (not all the intersections are found and there is no guarantee about which intersection will be returned). If this curve is parallel to the specified surface (all closest points are equidistant away), then any point on this curve and the closest point on the target surface will be returned as "closest".- Specified by:
getClosest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
surface
- The surface to find the closest points between this curve and that surface.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- A list containing two SubrangePoint objects that represent the closest point on this curve (index 0) and the closest point on the specified surface (index 1).
-
getClosest
public SubrangePoint getClosest(GeomPlane plane, double tol)
Returns the closest points (giving the minimum distance) between this curve and the specified plane. If this curve intersects the specified plane, then the 1st intersection found is returned (not all the intersections are found and there is no guarantee about which intersection will be returned). If this curve is parallel to the specified plane (all closest points are equidistant away), then any point on this curve and the closest point on the target plane will be returned as "closest".- Specified by:
getClosest
in interfaceCurve<T extends AbstractCurve>
- Parameters:
plane
- The plane to find the closest points between this curve and that plane.tol
- Fractional tolerance (in parameter space) to refine the point position to.- Returns:
- The closest point found on this curve to the specified plane.
-
getLimitPoint
public SubrangePoint getLimitPoint(int dim, boolean max, double tol)
Returns the most extreme point, either minimum or maximum, in the specified coordinate direction on this curve. This is more accurate thangetBoundsMax
&getBoundsMin
, but also typically takes longer to compute.- Specified by:
getLimitPoint
in interfaceGeomElement<T extends AbstractCurve>
- Parameters:
dim
- An index indicating the dimension to find the min/max point for (0=X, 1=Y, 2=Z, etc).max
- Set totrue
to return the maximum value,false
to return the minimum.tol
- Fractional tolerance (in parameter space) to refine the min/max point position to.- Returns:
- The point found on this curve that is the min or max in the specified coordinate direction.
- See Also:
GeomElement.getBoundsMin()
,GeomElement.getBoundsMax()
-
getEnclosedArea
public Parameter<javax.measure.quantity.Area> getEnclosedArea(GeomPoint refPnt, double eps)
Return the signed area of the region enclosed or subtended by a planar curve relative to the specified reference point. This method assumes that the curve is planar and will give incorrect results if the curve is not planar. Also, the input reference point is assumed to lie in the plane of the curve, it if is not, this will give incorrect results. If the curve is closed, then the reference point is arbitrary (as long as it is in the plane of the curve). If the curve is open, then the area returned is that subtended by the curve with straight lines from each end of the curve to the input point.- Specified by:
getEnclosedArea
in interfaceCurve<T extends AbstractCurve>
- Parameters:
refPnt
- The reference point used for computing the enclosed or subtended area of the curve.eps
- The desired fractional accuracy of the area calculated.- Returns:
- The area enclosed or subtended by this curve (assuming that this curve is planar and that the reference point lies in the plane of this curve).
-
isDegenerate
public boolean isDegenerate(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this curve is degenerate (i.e.: has length less than the specified tolerance).- Specified by:
isDegenerate
in interfaceCurve<T extends AbstractCurve>
- Specified by:
isDegenerate
in interfaceParametricGeometry<T extends AbstractCurve>
- Parameters:
tol
- The tolerance for determining if this curve is degenerate. May not be null.- Returns:
- true if this curve is degenerate.
-
isPlanar
public boolean isPlanar(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this curve is planar orfalse
if it is not.- Specified by:
isPlanar
in interfaceCurve<T extends AbstractCurve>
- Parameters:
tol
- The geometric tolerance to use in determining if the curve is planar.- Returns:
- true if this curve is planar.
-
isLine
public boolean isLine(Parameter<javax.measure.quantity.Length> tol)
Returnstrue
if this curve is a line to within the specified tolerance.- Specified by:
isLine
in interfaceCurve<T extends AbstractCurve>
- Parameters:
tol
- The tolerance for determining if this curve is a line.- Returns:
- true if this curve is a line.
-
isCircular
public boolean isCircular(Parameter<javax.measure.quantity.Length> tol)
Returnstrue
if this curve is a circular arc to within the specified tolerance.- Specified by:
isCircular
in interfaceCurve<T extends AbstractCurve>
- Parameters:
tol
- The tolerance for determining if this curve is a circular arc.- Returns:
- true if this curve is a circular arc.
-
-