Package geomss.geom
Class LineSeg
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<LineSegment>
-
- geomss.geom.LineSegment
-
- geomss.geom.LineSeg
-
- All Implemented Interfaces:
Curve<LineSegment>,GeomElement<LineSegment>,ParametricGeometry<LineSegment>,PointGeometry<LineSegment>,Transformable<LineSegment>,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,javolution.lang.Immutable,javolution.lang.Reusable,javolution.lang.ValueType,javolution.xml.XMLSerializable
public final class LineSeg extends LineSegment implements javolution.lang.ValueType
A concrete line segment in n-dimensional space.Modified by: Joseph A. Huwaldt
- Version:
- February 17, 2025
- Author:
- Joseph A. Huwaldt Date: January 14, 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 LineSegcopy()Returns a copy of this LineSeg instanceallocatedby the calling thread (possibly on the stack).LineSegcopyToReal()Return a copy of this object with any transformations or subranges removed (applied).booleanequals(java.lang.Object obj)Compares this LineSeg against the specified object for strict equality.Parameter<javax.measure.quantity.Length>getArcLength(double eps)Return the total arc length of this curve.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).GeomVector<javax.measure.quantity.Length>getDerivativeVector()Return the dimensional derivative vector for this line segment.PointgetEnd()Return the end point of the line segment.PointgetRealPoint(double s)Calculate a point on the curve for the given parametric distance along the curve.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.PointgetStart()Return the starting point of the line segment.Vector<javax.measure.quantity.Dimensionless>getUnitVector()Get a unit direction vector for the line segment.inthashCode()Returns the hash code for this parameter.static voidrecycle(LineSeg instance)Recycles aLineSeginstance immediately (on the stack when executing in aStackContext).LineSegmentreverse()Return a new curve that is identical to this one, but with the parameterization reversed.LineSegto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this element but stated in the specified unit.LineSegtoDimension(int newDim)Return a copy of this curve converted to the specified number of physical dimensions.static LineSegvalueOf(Curve lineCrv)Returns aLineSegthat represents a straight line between the end points of the input curve.static LineSegvalueOf(Point p0, GeomVector<javax.measure.quantity.Length> Ldir)Returns aLineSeginstance with the specified start point and direction/length vector.static LineSegvalueOf(Point p0, Point p1)Returns aLineSeginstance with the specified end points.-
Methods inherited from class geomss.geom.LineSegment
extractGrid, getArcLength, getCurvature, getLimitPoint, getNumberOfPoints, getPhyDimension, getPointAtArcLength, getTorsion, getTransformed, getUnit, getVariationOfCurvature, gridToTolerance, intersect, intersect, isCircular, isLine, isPlanar, isValid, size, splitAt, toNurbs, toNurbs, toText
-
Methods inherited from class geomss.geom.AbstractCurve
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, getName, getParDimension, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
-
-
-
-
Method Detail
-
valueOf
public static LineSeg valueOf(Point p0, Point p1)
Returns aLineSeginstance with the specified end points. The units of the curve will be the units of the start point.- Parameters:
p0- The start (beginning) of the line segment. May not be null.p1- The end of the line segment. May not be null.- Returns:
- A
LineSeginstance that represents a line between the input points.
-
valueOf
public static LineSeg valueOf(Point p0, GeomVector<javax.measure.quantity.Length> Ldir)
Returns aLineSeginstance with the specified start point and direction/length vector. The units of the curve will be the units of the start point.- Parameters:
p0- The start (beginning) of the line segment. May not be null.Ldir- The vector defining the direction and length of the line segment. May not be null.- Returns:
- A line segment from the input point in the direction and length of the input vector.
-
valueOf
public static LineSeg valueOf(Curve lineCrv)
Returns aLineSegthat represents a straight line between the end points of the input curve. WARNING: No check is made that the input curve is truly a straight line. The end points of the input curve are simply used to define a straight line segment.- Parameters:
lineCrv- A curve from which the end points will be used to define a line segment. May not be null.- Returns:
- The line segment between the end points of the input curve.
- See Also:
Curve.isLine(jahuwaldt.js.param.Parameter<javax.measure.quantity.Length>)
-
recycle
public static void recycle(LineSeg instance)
Recycles aLineSeginstance immediately (on the stack when executing in aStackContext).- Parameters:
instance- The instance to recycle immediately.
-
getStart
public Point getStart()
Return the starting point of the line segment.- Specified by:
getStartin classLineSegment- Returns:
- The starting point for this line segment.
-
getEnd
public Point getEnd()
Return the end point of the line segment.- Specified by:
getEndin classLineSegment- Returns:
- The end point of this line segment.
-
getUnitVector
public Vector<javax.measure.quantity.Dimensionless> getUnitVector()
Get a unit direction vector for the line segment.- Specified by:
getUnitVectorin classLineSegment- Returns:
- A unit vector indicating the direction of this line 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.
-
getRealPoint
public Point getRealPoint(double s)
Calculate a point on the curve for the given parametric distance along the curve.- 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.
-
getArcLength
public Parameter<javax.measure.quantity.Length> getArcLength(double eps)
Return the total arc length of this curve.- Specified by:
getArcLengthin interfaceCurve<LineSegment>- Overrides:
getArcLengthin classAbstractCurve<LineSegment>- Parameters:
eps- The desired fractional accuracy on the arc-length. For this curve type, this parameter is ignored and the exact arc length is always returned.- Returns:
- The total arc length of the curve.
-
reverse
public LineSegment 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.
-
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.
-
toDimension
public LineSeg toDimension(int newDim)
Return a copy 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:
toDimensionin interfaceCurve<LineSegment>- Specified by:
toDimensionin interfaceGeomElement<LineSegment>- Specified by:
toDimensionin interfaceParametricGeometry<LineSegment>- Parameters:
newDim- The dimension of the curve to return.- Returns:
- This curve converted to the new dimensions.
-
to
public LineSeg to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this element 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 element to be returned. May not be null.- Returns:
- an equivalent to this element but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException- if the the input unit is not a length unit.
-
copy
public LineSeg copy()
Returns a copy of this LineSeg instanceallocatedby the calling thread (possibly on the stack).- Specified by:
copyin interfaceCurve<LineSegment>- Specified by:
copyin interfaceGeomElement<LineSegment>- Specified by:
copyin interfaceParametricGeometry<LineSegment>- Specified by:
copyin interfacejavolution.lang.ValueType- Returns:
- an identical and independent copy of this line segment.
-
copyToReal
public LineSeg copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToRealin interfaceCurve<LineSegment>- Specified by:
copyToRealin interfaceGeomElement<LineSegment>- Returns:
- A copy of this object with any transformations or subranges removed (applied).
-
equals
public boolean equals(java.lang.Object obj)
Compares this LineSeg against the specified object for strict equality.- Overrides:
equalsin classAbstractGeomElement<LineSegment>- Parameters:
obj- the object to compare with.- Returns:
trueif this LineSeg is identical to that LineSeg;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<LineSegment>- Returns:
- the hash code value.
-
-