Class SurfaceHelper
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
Static helper methods for working with ISurface objects, mainly for handling the periodicity of the u/v parameter
space: the AdjustPeriodic methods move points and curves by multiples of the period into a given domain.
public class SurfaceHelper
- Inheritance
-
SurfaceHelper
- Inherited Members
Constructors
SurfaceHelper()
public SurfaceHelper()
Methods
AdjustPeriodic(ISurface, BoundingRect, ICurve2D)
Moves the 2d curve by multiples of the period of the surface (in u and/or v) so that its middle point lies as close as possible
to the center of bounds, typically the domain of a face. Nothing happens when the surface is not periodic.
public static void AdjustPeriodic(ISurface surface, BoundingRect bounds, ICurve2D cv2d)
Parameters
surfaceISurfaceThe surface which defines the periods
boundsBoundingRectThe domain the curve should lie in
cv2dICurve2DThe curve to move (in place)
AdjustPeriodic(ISurface, BoundingRect, ref GeoPoint2D)
Moves the point by multiples of the period of the surface (in u and/or v) so that it lies as close as possible to the center
of bounds, typically the domain of a face. Nothing happens when the surface is not periodic.
public static void AdjustPeriodic(ISurface surface, BoundingRect bounds, ref GeoPoint2D p2d)
Parameters
surfaceISurfaceThe surface which defines the periods
boundsBoundingRectThe domain the point should lie in
p2dGeoPoint2DThe point to move (in place)
AdjustPeriodic(double, double, ref GeoPoint2D)
Moves the point by multiples of the periods into the interval [0, period] in u and/or v. A period of 0 (or less) means that the respective direction is not periodic and the coordinate stays unchanged.
public static void AdjustPeriodic(double uperiod, double vperiod, ref GeoPoint2D p)
Parameters
uperioddoubleThe period in u, or 0 when not periodic in u
vperioddoubleThe period in v, or 0 when not periodic in v
pGeoPoint2DThe point to adjust (in place)
BoundingCurves(ISurface, BoundingRect)
Enumerates the four 3d curves which bound the rectangle ext of the parameter space on the surface: the curves
of constant u at the left and right border and the curves of constant v at the bottom and top border.
public IEnumerator<ICurve> BoundingCurves(ISurface srf, BoundingRect ext)
Parameters
srfISurfaceThe surface
extBoundingRectThe rectangle in the parameter space
Returns
- IEnumerator<ICurve>
An enumerator yielding the left, right, bottom and top boundary curve
GetExtrema(ISurface, BoundingRect, GeoVector)
Returns the positions in the parameter space where the surface has an extremum in direction dir, i.e. where
the normal is parallel to dir. A copy of the surface is rotated so that dir becomes the
z-axis and GetExtrema() of the copy is filtered for the z direction.
public static GeoPoint2D[] GetExtrema(ISurface surface, BoundingRect domain, GeoVector dir)
Parameters
surfaceISurfaceThe surface (not modified)
domainBoundingRectThe part of the parameter space of interest; currently not used to restrict the result
dirGeoVectorThe direction of the extrema
Returns
- GeoPoint2D[]
The u/v positions of the extrema, may be empty
MinMaxCurvature(ISurface, GeoPoint2D, out ICurve, out ICurve)
Computes the principal curvatures of the surface at uv (the eigenvalues of the Weingarten map) and returns
them as curves: a circle with the radius of curvature, lying in the plane of the normal and the principal direction, or a line
in the principal direction when the curvature is 0. minCurvature belongs to the principal direction with
the smaller curvature (by absolute value), maxCurvature to the one with the larger; for a cylinder these
are the line along the axis and the circle of the cross section, for a sphere two circles of the same radius.
public static void MinMaxCurvature(ISurface surface, GeoPoint2D uv, out ICurve minCurvature, out ICurve maxCurvature)
Parameters
surfaceISurfaceThe surface
uvGeoPoint2DThe position in the parameter space
minCurvatureICurveThe curvature circle (or line) of the principal direction with the smaller curvature; null when no real eigenvalue was found
maxCurvatureICurveThe curvature circle (or line) of the principal direction with the larger curvature; null when fewer than two real eigenvalues were found