Package geomss.geom
Class LineSegTrans
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<LineSegment>
-
- geomss.geom.LineSegment
-
- geomss.geom.LineSegTrans
-
- All Implemented Interfaces:
Curve<LineSegment>
,GeomElement<LineSegment>
,GeomTransform<LineSegment>
,ParametricGeometry<LineSegment>
,PointGeometry<LineSegment>
,Transformable<LineSegment>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
public final class LineSegTrans extends LineSegment implements GeomTransform<LineSegment>
AGeomTransform
object that refers to aLineSegment
object and masquerades as a LineSegment object itself.Modified by: Joseph A. Huwaldt
- Version:
- February 17, 2025
- Author:
- Joseph A. Huwaldt, Date: January 15, 2012
- 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 LineSegTrans
copy()
Returns a copy of this LineSegTrans instance allocated by the calling thread (possibly on the stack).LineSegment
copyToReal()
Return a copy of the child object transformed by this transformation.boolean
equals(java.lang.Object obj)
Compares this LineSegTrans 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).LineSegment
getChild()
Returns the child object transformed by this transform element.GeomVector<javax.measure.quantity.Length>
getDerivativeVector()
Return the dimensional derivative vector for this line segment.GeomPoint
getEnd()
Return the end point of the line segment.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
.GeomPoint
getStart()
Return the starting point of the line segment.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.LineSegTrans
getTransformed(GTransform transform)
Returns transformed version of this element.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which this curve is stated.GeomVector<javax.measure.quantity.Dimensionless>
getUnitVector()
Get unit direction vector for the line segment.int
hashCode()
Returns the hash code for this parameter.static LineSegTrans
newInstance(LineSegment child, GTransform transform)
static void
recycle(LineSegTrans instance)
Recycles aLineSegTrans
instance immediately (on the stack when executing in a StackContext).LineSegTrans
reverse()
Return a new curve that is identical to this one, but with the parameterization reversed.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.LineSegTrans
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this curve but stated in the specified unit.LineSegTrans
toDimension(int newDim)
Return the equivalent of this line segment converted to the specified number of physical dimensions.NurbsCurve
toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a transformed NURBS curve representation of this line segment.-
Methods inherited from class geomss.geom.LineSegment
extractGrid, getArcLength, getCurvature, getLimitPoint, getNumberOfPoints, getPointAtArcLength, getTorsion, getVariationOfCurvature, gridToTolerance, intersect, intersect, isCircular, isLine, isPlanar, isValid, splitAt, toNurbs, toText
-
Methods inherited from class geomss.geom.AbstractCurve
getArcLength, getArcLength, getBinormal, getBinormal, getClosest, getClosest, getClosest, getClosest, getClosest, getClosest, getCurvature, getDerivatives, getEnclosedArea, getFarthest, getFarthest, getFarthest, getParDimension, getPoint, getPoint, getPrincipalNormal, getPrincipalNormal, getRealPoint, getSDerivative, getSDerivatives, getTangencyPoint, getTangent, getTangent, getTorsion, getVariationOfCurvature, intersect, intersect, intersect, isDegenerate, 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
-
-
-
-
Method Detail
-
newInstance
public static LineSegTrans newInstance(LineSegment child, GTransform transform)
- Parameters:
child
- The LineSegment 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<LineSegment>
- Returns:
- The transformation from the child object 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<LineSegment>
- Returns:
- The total transformation represented by the entire chain of objects below this one.
-
setTransform
public void setTransform(GTransform transform)
Sets the transformation represented by this transformation element.- Specified by:
setTransform
in interfaceGeomTransform<LineSegment>
- Parameters:
transform
- The transform to set this transform element to (may not benull
).
-
getChild
public LineSegment getChild()
Returns the child object transformed by this transform element.- Specified by:
getChild
in interfaceGeomTransform<LineSegment>
- Returns:
- The child object transformed by this transform element.
-
copyToReal
public LineSegment copyToReal()
Return a copy of the child object transformed by this transformation.- Specified by:
copyToReal
in interfaceCurve<LineSegment>
- Specified by:
copyToReal
in interfaceGeomElement<LineSegment>
- Specified by:
copyToReal
in interfaceGeomTransform<LineSegment>
- Returns:
- A copy of the child object transformed by this transformation.
-
getStart
public GeomPoint getStart()
Return the starting point of the line segment.- Specified by:
getStart
in classLineSegment
- Returns:
- The starting point of the line segment.
-
getEnd
public GeomPoint getEnd()
Return the end point of the line segment.- Specified by:
getEnd
in classLineSegment
- Returns:
- The end point of the lien segment.
-
getDerivativeVector
public GeomVector<javax.measure.quantity.Length> getDerivativeVector()
Return the dimensional derivative vector for this line segment. The length of this vector is the length of the line segment, the origin is at the start point and the end of the vector is the line end.- Specified by:
getDerivativeVector
in classLineSegment
- Returns:
- The dimensional derivative vector for this line segment.
-
getUnitVector
public GeomVector<javax.measure.quantity.Dimensionless> getUnitVector()
Get unit direction vector for the line segment.- Specified by:
getUnitVector
in classLineSegment
- Returns:
- A unit vector indicating the direction of this line segment.
-
size
public int size()
Returns the number of child-elements that make up this geometry element. This implementation returns the size in the child curve.- Specified by:
size
in interfaceGeomElement<LineSegment>
- Overrides:
size
in classLineSegment
- Returns:
- The number of points in this line segment (always returns 2).
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimension
in interfaceGeomElement<LineSegment>
- Overrides:
getPhyDimension
in classLineSegment
- Returns:
- The number of physical dimensions of this geometry 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<LineSegment>
- 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<LineSegment>
- 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.
-
reverse
public LineSegTrans reverse()
Return a new curve that is identical to this one, but with the parameterization reversed.- Specified by:
reverse
in interfaceCurve<LineSegment>
- Returns:
- A new curve that is identical to this one, but with the parameterization reversed.
-
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<LineSegment>
- 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<LineSegment>
- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
getTransformed
public LineSegTrans getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implementsGeomTransform
and contains this element as a child.- Specified by:
getTransformed
in interfaceTransformable<LineSegment>
- Overrides:
getTransformed
in classLineSegment
- Parameters:
transform
- The transformation to apply to this geometry. May not be null.- Returns:
- A new line segment that is identical to this one with the specified transformation applied.
- Throws:
DimensionException
- if this point is not 3D.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which this curve is stated.- Specified by:
getUnit
in interfaceGeomElement<LineSegment>
- Overrides:
getUnit
in classLineSegment
- Returns:
- The unit in which this curve is stated.
-
to
public LineSegTrans 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<LineSegment>
- Specified by:
to
in interfaceGeomElement<LineSegment>
- Specified by:
to
in interfaceParametricGeometry<LineSegment>
- Specified by:
to
in interfacePointGeometry<LineSegment>
- Specified by:
to
in classLineSegment
- 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 LineSegTrans toDimension(int newDim)
Return the equivalent of this line segment 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<LineSegment>
- Specified by:
toDimension
in interfaceGeomElement<LineSegment>
- Specified by:
toDimension
in interfaceParametricGeometry<LineSegment>
- Parameters:
newDim
- The dimension of the line segment to return. MUST equal 3.- Returns:
- The equivalent of this line segment converted to the new dimensions.
- Throws:
java.lang.IllegalArgumentException
- if the new dimension is anything other than 3.
-
toNurbs
public NurbsCurve toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a transformed NURBS curve representation of this line segment. An exact representation is returned and the tolerance parameter is ignored.- Specified by:
toNurbs
in interfaceCurve<LineSegment>
- Overrides:
toNurbs
in classLineSegment
- Parameters:
tol
- Ignored. May passnull
.- Returns:
- A transformed NURBS curve that exactly represents this line segment.
-
copy
public LineSegTrans copy()
Returns a copy of this LineSegTrans instance allocated by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceCurve<LineSegment>
- Specified by:
copy
in interfaceGeomElement<LineSegment>
- Specified by:
copy
in interfaceParametricGeometry<LineSegment>
- Returns:
- an identical and independent copy of this point.
-
equals
public boolean equals(java.lang.Object obj)
Compares this LineSegTrans against the specified object for strict equality.- Overrides:
equals
in classAbstractGeomElement<LineSegment>
- 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<LineSegment>
- Returns:
- the hash code value.
-
recycle
public static void recycle(LineSegTrans instance)
Recycles aLineSegTrans
instance immediately (on the stack when executing in a StackContext).- Parameters:
instance
- The instance to recycle immediately.
-
-