Package geomss.geom
Class SubrangeCurve
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<SubrangeCurve>
-
- geomss.geom.SubrangeCurve
-
- All Implemented Interfaces:
Curve<SubrangeCurve>
,GeomElement<SubrangeCurve>
,ParametricGeometry<SubrangeCurve>
,Subrange<Curve>
,Transformable<SubrangeCurve>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
public final class SubrangeCurve extends AbstractCurve<SubrangeCurve> implements Subrange<Curve>
ACurve
element that refers to aParametricGeometry
object such as aCurve
orSurface
and a parametric curve on that parametric object.Modified by: Joseph A. Huwaldt
- Version:
- November 27, 2015
- Author:
- Joseph A. Huwaldt, Date: May 28, 2009
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractCurve
GTOL
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubrangeCurve
copy()
Returns a copy of thisSubrangeCurve
instanceallocated
by the calling thread (possibly on the stack).SubrangeCurve
copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).boolean
equals(java.lang.Object obj)
Compares this SubrangeCurve against the specified object for strict equality (same values and same units).Point
getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).Point
getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).ParametricGeometry
getChild()
Returns the child object this point is subranged onto.Curve
getParPosition()
Returns the parametric position on the child object that this curve refers to.int
getPhyDimension()
Returns the number of physical dimensions of the geometry element.Point
getRealPoint(double s)
Calculate a point on the curve for the given parametric distance along the curve,p(s)
.java.util.List<Vector<javax.measure.quantity.Length>>
getSDerivatives(double 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
.SubrangeCurve
getTransformed(GTransform transform)
Returns transformed version of this element.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which this curves values are stated.int
hashCode()
Returns the hash code for this parameter.boolean
isDegenerate(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this curve is degenerate (i.e.: has length less than the specified tolerance).boolean
isValid()
Returntrue
if this SubrangeCurve contains valid and finite numerical components.static SubrangeCurve
newInstance(ParametricGeometry child, Curve par)
Returns aSubrangeCurve
instance referring to the specifiedParametricGeometry
and parametric location.static void
recycle(SubrangeCurve instance)
Recycles aSubrangeCurve
instance immediately (on the stack when executing in aStackContext
).SubrangeCurve
reverse()
Return a new curve that is identical to this one, but with the parameterization reversed.void
setParPosition(Curve par)
Sets the parametric position on the child object that this curve refers to.int
size()
Returns the number of child-elements that make up this geometry element.GeomList<SubrangeCurve>
splitAt(double s)
Split thisSubrangeCurve
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).SubrangeCurve
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this curve but stated in the specified unit.SubrangeCurve
toDimension(int newDim)
Return the equivalent of this curve converted to the specified number of physical dimensions.NurbsCurve
toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS curve representation of this curve to within the specified tolerance.javolution.text.Text
toText()
Returns the text representation of this geometry element.-
Methods inherited from class geomss.geom.AbstractCurve
extractGrid, getArcLength, getArcLength, getArcLength, getBinormal, getBinormal, getClosest, getClosest, getClosest, getClosest, getClosest, getClosest, getCurvature, getCurvature, getDerivatives, getEnclosedArea, getFarthest, getFarthest, getFarthest, getLimitPoint, getParDimension, getPoint, getPoint, getPointAtArcLength, getPrincipalNormal, getPrincipalNormal, getRealPoint, getSDerivative, getSDerivatives, getTangencyPoint, getTangent, getTangent, getTorsion, getTorsion, getVariationOfCurvature, getVariationOfCurvature, gridToTolerance, intersect, intersect, intersect, intersect, intersect, isCircular, isLine, isPlanar, splitAt
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
-
-
-
-
Method Detail
-
newInstance
public static SubrangeCurve newInstance(ParametricGeometry child, Curve par)
Returns aSubrangeCurve
instance referring to the specifiedParametricGeometry
and parametric location.- Parameters:
child
- TheParametricGeometry
object that this curve is subranged onto (may not benull
).par
- A curve of the parametric position (between 0 and 1) along each parametric dimension where the curve is located (may not benull
).- Returns:
- the subrange curve having the specified values.
- Throws:
DimensionException
- if the input child object's parametric dimension is not compatible with the input parametric distance point.
-
getParPosition
public Curve getParPosition()
Returns the parametric position on the child object that this curve refers to.- Specified by:
getParPosition
in interfaceSubrange<Curve>
- Returns:
- The parametric position on the child object that this curve refers to.
-
setParPosition
public void setParPosition(Curve par)
Sets the parametric position on the child object that this curve refers to.- Specified by:
setParPosition
in interfaceSubrange<Curve>
- Parameters:
par
- The parametric position (between 0 and 1) along each parametric dimension where the curve is located (may not benull
).
-
getChild
public ParametricGeometry getChild()
Returns the child object this point is subranged onto.
-
recycle
public static void recycle(SubrangeCurve instance)
Recycles aSubrangeCurve
instance immediately (on the stack when executing in aStackContext
).- Parameters:
instance
- The instance to be recycled.
-
size
public int size()
Returns the number of child-elements that make up this geometry element. This implementation returns the size of the child object.- Specified by:
size
in interfaceGeomElement<SubrangeCurve>
- Returns:
- The number of child-elements that make up this geometry element.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimension
in interfaceGeomElement<SubrangeCurve>
- Returns:
- The number of physical dimensions of this element.
-
getRealPoint
public Point getRealPoint(double s)
Calculate a point on the curve for the given parametric distance along the curve,p(s)
.- Specified by:
getRealPoint
in interfaceCurve<SubrangeCurve>
- Parameters:
s
- parametric distance to calculate a point for (0.0 to 1.0 inclusive).- Returns:
- the calculated point
-
getSDerivatives
public java.util.List<Vector<javax.measure.quantity.Length>> getSDerivatives(double 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<SubrangeCurve>
- Parameters:
s
- Parametric distance to calculate derivatives for (0.0 to 1.0 inclusive).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.
-
getBoundsMin
public Point getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).- Specified by:
getBoundsMin
in interfaceGeomElement<SubrangeCurve>
- Returns:
- The minimum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
getBoundsMax
public Point getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).- Specified by:
getBoundsMax
in interfaceGeomElement<SubrangeCurve>
- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
isValid
public boolean isValid()
Returntrue
if this SubrangeCurve contains valid and finite numerical components. A value offalse
will be returned if any of the coordinate values are NaN or Inf.- Specified by:
isValid
in interfaceGeomElement<SubrangeCurve>
- Returns:
- true if this element contains valid and finite numerical values.
-
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<SubrangeCurve>
- Specified by:
isDegenerate
in interfaceParametricGeometry<SubrangeCurve>
- Overrides:
isDegenerate
in classAbstractCurve<SubrangeCurve>
- Parameters:
tol
- The tolerance for determining if this curve is degenerate. May not be null.- Returns:
- true if this curve is degenerate.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which this curves values are stated.- Specified by:
getUnit
in interfaceGeomElement<SubrangeCurve>
- Returns:
- The unit that this object is stated in.
-
to
public SubrangeCurve to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this curve but stated in the specified unit.- Specified by:
to
in interfaceCurve<SubrangeCurve>
- Specified by:
to
in interfaceGeomElement<SubrangeCurve>
- Specified by:
to
in interfaceParametricGeometry<SubrangeCurve>
- Parameters:
unit
- the length unit of the curve to be returned. May not be null.- Returns:
- an equivalent to this curve but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the the input unit is not a length unit.
-
toDimension
public SubrangeCurve toDimension(int newDim)
Return the equivalent of this curve converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.- Specified by:
toDimension
in interfaceCurve<SubrangeCurve>
- Specified by:
toDimension
in interfaceGeomElement<SubrangeCurve>
- Specified by:
toDimension
in interfaceParametricGeometry<SubrangeCurve>
- Parameters:
newDim
- The dimension of the curve to return.- Returns:
- The equivalent of this curve converted to the new dimensions.
-
toNurbs
public NurbsCurve toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS curve representation of this curve to within the specified tolerance.- Specified by:
toNurbs
in interfaceCurve<SubrangeCurve>
- Parameters:
tol
- The greatest possible difference between this curve and the NURBS representation returned. May not be null.- Returns:
- A NURBS curve that represents this curve to within the specified tolerance.
-
reverse
public SubrangeCurve reverse()
Return a new curve that is identical to this one, but with the parameterization reversed.- Specified by:
reverse
in interfaceCurve<SubrangeCurve>
- Returns:
- A new curve identical to this one, but with the parameterization reversed.
-
splitAt
public GeomList<SubrangeCurve> splitAt(double s)
Split thisSubrangeCurve
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<SubrangeCurve>
- Parameters:
s
- The parametric position where this curve should be split (must not be 0 or 1!).- Returns:
- A list containing two curves: 0 == the lower curve, 1 == the upper curve.
-
copy
public SubrangeCurve copy()
Returns a copy of thisSubrangeCurve
instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceCurve<SubrangeCurve>
- Specified by:
copy
in interfaceGeomElement<SubrangeCurve>
- Specified by:
copy
in interfaceParametricGeometry<SubrangeCurve>
- Returns:
- an identical and independent copy of this curve.
-
copyToReal
public SubrangeCurve copyToReal()
Return a copy of this object with any transformations or subranges removed (applied). This method is not yet implemented and current returns a new SubrangeCurve with the child and subrange curve geometry copied to real.- Specified by:
copyToReal
in interfaceCurve<SubrangeCurve>
- Specified by:
copyToReal
in interfaceGeomElement<SubrangeCurve>
- Returns:
- A copy of this object with any transformations or subranges removed (applied).
-
getTransformed
public SubrangeCurve getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implements is a new SubrangeCurve instance with the transformed version of this object's child as it's child.- Specified by:
getTransformed
in interfaceTransformable<SubrangeCurve>
- Parameters:
transform
- The transformation to apply to this geometry. May not be null.- Returns:
- A new triangle that is identical to this one with the specified transformation applied.
- Throws:
DimensionException
- if this point is not 3D.
-
equals
public boolean equals(java.lang.Object obj)
Compares this SubrangeCurve against the specified object for strict equality (same values and same units).- Overrides:
equals
in classAbstractGeomElement<SubrangeCurve>
- Parameters:
obj
- the object to compare with.- Returns:
true
if this point is identical to that point;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCode
in classAbstractGeomElement<SubrangeCurve>
- Returns:
- the hash code value.
-
toText
public javolution.text.Text toText()
Returns the text representation of this geometry element.- Specified by:
toText
in interfaceGeomElement<SubrangeCurve>
- Overrides:
toText
in classAbstractGeomElement<SubrangeCurve>
- Returns:
- A text representation of this geometry element.
-
-