Package geomss.geom
Class TFISurface
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractSurface<TFISurface>
-
- geomss.geom.TFISurface
-
- All Implemented Interfaces:
GeomElement<TFISurface>
,ParametricGeometry<TFISurface>
,Surface<TFISurface>
,Transformable<TFISurface>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Reusable
,javolution.xml.XMLSerializable
public class TFISurface extends AbstractSurface<TFISurface>
Represents a bi-linearly blended transfinite interpolation (TFI) or Coons patch surface defined from four boundary curves. The boundary curves must meet at each of the 4 corners of the patch. It is assumed that all the input curves are oriented in an appropriate direction and order to create the desired TFI surface.Modified by: Joseph A. Huwaldt
- Version:
- October 29, 2017
- Author:
- Joseph A. Huwaldt, Date: April 17, 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 TFISurface
copy()
Returns a copy of thisTFISurface
instanceallocated
by the calling thread (possibly on the stack).TFISurface
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 thisTIFSurface
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).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
.TFISurface
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 thisTFISurface
.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 TFISurface contains valid and finite numerical components.static TFISurface
newInstance(Curve s0, Curve t0, Curve s1, Curve t1)
Return a TFISurface made up of the specified boundaryCurve
objects.static TFISurface
newInstance(java.lang.String name, Curve s0, Curve t0, Curve s1, Curve t1)
Return a TFISurface made up of the specified boundaryCurve
objects.static void
recycle(TFISurface instance)
Recycles a case instance immediately (on the stack when executing in a StackContext).TFISurface
reverseS()
Return a new surface that is identical to this one, but with the S-parameterization reversed.TFISurface
reverseT()
Return a new surface that is identical to this one, but with the T-parameterization reversed.int
size()
Returns the number of child-elements that make up this geometry element.GeomList<TFISurface>
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<TFISurface>
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).TFISurface
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this surface but stated in the specified unit.TFISurface
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.TFISurface
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 TFISurface newInstance(Curve s0, Curve t0, Curve s1, Curve t1)
Return a TFISurface made up of the specified boundaryCurve
objects. It is assumed that the boundary curves are ordered properly and that the end points are coincident. No check for this is made.- Parameters:
s0
- The curve that serves as the s=0 boundary of this surface. May not be null.t0
- The curve that serves as the t=0 boundary of this surface. May not be null.s1
- The curve that serves as the s=1 boundary of this surface. May not be null.t1
- The curve that serves as the t=1 boundary of this surface. May not be null.- Returns:
- The TFISurface with the specified boundary curves.
-
newInstance
public static TFISurface newInstance(java.lang.String name, Curve s0, Curve t0, Curve s1, Curve t1)
Return a TFISurface made up of the specified boundaryCurve
objects. It is assumed that the boundary curves are ordered properly and that the end points are coincident. No check for this is made.- Parameters:
name
- The name to be assigned to this surface (may benull
).s0
- The curve that serves as the s=0 boundary of this surface. May not be null.t0
- The curve that serves as the t=0 boundary of this surface. May not be null.s1
- The curve that serves as the s=1 boundary of this surface. May not be null.t1
- The curve that serves as the t=1 boundary of this surface. May not be null.- Returns:
- The TFISurface with the specified boundary curves.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element. This implementation always returns the physical dimension of the underlyingCurve
objects.- Returns:
- The number of physical dimensions of the geometry element.
-
toDimension
public TFISurface 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.- Parameters:
newDim
- The dimension of the surface to return.- Returns:
- This surface converted to the new dimensions.
-
size
public int size()
Returns the number of child-elements that make up this geometry element. This implementation always returns 4 for the four boundary curves.- Returns:
- The number of child-elements that make up this geometry element.
-
getRealPoint
public Point getRealPoint(double s, double t)
Calculate a point on the surface for the given parametric position on the surface.- 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<TFISurface>
- 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 u-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<TFISurface>
- 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.- 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 TFISurface reverseS()
Return a new surface that is identical to this one, but with the S-parameterization reversed.- Returns:
- A new surface that is identical to this one, but with the S-parameterization reversed.
- See Also:
reverseT()
-
reverseT
public TFISurface reverseT()
Return a new surface that is identical to this one, but with the T-parameterization reversed.- Returns:
- A new surface that is identical to this one, but with the T-parameterization reversed.
- See Also:
reverseS()
-
transpose
public TFISurface 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<TFISurface>
- Overrides:
transpose
in classAbstractSurface<TFISurface>
- 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<TFISurface> 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).- 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<TFISurface> 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).- 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.
-
getT0Curve
public Curve getT0Curve()
Return the T=0 Boundary for this surface as a curve.- 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.- 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.- 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.- Returns:
- The S=1 Boundary for this surface as a curve.
-
getTransformed
public TFISurface getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implementsGeomTransform
and contains this element as a child.- 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).- Returns:
- The minimum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no geometry.
-
getBoundsMax
public Point getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which this surface is stated.- Returns:
- The unit in which this surface is stated.
-
to
public TFISurface 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.- Parameters:
unit
- the length unit of the surface to be returned. May not be null.- 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.
-
toNurbs
public NurbsSurface toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS surface representation of this surface to within the specified tolerance. If the curves making up this surface are NURBS curves, then the resulting NURBS surface is an exact representation of this surface (and tol is ignored). However, if any of the member curves are not NURBS curves, then tol is used to make a NURBS approximation of that curve (and this surface).- 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.
-
isValid
public boolean isValid()
Returntrue
if this TFISurface contains valid and finite numerical components. A value offalse
will be returned if any of the member curves are not valid.- Returns:
- true if this TFISurface 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<TFISurface>
- Specified by:
isDegenerate
in interfaceSurface<TFISurface>
- Overrides:
isDegenerate
in classAbstractSurface<TFISurface>
- 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 thisTIFSurface
for equality. Returns true if and only if both surfaces are of the same type and both contain the same boundary curves in the same order.- Overrides:
equals
in classAbstractGeomElement<TFISurface>
- 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 thisTFISurface
.- Overrides:
hashCode
in classAbstractGeomElement<TFISurface>
- Returns:
- the hash code value.
-
copyToReal
public TFISurface copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Returns:
- A copy of this object with any transformations or subranges removed.
-
copy
public TFISurface copy()
Returns a copy of thisTFISurface
instanceallocated
by the calling thread (possibly on the stack).- 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<TFISurface>
- Overrides:
toText
in classAbstractGeomElement<TFISurface>
- Returns:
- The text representation of this geometry element.
-
recycle
public static void recycle(TFISurface instance)
Recycles a case instance immediately (on the stack when executing in a StackContext).- Parameters:
instance
- The instance to be recycled.
-
-