Package geomss.geom.nurbs
Class NurbsCurveTrans
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<NurbsCurve>
-
- geomss.geom.nurbs.NurbsCurve
-
- geomss.geom.nurbs.NurbsCurveTrans
-
- All Implemented Interfaces:
Curve<NurbsCurve>
,GeomElement<NurbsCurve>
,GeomTransform<NurbsCurve>
,ParametricGeometry<NurbsCurve>
,Transformable<NurbsCurve>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
public final class NurbsCurveTrans extends NurbsCurve implements GeomTransform<NurbsCurve>
AGeomTransform
object that refers to aNurbsCurve
object and masquerades as a NurbsCurve object itself.Modified by: Joseph A. Huwaldt
- Version:
- November 28, 2015
- Author:
- Joseph A. Huwaldt, Date: April 30, 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 NurbsCurveTrans
copy()
Returns a copy of this NurbsCurveTrans instanceallocated
by the calling thread (possibly on the stack).BasicNurbsCurve
copyToReal()
Return a copy of the child object transformed by this transformation.boolean
equals(java.lang.Object obj)
Compares this NurbsCurveTrans against the specified object for strict equality.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).NurbsCurve
getChild()
Returns the child object transformed by this transform element.java.util.List<ControlPoint>
getControlPoints()
Return a list of transformed control points for this curve.int
getDegree()
Return the degree of the NURBS curve.KnotVector
getKnotVector()
Return the knot vector of this curve.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
.GTransform
getTotalTransform()
Returns the total transformation represented by an entire chain of GeomTransform objects below this one.GTransform
getTransform()
Returns the transformation represented by this transformation element.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which the control points in this curve are stated.int
hashCode()
Returns the hash code for this parameter.BasicNurbsCurve
immutable()
Return an immutable version of this NURBS curve.static NurbsCurveTrans
newInstance(NurbsCurve child, GTransform transform)
static void
recycle(NurbsCurveTrans instance)
Recycles aNurbsCurveTrans
instance immediately (on the stack when executing in a StackContext).void
setTransform(GTransform transform)
Sets the transformation represented by this transformation element.int
size()
Returns the number of child-elements that make up this geometry element.NurbsCurveTrans
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this curve but stated in the specified unit.NurbsCurveTrans
toDimension(int newDim)
Return the equivalent of this curve converted to the specified number of physical dimensions.-
Methods inherited from class geomss.geom.nurbs.NurbsCurve
getArcLength, getArcLength, getTransformed, gridToTolerance, insertKnot, intersect, isDegenerate, isLine, isPlanar, isValid, mergeKnotVector, refineKnotVector, refineKnotVector, removeKnot, reverse, splitAt, toNurbs, toNurbs, toText
-
Methods inherited from class geomss.geom.AbstractCurve
extractGrid, 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, intersect, intersect, intersect, intersect, isCircular, 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, getLimitPoint, getName, getParDimension, getUserData, isValid, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toText
-
Methods inherited from interface geomss.geom.Transformable
getTransformed
-
-
-
-
Method Detail
-
newInstance
public static NurbsCurveTrans newInstance(NurbsCurve child, GTransform transform)
- Parameters:
child
- The NurbsCurve that is the child of this transform element (may not benull
).transform
- The transform held by this transform element (may not benull
).- Returns:
- the transform element having the specified values.
-
getTransform
public GTransform getTransform()
Returns the transformation represented by this transformation element.- Specified by:
getTransform
in interfaceGeomTransform<NurbsCurve>
- Returns:
- The transformation represented by this element.
-
getTotalTransform
public GTransform getTotalTransform()
Returns the total transformation represented by an entire chain of GeomTransform objects below this one.- Specified by:
getTotalTransform
in interfaceGeomTransform<NurbsCurve>
- Returns:
- The total transformation represented by the entire chain of transform objects.
-
setTransform
public void setTransform(GTransform transform)
Sets the transformation represented by this transformation element.- Specified by:
setTransform
in interfaceGeomTransform<NurbsCurve>
- Parameters:
transform
- The transform to set this transform element to (may not benull
).
-
getChild
public NurbsCurve getChild()
Returns the child object transformed by this transform element.- Specified by:
getChild
in interfaceGeomTransform<NurbsCurve>
- Returns:
- The child object transformed by this element.
-
copyToReal
public BasicNurbsCurve copyToReal()
Return a copy of the child object transformed by this transformation.- Specified by:
copyToReal
in interfaceCurve<NurbsCurve>
- Specified by:
copyToReal
in interfaceGeomElement<NurbsCurve>
- Specified by:
copyToReal
in interfaceGeomTransform<NurbsCurve>
- Returns:
- A copy of this object with any transformations or subranges removed (applied).
-
immutable
public BasicNurbsCurve immutable()
Return an immutable version of this NURBS curve.- Specified by:
immutable
in classNurbsCurve
- Returns:
- an immutable version of this curve.
-
size
public int size()
Returns the number of child-elements that make up this geometry element. This implementation returns the number of control points in the child NURBS curve.- Specified by:
size
in interfaceGeomElement<NurbsCurve>
- 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<NurbsCurve>
- Returns:
- The number of physical dimensions of this geometry element.
-
getControlPoints
public java.util.List<ControlPoint> getControlPoints()
Return a list of transformed control points for this curve.- Specified by:
getControlPoints
in classNurbsCurve
- Returns:
- the ordered control points
-
getKnotVector
public KnotVector getKnotVector()
Return the knot vector of this curve.- Specified by:
getKnotVector
in classNurbsCurve
- Returns:
- The knot vector.
-
getDegree
public int getDegree()
Return the degree of the NURBS curve.- Specified by:
getDegree
in classNurbsCurve
- Returns:
- degree of curve
-
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<NurbsCurve>
- 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<NurbsCurve>
- 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<NurbsCurve>
- 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<NurbsCurve>
- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which the control points in this curve are stated.- Specified by:
getUnit
in interfaceGeomElement<NurbsCurve>
- Returns:
- The unit in which the geometry in this element are stated.
-
to
public NurbsCurveTrans 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<NurbsCurve>
- Specified by:
to
in interfaceGeomElement<NurbsCurve>
- Specified by:
to
in interfaceParametricGeometry<NurbsCurve>
- 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 NurbsCurveTrans toDimension(int newDim)
Return the equivalent of this curve converted to the specified number of physical dimensions. This implementation will throw an exception if the specified dimension is anything other than 3.- Specified by:
toDimension
in interfaceCurve<NurbsCurve>
- Specified by:
toDimension
in interfaceGeomElement<NurbsCurve>
- Specified by:
toDimension
in interfaceParametricGeometry<NurbsCurve>
- Parameters:
newDim
- The dimension of the curve to return. MUST equal 3.- Returns:
- The equivalent of this curve converted to the new dimensions.
- Throws:
java.lang.IllegalArgumentException
- if the new dimension is anything other than 3.
-
copy
public NurbsCurveTrans copy()
Returns a copy of this NurbsCurveTrans instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceCurve<NurbsCurve>
- Specified by:
copy
in interfaceGeomElement<NurbsCurve>
- Specified by:
copy
in interfaceParametricGeometry<NurbsCurve>
- Returns:
- an identical and independent copy of this point.
-
equals
public boolean equals(java.lang.Object obj)
Compares this NurbsCurveTrans against the specified object for strict equality.- Overrides:
equals
in classAbstractGeomElement<NurbsCurve>
- Parameters:
obj
- the object to compare with.- Returns:
true
if this transform is identical to that transform;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCode
in classAbstractGeomElement<NurbsCurve>
- Returns:
- the hash code value.
-
recycle
public static void recycle(NurbsCurveTrans instance)
Recycles aNurbsCurveTrans
instance immediately (on the stack when executing in a StackContext).- Parameters:
instance
- The instance to be recycled.
-
-