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>
AGeomTransformobject that refers to aLineSegmentobject 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 LineSegTranscopy()Returns a copy of this LineSegTrans instance allocated by the calling thread (possibly on the stack).LineSegmentcopyToReal()Return a copy of the child object transformed by this transformation.booleanequals(java.lang.Object obj)Compares this LineSegTrans against the specified object for strict equality.PointgetBoundsMax()Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).PointgetBoundsMin()Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).LineSegmentgetChild()Returns the child object transformed by this transform element.GeomVector<javax.measure.quantity.Length>getDerivativeVector()Return the dimensional derivative vector for this line segment.GeomPointgetEnd()Return the end point of the line segment.intgetPhyDimension()Returns the number of physical dimensions of the geometry element.PointgetRealPoint(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 from0togradewith respect to parametric distance on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s.GeomPointgetStart()Return the starting point of the line segment.GTransformgetTotalTransform()Returns the total transformation represented by an entire chain of GeomTransform objects below this one.GTransformgetTransform()Returns the transformation represented by this transformation element.LineSegTransgetTransformed(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.inthashCode()Returns the hash code for this parameter.static LineSegTransnewInstance(LineSegment child, GTransform transform)static voidrecycle(LineSegTrans instance)Recycles aLineSegTransinstance immediately (on the stack when executing in a StackContext).LineSegTransreverse()Return a new curve that is identical to this one, but with the parameterization reversed.voidsetTransform(GTransform transform)Sets the transformation represented by this transformation element.intsize()Returns the number of child-elements that make up this geometry element.LineSegTransto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this curve but stated in the specified unit.LineSegTranstoDimension(int newDim)Return the equivalent of this line segment converted to the specified number of physical dimensions.NurbsCurvetoNurbs(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:
getTransformin 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:
getTotalTransformin 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:
setTransformin 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:
getChildin 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:
copyToRealin interfaceCurve<LineSegment>- Specified by:
copyToRealin interfaceGeomElement<LineSegment>- Specified by:
copyToRealin 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:
getStartin classLineSegment- Returns:
- The starting point of the line segment.
-
getEnd
public GeomPoint getEnd()
Return the end point of the line segment.- Specified by:
getEndin 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:
getDerivativeVectorin 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:
getUnitVectorin 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:
sizein interfaceGeomElement<LineSegment>- Overrides:
sizein 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:
getPhyDimensionin interfaceGeomElement<LineSegment>- Overrides:
getPhyDimensionin 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:
getRealPointin 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 from0togradewith 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:
getSDerivativesin 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:
reversein 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:
getBoundsMinin 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:
getBoundsMaxin 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 implementsGeomTransformand contains this element as a child.- Specified by:
getTransformedin interfaceTransformable<LineSegment>- Overrides:
getTransformedin 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:
getUnitin interfaceGeomElement<LineSegment>- Overrides:
getUnitin 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:
toin interfaceCurve<LineSegment>- Specified by:
toin interfaceGeomElement<LineSegment>- Specified by:
toin interfaceParametricGeometry<LineSegment>- Specified by:
toin interfacePointGeometry<LineSegment>- Specified by:
toin 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:
toDimensionin interfaceCurve<LineSegment>- Specified by:
toDimensionin interfaceGeomElement<LineSegment>- Specified by:
toDimensionin 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:
toNurbsin interfaceCurve<LineSegment>- Overrides:
toNurbsin 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:
copyin interfaceCurve<LineSegment>- Specified by:
copyin interfaceGeomElement<LineSegment>- Specified by:
copyin 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:
equalsin classAbstractGeomElement<LineSegment>- Parameters:
obj- the object to compare with.- Returns:
trueif this transform is identical to that transform;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<LineSegment>- Returns:
- the hash code value.
-
recycle
public static void recycle(LineSegTrans instance)
Recycles aLineSegTransinstance immediately (on the stack when executing in a StackContext).- Parameters:
instance- The instance to recycle immediately.
-
-