Package geomss.geom
Class SubrangeSurface
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractSurface<SubrangeSurface>
-
- geomss.geom.SubrangeSurface
-
- All Implemented Interfaces:
GeomElement<SubrangeSurface>
,ParametricGeometry<SubrangeSurface>
,Subrange<Surface>
,Surface<SubrangeSurface>
,Transformable<SubrangeSurface>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
public class SubrangeSurface extends AbstractSurface<SubrangeSurface> implements Subrange<Surface>
A subrange or trimmedSurface
that is defined by a set of four 2D boundary curves that define the 4 parametric edges of the trimmed surface on the child surface.Modified by: Joseph A. Huwaldt
- Version:
- November 27, 2015
- Author:
- Joseph A. Huwaldt, Date: April 8, 2013
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractSurface
GTOL
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubrangeSurface
copy()
Returns a copy of thisSubrangeSurface
instanceallocated
by the calling thread (possibly on the stack).SubrangeSurface
copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).boolean
equals(java.lang.Object obj)
Compares the specified object with thisSubrangeSurface
for 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).ParametricGeometry
getChild()
Returns the child object this point is subranged onto.Surface
getParPosition()
Returns a 2D surface in parametric space which maps this surface's parametric positions to the child surface.int
getPhyDimension()
Returns the number of physical dimensions of the geometry element.Point
getRealPoint(double s, double t)
Calculate a point on the surface for the given parametric position on the surface.Curve
getS0Curve()
Return the S=0 Boundary for this surface as a curve.Curve
getS1Curve()
Return the S=1 Boundary for this surface as a curve.java.util.List<Vector<javax.measure.quantity.Length>>
getSDerivatives(double s, double t, int grade, boolean scaled)
Calculate all the derivatives from0
tograde
with respect to parametric s-position on the surface for the given parametric position on the surface,d^{grade}p(s,t)/d^{grade}s
.Curve
getT0Curve()
Return the T=0 Boundary for this surface as a curve.Curve
getT1Curve()
Return the T=1 Boundary for this surface as a curve.java.util.List<Vector<javax.measure.quantity.Length>>
getTDerivatives(double s, double t, int grade, boolean scaled)
Calculate all the derivatives from0
tograde
with respect to parametric t-position on the surface for the given parametric position on the surface,d^{grade}p(s,t)/d^{grade}t
.SubrangeSurface
getTransformed(GTransform transform)
Returns transformed version of this element.Vector<javax.measure.quantity.Length>
getTwistVector(double s, double t)
Calculate the twist vector (d^2P/(ds*dt) = d(dP/ds)/dt) for this surface at the specified position on this surface.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which this surface is stated.int
hashCode()
Returns the hash code for thisSubrangeSurface
.boolean
isDegenerate(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this surface is degenerate (i.e.: has area less than the specified tolerance squared).boolean
isValid()
Returntrue
if this SubrangeSurface contains valid and finite numerical components.static SubrangeSurface
newInstance(Surface child, double s0, double t0, double s1, double t1)
Returns a SubrangeSurface on the surfacechild
that covers the range of parametric positions froms0,t0
tos1,t1
.static SubrangeSurface
newInstance(Surface child, Curve s0, Curve t0, Curve s1, Curve t1, double tol)
Returns aSubrangeSurface
instance referring to the specifiedSurface
and the supplied boundary location curves in parametric space.static SubrangeSurface
newInstance(Surface child, Surface par)
Returns aSubrangeSurface
instance referring to the specifiedSurface
and the supplied 2D surface in parametric space which maps the SubrangeSurface to the child Surface.static void
recycle(SubrangeSurface instance)
Recycles a SubrangeSurface instance immediately (on the stack when executing in a StackContext).SubrangeSurface
reverseS()
Return a new surface that is identical to this one, but with the S-parameterization reversed.SubrangeSurface
reverseT()
Return a new surface that is identical to this one, but with the T-parameterization reversed.void
setParPosition(Surface par)
Sets the range of parametric positions on the child object that this surface refers to.int
size()
Returns the number of child-elements that make up this geometry element.GeomList<SubrangeSurface>
splitAtS(double s)
Split thisSubrangeSurface
at the specified parametric S-position returning a list containing two new surfaces (a lower surface with smaller S-parametric positions than "s" and an upper surface with larger S-parametric positions).GeomList<SubrangeSurface>
splitAtT(double t)
Split thisSubrangeSurface
at the specified parametric T-position returning a list containing two new surfaces (a lower surface with smaller T-parametric positions than "t" and an upper surface with larger T-parametric positions).SubrangeSurface
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this surface but stated in the specified unit.SubrangeSurface
toDimension(int newDim)
Return the equivalent of this surface converted to the specified number of physical dimensions.NurbsSurface
toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS surface representation of this surface to within the specified tolerance.javolution.text.Text
toText()
Returns the text representation of this geometry element.SubrangeSurface
transpose()
Return a new surface that is identical to this one but with the transpose of the parameterization of this surface.-
Methods inherited from class geomss.geom.AbstractSurface
extractGrid, getArea, getArea, getArea, getClosest, getClosest, getClosest, getClosest, getClosest, getClosest, getCurve, getDerivatives, getFarthest, getFarthest, getFarthest, getGaussianCurvature, getGaussianCurvature, getLimitPoint, getMeanCurvature, getMeanCurvature, getNormal, getNormal, getParDimension, getPoint, getPoint, getRealPoint, getSCurve, getSDerivative, getSDerivative, getSDerivatives, getSDerivatives, getTangentPlane, getTangentPlane, getTCurve, getTDerivative, getTDerivative, getTDerivatives, getTDerivatives, getTwistVector, getVolume, getVolume, getVolume, gridToTolerance, intersect, intersect, intersect, intersect, intersect, isPlanar, isPlanar, splitAtS, splitAtT
-
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 SubrangeSurface newInstance(Surface child, Surface par)
Returns aSubrangeSurface
instance referring to the specifiedSurface
and the supplied 2D surface in parametric space which maps the SubrangeSurface to the child Surface. The mapping surface in parametric space must be in units of meters and be in the range 0,0 to 1,1.- Parameters:
child
- TheSurface
that this surface is subranged onto (may not benull
).par
- A 2D surface in parametric space (between 0,0 and 1,1 in meters) that maps the parametric positions from the subrange surface to the child surface. Ifnull
is passed, the full parametric boundary of the child surface is used.- Returns:
- the subrange surface having the specified mapping to the child surface.
- Throws:
DimensionException
- if the input parametric space surface does not have a parametric dimension equal to 2.
-
newInstance
public static SubrangeSurface newInstance(Surface child, Curve s0, Curve t0, Curve s1, Curve t1, double tol)
Returns aSubrangeSurface
instance referring to the specifiedSurface
and the supplied boundary location curves in parametric space. The boundary curves in parametric space must be in units of meters and be in the range 0,0 to 1,1. The start points of the s0,t0 curves must be coincident. The start of the s1 curve and end of the t0 curve must be coincident. The end of the s1 curve and end of the t1 curve must be coincident. And, the end of the s0 curve and start of the t1 curve must be coincident. The corner points of the parametric curves are checked for proper coincidence.- Parameters:
child
- TheSurface
that this surface is subranged onto (may not benull
).s0
- A 2D curve of the parametric position (between 0,0 and 1,1 in meters) along each parametric dimension or a subrange curve on the child surface that serves as the s=0 boundary for the subrange surface.t0
- A 2D curve of the parametric position (between 0,0 and 1,1 in meters) along each parametric dimension or a subrange curve on the child surface that serves as the t=0 boundary for the subrange surface.s1
- A 2D curve of the parametric position (between 0,0 and 1,1 in meters) along each parametric dimension that serves as the s=1 boundary for the subrange surface.t1
- A 2D curve of the parametric position (between 0,0 and 1,1 in meters) along each parametric dimension or a subrange curve on the child surface that serves as the t=1 boundary for the subrange surface.tol
- A tolerance (in parameter space) for how closely the corner points must match.- Returns:
- the subrange surface having the specified boundary curves.
- Throws:
DimensionException
- if the input boundary curves are not subranges on child and their parametric dimensions are not equal to 2.
-
newInstance
public static SubrangeSurface newInstance(Surface child, double s0, double t0, double s1, double t1)
Returns a SubrangeSurface on the surfacechild
that covers the range of parametric positions froms0,t0
tos1,t1
.- Parameters:
child
- TheSurface
object that this surface is subranged onto (may not benull
).s0
- The parametric position on the child surface that should form the s=0 edge of the subrange surface.t0
- The parametric position on the child surface that should form the t=0 edge of the subrange surface.s1
- The parametric position on the child surface that should form the s=1 edge of the subrange surface.t1
- The parametric position on the child surface that should form the t=1 edge of the subrange surface.- Returns:
- the subrange surface having the specified range of parametric values on the child surface.
-
getChild
public ParametricGeometry getChild()
Returns the child object this point is subranged onto.
-
getParPosition
public Surface getParPosition()
Returns a 2D surface in parametric space which maps this surface's parametric positions to the child surface.- Specified by:
getParPosition
in interfaceSubrange<Surface>
- Returns:
- A 2D surface in parametric space that maps this surface's parameters to the child surface.
-
setParPosition
public void setParPosition(Surface par)
Sets the range of parametric positions on the child object that this surface refers to. The parametric surface must be 2D, in units of meters and be in the range 0,0 to 1,1.- Specified by:
setParPosition
in interfaceSubrange<Surface>
- Parameters:
par
- The mapping of parametric positions (0,0 to 1,1) from this surface to the child surface. May not be null.
-
size
public int size()
Returns the number of child-elements that make up this geometry element. This implementation returns the size of the child object.- Specified by:
size
in interfaceGeomElement<SubrangeSurface>
- Returns:
- The number of child-elements that make up this geometry element.
-
getT0Curve
public Curve getT0Curve()
Return the T=0 Boundary for this surface as a curve.- Specified by:
getT0Curve
in interfaceSurface<SubrangeSurface>
- Returns:
- The T=0 Boundary for this surface as a curve.
-
getT1Curve
public Curve getT1Curve()
Return the T=1 Boundary for this surface as a curve.- Specified by:
getT1Curve
in interfaceSurface<SubrangeSurface>
- Returns:
- The T=1 Boundary for this surface as a curve.
-
getS0Curve
public Curve getS0Curve()
Return the S=0 Boundary for this surface as a curve.- Specified by:
getS0Curve
in interfaceSurface<SubrangeSurface>
- Returns:
- The S=0 Boundary for this surface as a curve.
-
getS1Curve
public Curve getS1Curve()
Return the S=1 Boundary for this surface as a curve.- Specified by:
getS1Curve
in interfaceSurface<SubrangeSurface>
- Returns:
- The S=1 Boundary for this surface as a curve.
-
getRealPoint
public Point getRealPoint(double s, double t)
Calculate a point on the surface for the given parametric position on the surface.- Specified by:
getRealPoint
in interfaceSurface<SubrangeSurface>
- Parameters:
s
- 1st parametric dimension distance to calculate a point for (0.0 to 1.0 inclusive).t
- 2nd parametric dimension distance to calculate a point for (0.0 to 1.0 inclusive).- Returns:
- The calculated point on the surface at the specified parameter values.
- Throws:
java.lang.IllegalArgumentException
- if there is any problem with the parameter values.
-
getSDerivatives
public java.util.List<Vector<javax.measure.quantity.Length>> getSDerivatives(double s, double t, int grade, boolean scaled)
Calculate all the derivatives from0
tograde
with respect to parametric s-position on the surface for the given parametric position on the surface,d^{grade}p(s,t)/d^{grade}s
.Example:
1st derivative (grade = 1), this returns[p(s,t), dp(s,t)/ds]
;
2nd derivative (grade = 2), this returns[p(s,t), dp(s,t)/ds, d^2p(s,t)/d^2s]
; etc.- Specified by:
getSDerivatives
in classAbstractSurface<SubrangeSurface>
- Parameters:
s
- 1st parametric dimension distance to calculate derivative for (0.0 to 1.0 inclusive).t
- 2nd parametric dimension distance to calculate derivative for (0.0 to 1.0 inclusive).grade
- The maximum grade to calculate the uA-derivatives for (1=1st derivative, 2=2nd derivative, etc)scaled
- Passtrue
for properly scaled derivatives orfalse
if the magnitude of the derivative vector is not required -- this sometimes results in faster calculation times.- Returns:
- A list of s-derivatives up to the specified grade of the surface at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0 or the parameter values are invalid.
-
getTDerivatives
public java.util.List<Vector<javax.measure.quantity.Length>> getTDerivatives(double s, double t, int grade, boolean scaled)
Calculate all the derivatives from0
tograde
with respect to parametric t-position on the surface for the given parametric position on the surface,d^{grade}p(s,t)/d^{grade}t
.Example:
1st derivative (grade = 1), this returns[p(s,t), dp(s,t)/dt]
;
2nd derivative (grade = 2), this returns[p(s,t), dp(s,t)/dt, d^2p(s,t)/d^2t]
; etc.- Specified by:
getTDerivatives
in classAbstractSurface<SubrangeSurface>
- Parameters:
s
- 1st parametric dimension distance to calculate derivative for (0.0 to 1.0 inclusive).t
- 2nd parametric dimension distance to calculate derivative for (0.0 to 1.0 inclusive).grade
- The maximum grade to calculate the v-derivatives for (1=1st derivative, 2=2nd derivative, etc)scaled
- Passtrue
for properly scaled derivatives orfalse
if the magnitude of the derivative vector is not required -- this sometimes results in faster calculation times.- Returns:
- A list of t-derivatives up to the specified grade of the surface at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0 or the parameter values are invalid.
-
getTwistVector
public Vector<javax.measure.quantity.Length> getTwistVector(double s, double t)
Calculate the twist vector (d^2P/(ds*dt) = d(dP/ds)/dt) for this surface at the specified position on this surface.- Specified by:
getTwistVector
in interfaceSurface<SubrangeSurface>
- Parameters:
s
- 1st parametric dimension distance to calculate twist vector for (0.0 to 1.0 inclusive).t
- 2nd parametric dimension distance to calculate twist vector for (0.0 to 1.0 inclusive).- Returns:
- The twist vector of this surface at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the parameter values are invalid.
-
reverseS
public SubrangeSurface reverseS()
Return a new surface that is identical to this one, but with the S-parameterization reversed.- Specified by:
reverseS
in interfaceSurface<SubrangeSurface>
- Returns:
- A new surface that is identical to this one, but with the S-parameterization reversed.
- See Also:
reverseT()
-
reverseT
public SubrangeSurface reverseT()
Return a new surface that is identical to this one, but with the T-parameterization reversed.- Specified by:
reverseT
in interfaceSurface<SubrangeSurface>
- Returns:
- A new surface that is identical to this one, but with the T-parameterization reversed.
- See Also:
reverseS()
-
transpose
public SubrangeSurface transpose()
Return a new surface that is identical to this one but with the transpose of the parameterization of this surface. The S and T directions will be swapped.- Specified by:
transpose
in interfaceSurface<SubrangeSurface>
- Overrides:
transpose
in classAbstractSurface<SubrangeSurface>
- Returns:
- A new surface that is identical to this one but with the transpose of the parameterization of this surface.
- See Also:
reverseT()
,reverseS()
-
splitAtS
public GeomList<SubrangeSurface> splitAtS(double s)
Split thisSubrangeSurface
at the specified parametric S-position returning a list containing two new surfaces (a lower surface with smaller S-parametric positions than "s" and an upper surface with larger S-parametric positions).- Specified by:
splitAtS
in interfaceSurface<SubrangeSurface>
- Parameters:
s
- The S-parametric position where this surface should be split (must not be 0 or 1!).- Returns:
- A list containing two surfaces: 0 == the lower surface, 1 == the upper surface.
-
splitAtT
public GeomList<SubrangeSurface> splitAtT(double t)
Split thisSubrangeSurface
at the specified parametric T-position returning a list containing two new surfaces (a lower surface with smaller T-parametric positions than "t" and an upper surface with larger T-parametric positions).- Specified by:
splitAtT
in interfaceSurface<SubrangeSurface>
- Parameters:
t
- The T-parametric position where this surface should be split (must not be 0 or 1!).- Returns:
- A list containing two surfaces: 0 == the lower surface, 1 == the upper surface.
-
getTransformed
public SubrangeSurface 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<SubrangeSurface>
- 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.
-
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<SubrangeSurface>
- 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<SubrangeSurface>
- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element. This implementation always returns the physical dimension of the underlyingSurface
objects.- Specified by:
getPhyDimension
in interfaceGeomElement<SubrangeSurface>
- Returns:
- The number of physical dimensions of the geometry element.
-
toDimension
public SubrangeSurface toDimension(int newDim)
Return the equivalent of this surface 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:
toDimension
in interfaceGeomElement<SubrangeSurface>
- Specified by:
toDimension
in interfaceParametricGeometry<SubrangeSurface>
- Specified by:
toDimension
in interfaceSurface<SubrangeSurface>
- Parameters:
newDim
- The dimension of the surface to return.- Returns:
- The equivalent of this surface converted to the new dimensions.
-
toNurbs
public NurbsSurface toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS surface representation of this surface to within the specified tolerance.- Specified by:
toNurbs
in interfaceSurface<SubrangeSurface>
- Parameters:
tol
- The greatest possible difference between this surface and the NURBS representation returned. May not be null.- Returns:
- A NURBS surface that represents this surface to within the specified tolerance.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which this surface is stated.- Specified by:
getUnit
in interfaceGeomElement<SubrangeSurface>
- Returns:
- The unit in which this surface is stated.
-
to
public SubrangeSurface to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this surface but stated in the specified unit.- Specified by:
to
in interfaceGeomElement<SubrangeSurface>
- Specified by:
to
in interfaceParametricGeometry<SubrangeSurface>
- Specified by:
to
in interfaceSurface<SubrangeSurface>
- Parameters:
unit
- the length unit of the surface to be returned.- Returns:
- an equivalent to this surface but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the the input unit is not a length unit.
-
isValid
public boolean isValid()
Returntrue
if this SubrangeSurface contains valid and finite numerical components. A value offalse
will be returned if any of the member curves are not valid.- Specified by:
isValid
in interfaceGeomElement<SubrangeSurface>
- Returns:
- true if this SubrangeSurface contains valid and finite numerical components.
-
isDegenerate
public boolean isDegenerate(Parameter<javax.measure.quantity.Length> tol)
Returntrue
if this surface is degenerate (i.e.: has area less than the specified tolerance squared).- Specified by:
isDegenerate
in interfaceParametricGeometry<SubrangeSurface>
- Specified by:
isDegenerate
in interfaceSurface<SubrangeSurface>
- Overrides:
isDegenerate
in classAbstractSurface<SubrangeSurface>
- Parameters:
tol
- The tolerance for determining if this surface is degenerate. May not be null.- Returns:
- true if this surface is degenerate.
-
equals
public boolean equals(java.lang.Object obj)
Compares the specified object with thisSubrangeSurface
for equality. Returns true if and only if both surfaces are of the same type, have the same child surface, and both contain the same boundary curves in the same order.- Overrides:
equals
in classAbstractGeomElement<SubrangeSurface>
- Parameters:
obj
- the object to compare with.- Returns:
true
if this surface is identical to that surface;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for thisSubrangeSurface
.- Overrides:
hashCode
in classAbstractGeomElement<SubrangeSurface>
- Returns:
- the hash code value.
-
copyToReal
public SubrangeSurface copyToReal()
Return a copy of this object with any transformations or subranges removed (applied). This method is not yet implemented and current returns a new SubrangeSurface with the child surface and subrange curves copied to real.- Specified by:
copyToReal
in interfaceGeomElement<SubrangeSurface>
- Returns:
- A copy of this object with any transformations or subranges removed.
-
copy
public SubrangeSurface copy()
Returns a copy of thisSubrangeSurface
instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceGeomElement<SubrangeSurface>
- Specified by:
copy
in interfaceParametricGeometry<SubrangeSurface>
- Specified by:
copy
in interfaceSurface<SubrangeSurface>
- Returns:
- an identical and independent copy of this object.
-
toText
public javolution.text.Text toText()
Returns the text representation of this geometry element.- Specified by:
toText
in interfaceGeomElement<SubrangeSurface>
- Overrides:
toText
in classAbstractGeomElement<SubrangeSurface>
- Returns:
- The text representation of this geometry element.
-
recycle
public static void recycle(SubrangeSurface instance)
Recycles a SubrangeSurface instance immediately (on the stack when executing in a StackContext).- Parameters:
instance
- The instance to be recycled.
-
-