Package geomss.geom.nurbs
Class BasicNurbsSurface
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractSurface<NurbsSurface>
-
- geomss.geom.nurbs.NurbsSurface
-
- geomss.geom.nurbs.BasicNurbsSurface
-
- All Implemented Interfaces:
GeomElement<NurbsSurface>,ParametricGeometry<NurbsSurface>,Surface<NurbsSurface>,Transformable<NurbsSurface>,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,javolution.lang.Immutable,javolution.lang.Reusable,javolution.lang.ValueType,javolution.xml.XMLSerializable
public final class BasicNurbsSurface extends NurbsSurface implements javolution.lang.ValueType
A basic implementation of a parametric NURBS surface.Modified by: Joseph A. Huwaldt
- Version:
- November 28, 2015
- Author:
- Samuel Gerber, Date: June 14, 2010, Version 1.2.
- 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 BasicNurbsSurfacecopy()Returns a copy of thisBasicNurbsSurfaceinstanceallocatedby the calling thread (possibly on the stack).BasicNurbsSurfacecopyToReal()Return a copy of this object with any transformations or subranges removed (applied).booleanequals(java.lang.Object obj)Compares this BasicNurbsSurface against the specified object for strict equality (same values and same units).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).ControlPointNetgetControlPoints()Return a matrix or network of control points for this surface.intgetNumberOfColumns()Return the control point matrix size in the t-direction (across the columns of control points).intgetNumberOfRows()Return the control point matrix size in the s-direction (down a column of control points).intgetPhyDimension()Returns the number of physical dimensions of the geometry element.PointgetRealPoint(double s, double t)Calculate a point on the surface for the given parametric position on the surface.intgetSDegree()Return the degree of the NURBS surface in the s-direction.java.util.List<Vector<javax.measure.quantity.Length>>getSDerivatives(double s, double t, int grade, boolean scaled)Calculate all the derivatives from0togradewith respect to parametric s-position on the surface for the given parametric position on the surface,d^{grade}p(s,t)/d^{grade}s.KnotVectorgetSKnotVector()Return the s-direction knot vector of this surface.intgetTDegree()Return the degree of the NURBS surface in the t-direction.java.util.List<Vector<javax.measure.quantity.Length>>getTDerivatives(double s, double t, int grade, boolean scaled)Calculate all the derivatives from0togradewith respect to parametric t-position on the surface for the given parametric position on the surface,d^{grade}p(s,t)/d^{grade}t.KnotVectorgetTKnotVector()Return the t-direction knot vector of this surface.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 the control points in this surface are stated.inthashCode()Returns the hash code for this parameter.static BasicNurbsSurfacenewInstance(ControlPoint[][] cps, int p, int q, double[] sK, double[] tK)Create a NURBS surface from the given control points, knots and degree.static BasicNurbsSurfacenewInstance(ControlPointNet cpNet, KnotVector sKnots, KnotVector tKnots)Generate a NURBS surface from the given control points and the given knot vectors.static voidrecycle(BasicNurbsSurface instance)Recycles aBasicNurbsSurfaceinstance immediately (on the stack when executing in a StackContext).intsize()Returns the number of child-elements that make up this geometry element.BasicNurbsSurfaceto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this surface but stated in the specified unit.BasicNurbsSurfacetoDimension(int newDim)Return the equivalent of this surface converted to the specified number of physical dimensions.-
Methods inherited from class geomss.geom.nurbs.NurbsSurface
getS0Curve, getS1Curve, getSCurve, getT0Curve, getT1Curve, getTCurve, getTransformed, insertSKnot, insertTKnot, isDegenerate, isPlanar, isValid, mergeSKnotVector, mergeTKnotVector, refineSKnotVector, refineSKnotVector, refineTKnotVector, refineTKnotVector, removeSKnot, removeTKnot, reverseS, reverseT, splitAtS, splitAtT, toNurbs, toNurbs, toText, transpose
-
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, 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 BasicNurbsSurface newInstance(ControlPoint[][] cps, int p, int q, double[] sK, double[] tK)
Create a NURBS surface from the given control points, knots and degree.- Parameters:
cps- Matrix of control points: cps[u][v]. May not be null.p- s-degree of the NURBS curveq- t-degree of the NURBS curvesK- Knot values in s-direction. May not be null.tK- Knot values in t-direction. May not be null.- Returns:
- A new BasicNurbsSurface from the given control points, knots and degree.
- Throws:
java.lang.IllegalArgumentException- if the knot vectors are not valid.
-
newInstance
public static BasicNurbsSurface newInstance(ControlPointNet cpNet, KnotVector sKnots, KnotVector tKnots)
Generate a NURBS surface from the given control points and the given knot vectors.- Parameters:
cpNet- Matrix of control points. May not be null.sKnots- Knot vector in the s-direction for the surface. May not be null.tKnots- Knot vector in the t-direction for the surface. May not be null.- Returns:
- A new BasicNurbsSurface from the given control points and the given knot vectors.
- Throws:
java.lang.IllegalArgumentException- if the knot vector is not consistent with the number of control points.
-
size
public int size()
Returns the number of child-elements that make up this geometry element. This implementation returns the number of control points in this NURBS surface.- Specified by:
sizein interfaceGeomElement<NurbsSurface>- Returns:
- The number of child-elements that make up this geometry element.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimensionin interfaceGeomElement<NurbsSurface>- Returns:
- The number of physical dimensions of the geometry element.
-
getControlPoints
public ControlPointNet getControlPoints()
Return a matrix or network of control points for this surface.- Specified by:
getControlPointsin classNurbsSurface- Returns:
- the ordered control points
-
getNumberOfRows
public int getNumberOfRows()
Return the control point matrix size in the s-direction (down a column of control points).- Specified by:
getNumberOfRowsin classNurbsSurface- Returns:
- The control point matrix size in the s-direction.
-
getNumberOfColumns
public int getNumberOfColumns()
Return the control point matrix size in the t-direction (across the columns of control points).- Specified by:
getNumberOfColumnsin classNurbsSurface- Returns:
- The control point matrix size in the t-direction.
-
getSKnotVector
public KnotVector getSKnotVector()
Return the s-direction knot vector of this surface.- Specified by:
getSKnotVectorin classNurbsSurface- Returns:
- The s-knot vector.
-
getTKnotVector
public KnotVector getTKnotVector()
Return the t-direction knot vector of this surface.- Specified by:
getTKnotVectorin classNurbsSurface- Returns:
- The t-knot vector.
-
getSDegree
public int getSDegree()
Return the degree of the NURBS surface in the s-direction.- Specified by:
getSDegreein classNurbsSurface- Returns:
- degree of surface in s-direction
-
getTDegree
public int getTDegree()
Return the degree of the NURBS surface in the t-direction.- Specified by:
getTDegreein classNurbsSurface- Returns:
- degree of surface in t-direction
-
getRealPoint
public Point getRealPoint(double s, double t)
Calculate a point on the surface for the given parametric position on the surface.- Specified by:
getRealPointin interfaceSurface<NurbsSurface>- 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 from0togradewith 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:
getSDerivativesin classAbstractSurface<NurbsSurface>- 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- Passtruefor properly scaled derivatives orfalseif 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 from0togradewith 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:
getTDerivativesin classAbstractSurface<NurbsSurface>- 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- Passtruefor properly scaled derivatives orfalseif 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:
getTwistVectorin interfaceSurface<NurbsSurface>- 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.
-
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<NurbsSurface>- 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).- Specified by:
getBoundsMaxin interfaceGeomElement<NurbsSurface>- 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 the control points in this surface are stated.- Specified by:
getUnitin interfaceGeomElement<NurbsSurface>- Returns:
- The unit in which the control points in this surface are stated.
-
to
public BasicNurbsSurface 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:
toin interfaceGeomElement<NurbsSurface>- Specified by:
toin interfaceParametricGeometry<NurbsSurface>- Specified by:
toin interfaceSurface<NurbsSurface>- 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.
-
toDimension
public BasicNurbsSurface 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:
toDimensionin interfaceGeomElement<NurbsSurface>- Specified by:
toDimensionin interfaceParametricGeometry<NurbsSurface>- Specified by:
toDimensionin interfaceSurface<NurbsSurface>- Parameters:
newDim- The dimension of the surface to return.- Returns:
- The equivalent of this surface converted to the new dimensions.
-
copy
public BasicNurbsSurface copy()
Returns a copy of thisBasicNurbsSurfaceinstanceallocatedby the calling thread (possibly on the stack).- Specified by:
copyin interfaceGeomElement<NurbsSurface>- Specified by:
copyin interfaceParametricGeometry<NurbsSurface>- Specified by:
copyin interfaceSurface<NurbsSurface>- Specified by:
copyin interfacejavolution.lang.ValueType- Returns:
- an identical and independent copy of this object.
-
copyToReal
public BasicNurbsSurface copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToRealin interfaceGeomElement<NurbsSurface>- Returns:
- A copy of this object with any transformations or subranges removed.
-
equals
public boolean equals(java.lang.Object obj)
Compares this BasicNurbsSurface against the specified object for strict equality (same values and same units).- Overrides:
equalsin classAbstractGeomElement<NurbsSurface>- Parameters:
obj- the object to compare with.- Returns:
trueif this object is identical to that object;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCodein classAbstractGeomElement<NurbsSurface>- Returns:
- the hash code value.
-
recycle
public static void recycle(BasicNurbsSurface instance)
Recycles aBasicNurbsSurfaceinstance immediately (on the stack when executing in a StackContext).- Parameters:
instance- The instance to be recycled.
-
-