Package geomss.geom
Class SubrangePoint
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<GeomPoint>
-
- geomss.geom.GeomPoint
-
- geomss.geom.SubrangePoint
-
- All Implemented Interfaces:
GeomElement<GeomPoint>,PointGeometry<GeomPoint>,Subrange<GeomPoint>,Transformable<GeomPoint>,XYPoint,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,javolution.lang.Reusable,javolution.xml.XMLSerializable
public final class SubrangePoint extends GeomPoint implements Subrange<GeomPoint>
AGeomPointelement that refers to aParametricGeometryobject such as aCurveorSurfaceand a parametric position on that parametric object.Modified by: Joseph A. Huwaldt
- Version:
- October 14, 2017
- Author:
- Joseph A. Huwaldt, Date: May 28, 2009
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubrangePointcopy()Returns a copy of this SubrangePoint instanceallocatedby the calling thread (possibly on the stack).PointcopyToReal()Return a copy of the child object transformed into a concreteGeomPointobject (information on the parametric position on the child parametric geometry is removed).booleanequals(java.lang.Object obj)Compares this SubrangePoint against the specified object for strict equality (same values and same units).ParametricGeometrygetChild()Returns the child object this point is subranged onto.GeomPointgetParPosition()Returns the parametric position on the child object that this point refers to.intgetPhyDimension()Returns the number of physical dimensions of the geometry element.GeomPointTransgetTransformed(GTransform transform)Returns transformed version of this element.javax.measure.unit.Unit<javax.measure.quantity.Length>getUnit()Returns the unit in which thevaluesin this point are stated in.doublegetValue(int i)Returns the value of a coordinate in this point as adouble, stated in this point'sunit.doublegetValue(int i, javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the value of a coordinate in this point as adouble, stated in the specified unit.inthashCode()Returns the hash code for this parameter.Pointimmutable()Return an immutable version of this point.booleanisValid()Returntrueif this point contains valid and finite numerical components.Pointminus(GeomPoint that)Returns the difference between this point and the one specified.Pointminus(Parameter<javax.measure.quantity.Length> that)Subtracts the specified parameter from each component of this point.static SubrangePointnewInstance(Curve child, double s)Returns aSubrangePointinstance referring to the specifiedCurveand parametric location.static SubrangePointnewInstance(ParametricGeometry child, GeomPoint par)Returns aSubrangePointinstance referring to the specifiedParametricGeometryand parametric location.static SubrangePointnewInstance(Surface child, double s, double t)Returns aSubrangePointinstance referring to the specifiedSurfaceand parametric location.doublenormSqValue()Returns the square of the Euclidean norm, magnitude, or length value of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself).Pointopposite()Returns the negation of this point (all the values of each dimension negated).Pointplus(GeomPoint that)Returns the sum of this point with the one specified.Pointplus(Parameter<javax.measure.quantity.Length> that)Adds the specified parameter to each component of this point.static voidrecycle(SubrangePoint instance)Recycles aSubrangePointinstance immediately (on the stack when executing in aStackContext).voidsetParPosition(GeomPoint par)Sets the parametric position on the child object that this point refers to.Pointtimes(double k)Returns the product of this point with the specified coefficient.GeomPointto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this point but stated in the specified unit.GeomPointtoDimension(int newDim)Return the equivalent of this point converted to the specified number of physical dimensions.Float64VectortoFloat64Vector()Returns the values stored in this transformed point, stated in this point'sunit, as a Float64Vector.Vector3D<javax.measure.quantity.Length>toVector3D()Returns a Vector3D representation of this transformed point if possible.-
Methods inherited from class geomss.geom.GeomPoint
distance, distanceSq, distanceSqValue, distanceValue, divide, divide, get, getBoundsMax, getBoundsMin, getLimitPoint, getNumberOfPoints, getParDimension, getX, getY, getZ, isApproxEqual, isApproxEqual, max, min, norm, normSq, normValue, size, times, toArray, toArray, toGeomVector, toParameterVector, toText
-
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 SubrangePoint newInstance(Curve child, double s)
Returns aSubrangePointinstance referring to the specifiedCurveand parametric location.- Parameters:
child- TheCurveobject that this point is subranged onto (may not benull).s- The parametric s-position (between 0 and 1) along curve where the point is located (may not benull).- Returns:
- the subrange point having the specified values.
-
newInstance
public static SubrangePoint newInstance(Surface child, double s, double t)
Returns aSubrangePointinstance referring to the specifiedSurfaceand parametric location.- Parameters:
child- TheSurfaceobject that this point is subranged onto (may not benull).s- The parametric s-position (between 0 and 1) along surface where the point is located.t- The parametric t-position (between 0 and 1) along surface where the point is located.- Returns:
- the subrange point having the specified values.
-
newInstance
public static SubrangePoint newInstance(ParametricGeometry child, GeomPoint par)
Returns aSubrangePointinstance referring to the specifiedParametricGeometryand parametric location.- Parameters:
child- TheParametricGeometryobject that this point is subranged onto (may not benull).par- The parametric position (between 0 and 1) along each parametric dimension where the point is located (may not benull).- Returns:
- the subrange point 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 GeomPoint getParPosition()
Returns the parametric position on the child object that this point refers to.- Specified by:
getParPositionin interfaceSubrange<GeomPoint>- Returns:
- The parametric position on the child object that this subrange refers to.
-
setParPosition
public void setParPosition(GeomPoint par)
Sets the parametric position on the child object that this point refers to.- Specified by:
setParPositionin interfaceSubrange<GeomPoint>- Parameters:
par- The parametric position (between 0 and 1) along each parametric dimension where the point is located (may not benull).
-
getChild
public ParametricGeometry getChild()
Returns the child object this point is subranged onto.
-
copyToReal
public Point copyToReal()
Return a copy of the child object transformed into a concreteGeomPointobject (information on the parametric position on the child parametric geometry is removed).- Specified by:
copyToRealin interfaceGeomElement<GeomPoint>- Specified by:
copyToRealin classGeomPoint- Returns:
- A copy of this object with the subrange removed (applied).
-
recycle
public static void recycle(SubrangePoint instance)
Recycles aSubrangePointinstance immediately (on the stack when executing in aStackContext).- Parameters:
instance- The instance to be recycled.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimensionin interfaceGeomElement<GeomPoint>- Returns:
- The number of physical dimensions of the geometry element.
-
getValue
public double getValue(int i)
Returns the value of a coordinate in this point as adouble, stated in this point'sunit.
-
getValue
public double getValue(int i, javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the value of a coordinate in this point as adouble, stated in the specified unit.
-
normSqValue
public double normSqValue()
Returns the square of the Euclidean norm, magnitude, or length value of the vector from the origin to this point (the dot product of the origin-to-this-point vector and itself). This is slightly faster than callingnormValueif the squared value is all that is needed.- Specified by:
normSqValuein classGeomPoint- Returns:
this.normSq().getValue().- See Also:
GeomPoint.normValue()
-
plus
public Point plus(GeomPoint that)
Returns the sum of this point with the one specified. The unit of the output point will be the units of this point.- Specified by:
plusin classGeomPoint- Parameters:
that- the point to be added. May not be null.- Returns:
this + that.- Throws:
DimensionException- if point dimensions are different.
-
plus
public Point plus(Parameter<javax.measure.quantity.Length> that)
Adds the specified parameter to each component of this point. The unit of the output point will be the units of this point.
-
minus
public Point minus(GeomPoint that)
Returns the difference between this point and the one specified. The unit of the output point will be the units of this point.- Specified by:
minusin classGeomPoint- Parameters:
that- the point to be subtracted from this point. May not be null.- Returns:
this - that.- Throws:
DimensionException- if point dimensions are different.
-
minus
public Point minus(Parameter<javax.measure.quantity.Length> that)
Subtracts the specified parameter from each component of this point. The unit of the output point will be the units of this point.
-
opposite
public Point opposite()
Returns the negation of this point (all the values of each dimension negated).
-
times
public Point times(double k)
Returns the product of this point with the specified coefficient.
-
isValid
public boolean isValid()
Returntrueif this point contains valid and finite numerical components. A value offalsewill be returned if any of the coordinate values are NaN or Inf.- Specified by:
isValidin interfaceGeomElement<GeomPoint>- Overrides:
isValidin classGeomPoint- Returns:
- true if this point contains valid and finite numerical components.
-
copy
public SubrangePoint copy()
Returns a copy of this SubrangePoint instanceallocatedby the calling thread (possibly on the stack).- Specified by:
copyin interfaceGeomElement<GeomPoint>- Specified by:
copyin classGeomPoint- Returns:
- an identical and independent copy of this point.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which thevaluesin this point are stated in.- Specified by:
getUnitin interfaceGeomElement<GeomPoint>- Returns:
- The unit in which the coordinate values in this point are stated in.
-
to
public GeomPoint to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this point but stated in the specified unit.- Specified by:
toin interfaceGeomElement<GeomPoint>- Specified by:
toin interfacePointGeometry<GeomPoint>- Parameters:
unit- the length unit of the point to be returned. May not be null.- Returns:
- an equivalent to this point but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException- if the the input unit is not a length unit.
-
toVector3D
public Vector3D<javax.measure.quantity.Length> toVector3D()
Returns a Vector3D representation of this transformed point if possible.- Overrides:
toVector3Din classGeomPoint- Returns:
- A Vector3D that is equivalent to this transformed point
- Throws:
DimensionException- if this point has any number of dimensions other than 3.
-
toFloat64Vector
public Float64Vector toFloat64Vector()
Returns the values stored in this transformed point, stated in this point'sunit, as a Float64Vector.- Specified by:
toFloat64Vectorin classGeomPoint- Returns:
- A Float64Vector containing the coordinate values in this point.
-
toDimension
public GeomPoint toDimension(int newDim)
Return the equivalent of this point 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. NOTE: The returned point is no longer a SubrangePoint.- Specified by:
toDimensionin interfaceGeomElement<GeomPoint>- Parameters:
newDim- The dimension of the point to return.- Returns:
- The equivalent of this point converted to the new dimensions.
-
getTransformed
public GeomPointTrans getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implementsGeomTransformand contains this element as a child.- Specified by:
getTransformedin interfaceTransformable<GeomPoint>- Overrides:
getTransformedin classGeomPoint- 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 SubrangePoint against the specified object for strict equality (same values and same units).- Overrides:
equalsin classAbstractGeomElement<GeomPoint>- Parameters:
obj- the object to compare with.- Returns:
trueif this point is identical to that point;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<GeomPoint>- Returns:
- the hash code value.
-
-