Class ISurfaceImpl
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
Internal helper class for ISurface implementation.
public abstract class ISurfaceImpl : ISurface, IOctTreeInsertable
- Inheritance
-
ISurfaceImpl
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ISurfaceImpl(BoundingRect?)
Initializes the common state of a surface.
protected ISurfaceImpl(BoundingRect? usedArea = null)
Parameters
usedAreaBoundingRect?The part of the parameter space in which the surface is used (the domain of the Face it belongs to), or null when not known yet. For surfaces without natural bounds of their own this is what GetNaturalBounds(out double, out double, out double, out double) returns; it can be set later with SetBounds(BoundingRect)
Fields
extrema
Cache for GetExtrema(): the u/v positions of the extrema in direction of the axes, computed on first use. Internal state: it must be reset to null (see InvalidateSecondaryData()) whenever the geometry of the surface changes.
protected GeoPoint2D[] extrema
Field Value
Properties
CanStretch
True when Fit(IEnumerable<GeoPoint>) may also scale the surface with different factors for the three axes, which is the case for a SurfaceOfLinearExtrusion. For all other surfaces the fit uses rotation, translation and a uniform scaling only.
public virtual bool CanStretch { get; }
Property Value
IsRuled
returns wheather the surface is linear in u or v direction
public virtual RuledSurfaceMode IsRuled { get; }
Property Value
IsUClosed
True when the surface is closed in u direction, i.e. the parameter lines of constant v are closed curves. By default this is the same as IsUPeriodic; no surface overrides it.
public virtual bool IsUClosed { get; }
Property Value
IsUPeriodic
Returns true, if this surface is periodic in the u direction (e.g. a cylinder) false otherwise.
public virtual bool IsUPeriodic { get; }
Property Value
IsVClosed
True when the surface is closed in v direction, i.e. the parameter lines of constant u are closed curves. By default this is the same as IsVPeriodic; no surface overrides it.
public virtual bool IsVClosed { get; }
Property Value
IsVPeriodic
Returns true, if this surface is periodic in the v direction (e.g. a torus) false otherwise.
public virtual bool IsVPeriodic { get; }
Property Value
Oriented
Returns true, if this surface divides the space into two parts. If the surfaces is Oriented Orientation(GeoPoint) returns a valid result
public virtual bool Oriented { get; }
Property Value
UPeriod
Returns the u priod of this surface if it is u periodic 0.0 otherwise
public virtual double UPeriod { get; }
Property Value
UvChangesWithModification
True when Modify(ModOp) (e.g. a rotation) changes the u/v parameter system in a way that 2d curves on the surface are no longer valid afterwards. This is the case for the non-periodic surfaces (CylindricalSurfaceNP, ConicalSurfaceNP, SphericalSurfaceNP), whose parameter system is bound to the global axes; Edge recomputes the 2d curves of its faces after a modification when this is true. False for the elementary surfaces, which carry their parameter system with them.
public virtual bool UvChangesWithModification { get; }
Property Value
VPeriod
Returns the v priod of this surface if it is v periodic 0.0 otherwise
public virtual double VPeriod { get; }
Property Value
Methods
Approximate(double, double, double, double, double)
Create a NurbSurface as an approximation of this surface
public virtual NurbsSurface Approximate(double umin, double umax, double vmin, double vmax, double precision)
Parameters
umindoubleminimum u value of the part of this surface to approximate
umaxdoublemaximum u value of the part of this surface to approximate
vmindoubleminimum v value of the part of this surface to approximate
vmaxdoublemaximum v value of the part of this surface to approximate
precisiondoublemaximum allowed deviation of the approximation from this surface
Returns
Clone()
Returns an identical but independant copy of this surface
public virtual ISurface Clone()
Returns
CopyData(ISurface)
Copies the data of the given surface to this surface. The two surfaces are guaranteed to be of the same type. (Used after Clone() and Modify(ModOp) to restore the original values).
public virtual void CopyData(ISurface CopyFrom)
Parameters
CopyFromISurfacewhere to copy the data from
Curve3dOfProjected<T>(ICurve2D)
The 3d curve of curve2d, when it is a ProjectedCurve on this surface or on
a surface of type T which is geometrically the same - trimmed and turned the way the
2d curve is. Null for any other 2d curve, and also when the 3d curve does not lie on this surface after all:
SameGeometry may accept two surfaces of which the curve only lies on the other. Every surface used to ask
this with a copy of its own in Make3dCurve(ICurve2D), only the sphere checked the distance.
protected ICurve Curve3dOfProjected<T>(ICurve2D curve2d) where T : ISurface
Parameters
curve2dICurve2D
Returns
Type Parameters
Tthe type of surface the projected curve must be on
Derivation2At(GeoPoint2D, out GeoPoint, out GeoVector, out GeoVector, out GeoVector, out GeoVector, out GeoVector)
Returns the point, the two first derivations and the three second derivations of the surface at the provided parameter position.
public virtual void Derivation2At(GeoPoint2D uv, out GeoPoint location, out GeoVector du, out GeoVector dv, out GeoVector duu, out GeoVector dvv, out GeoVector duv)
Parameters
uvGeoPoint2DPoint in the parameter space
locationGeoPointResulting 3D point
duGeoVectorResulting derivation in u
dvGeoVectorResulting derivation in v
duuGeoVectordvvGeoVectorduvGeoVector
DerivationAt(GeoPoint2D, out GeoPoint, out GeoVector, out GeoVector)
Returns the point and the two derivations of the suface in a single call. It returns the same result as calling PointAt(GeoPoint2D), VDirection(GeoPoint2D) und VDirection(GeoPoint2D) succesively but is often faster than the three seperate calls.
public virtual void DerivationAt(GeoPoint2D uv, out GeoPoint location, out GeoVector du, out GeoVector dv)
Parameters
uvGeoPoint2DPoint in the parameter space
locationGeoPointResulting 3D point
duGeoVectorResulting derivation in u
dvGeoVectorResulting derivation in v
Fit(IEnumerable<GeoPoint>)
Modifies this surface to best approximate the provided points.
public virtual double Fit(IEnumerable<GeoPoint> points)
Parameters
pointsIEnumerable<GeoPoint>
Returns
- double
The sum of the squared errors
FitOld(IEnumerable<GeoPoint>)
Previous implementation of Fit(IEnumerable<GeoPoint>), kept for reference and not used by CADability. Use Fit(IEnumerable<GeoPoint>) instead.
public virtual double FitOld(IEnumerable<GeoPoint> points)
Parameters
pointsIEnumerable<GeoPoint>The points the surface should approximate
Returns
- double
The sum of the squared distances of the points from the fitted surface
FixedU(double, double, double)
Returns a curve where the u parameter of this surface is fixed and the v parameter starts a vmin and ends at vmax
public abstract ICurve FixedU(double u, double vmin, double vmax)
Parameters
Returns
FixedV(double, double, double)
Returns a curve where the v parameter of this surface is fixed and the u parameter starts a umin and ends at umax
public abstract ICurve FixedV(double u, double umin, double umax)
Parameters
Returns
GetCanonicalForm(double, BoundingRect?)
Returns a simpler form of this surface: SurfaceOfLinearExtrusion might be a cylinder, NURBS might be a sphere etc. Returns null, if there is no simpler form
public virtual ISurface GetCanonicalForm(double precision, BoundingRect? bounds)
Parameters
precisiondoublemaximal allowed deviation of the new surface
boundsBoundingRect?the part of the parameter space in which the surfaces must coincide; null: the natural bounds of this surface
Returns
GetContextMenuForParametrics(IFrame, Face)
Returns a context menu to change certain parameters of the surface of a face
public virtual MenuWithHandler[] GetContextMenuForParametrics(IFrame frame, Face face)
Parameters
Returns
GetDistance(GeoPoint)
Returns the distance of the provided point p to the (unlimited) surface.
public virtual double GetDistance(GeoPoint p)
Parameters
pGeoPoint
Returns
GetDualSurfaceCurves(BoundingRect, ISurface, BoundingRect, List<GeoPoint>, List<Tuple<double, double, double, double>>)
Returns intersectionCurves
public virtual IDualSurfaceCurve[] GetDualSurfaceCurves(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, List<GeoPoint> seeds, List<Tuple<double, double, double, double>> extremePositions)
Parameters
thisBoundsBoundingRectBounds for this surface
otherISurfaceOther surface
otherBoundsBoundingRectBounds of other surface
seedsList<GeoPoint>3d points known to lie on the intersection curves (typically the intersection points of the edges of one face with the other face), used as starting points for the intersection curves; may be null
extremePositionsList<Tuple<double, double, double, double>>Positions (u1, v1, u2, v2) where the surfaces have an extremum of their distance, as returned by GetExtremePositions(BoundingRect, ISurface, BoundingRect, out List<Tuple<double, double, double, double>>). Entries may be double.NaN. They are used to find closed intersection curves which do not cross the bounds; may be null
Returns
GetExtrema()
Returns an array of points in parametric space where there are extrema in direction of x-, y- or z-axis. The normal vector in a extremum is parallel to one of the axis and the surface has a relative maximum or minimum in this direction.
public virtual GeoPoint2D[] GetExtrema()
Returns
- GeoPoint2D[]
s.a.
GetExtremePositions(BoundingRect, ICurve, out List<Tuple<double, double, double>>)
Find positions on the surface and on the curve where the connection of these points are perpendicular to the surface and to the curve
public virtual int GetExtremePositions(BoundingRect domain, ICurve curve3D, out List<Tuple<double, double, double>> positions)
Parameters
domainBoundingRectvalid area for the surface
curve3DICurvethe curve
positionsList<Tuple<double, double, double>>the positions found: first two doubles are u,v on the surface, third is u on the curve
Returns
GetExtremePositions(BoundingRect, ISurface, BoundingRect, out List<Tuple<double, double, double, double>>)
Find positions in the uv system, where the connection of the points are perpendicular on both surfaces. the resulting list extremePositions may be
only partially filled, the missing uv values may be double.NaN, because this is what we need in most cases.
public virtual int GetExtremePositions(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, out List<Tuple<double, double, double, double>> extremePositions)
Parameters
thisBoundsBoundingRectotherISurfaceotherBoundsBoundingRectextremePositionsList<Tuple<double, double, double, double>>
Returns
GetImplicitPolynomial()
Returns the implicit form of the surface: a polynomial in x, y and z which is zero exactly for the points of the surface and whose value approximates the (signed) distance of a point from the surface. It is used to speed up intersections and distance computations with other surfaces. The base implementation returns null; the elementary surfaces (e.g. CylindricalSurface, ToroidalSurface) override it.
public virtual Polynom GetImplicitPolynomial()
Returns
- Polynom
The implicit polynomial, or null when not available for this type of surface
GetLineIntersection(GeoPoint, GeoVector)
Returns the intersectionpoints of this surface with the line given by the parameters. Teh returned point are in the parametric (u/v) space of this surface.
public virtual GeoPoint2D[] GetLineIntersection(GeoPoint startPoint, GeoVector direction)
Parameters
Returns
GetModified(ModOp)
Returns a clone of this surface modified by the given ModOp.
public abstract ISurface GetModified(ModOp m)
Parameters
mModOphow to modify
Returns
GetNaturalBounds(out double, out double, out double, out double)
Returns the natural bounds of the surface. The returned values may be infinite
public virtual void GetNaturalBounds(out double umin, out double umax, out double vmin, out double vmax)
Parameters
GetNonPeriodicSurface(ICurve[])
Implements GetNonPeriodicSurface(ICurve[])
public virtual ISurface GetNonPeriodicSurface(ICurve[] orientedCurves)
Parameters
orientedCurvesICurve[]3d curves describing the outline that will be used on the resulting surface
Returns
GetNormal(GeoPoint2D)
Returns the normal vector (perpendicular to the surface) at the given u/v point
public virtual GeoVector GetNormal(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition of normal
Returns
- GeoVector
normal vector
GetOffsetSurface(double)
Returns a surface that is "parallel" to this surface, i.e. each point on this surface corresponds a point on the returned surface that has the same (u,v) coordinates and has the 3d coordinates oft the point plus offset*Normal at this point
public virtual ISurface GetOffsetSurface(double offset)
Parameters
offsetdoubleOffset to this surface
Returns
- ISurface
The offset surface
GetOffsetSurface(double, out ModOp2D)
Returns the surface parallel to this surface at the distance offset (in direction of the normal) together
with the mapping of the parameter space, for surfaces whose offset is of the same type but with a different parameter system
(the offset of a ConicalSurface is a cone with a shifted apex and a shifted v parameter). The base implementation
returns null and Null; callers then fall back to GetOffsetSurface(double), which wraps this
surface in an OffsetSurface.
public virtual ISurface GetOffsetSurface(double offset, out ModOp2D mod)
Parameters
offsetdoubleThe distance of the offset surface, positive in direction of the normal
modModOp2DThe 2d transformation which maps u/v points of this surface to u/v points of the offset surface
Returns
- ISurface
The offset surface, or null when not implemented for this type of surface
GetPatchExtent(BoundingRect, bool)
Implements GetPatchExtent(BoundingRect, bool)
public virtual BoundingCube GetPatchExtent(BoundingRect uvPatch, bool rough)
Parameters
uvPatchBoundingRectroughbooltrue: a quickly computed extent which may be larger than necessary is sufficient (ignored here)
Returns
GetPatchHull(BoundingRect, out GeoPoint, out GeoVector, out GeoVector, out GeoVector)
Returns a parallelepiped (a prism with parallelograms) defined by the parameters loc,
dir1, dir2, dir3 which completeley covers or encloses
the patch of the surface defined by the uvpatch. There are obviously many solutions
to this problem but a parallelepiped with minimum volume would be preferred. This method is used
to optimate intersection algorithms.
public virtual void GetPatchHull(BoundingRect uvpatch, out GeoPoint loc, out GeoVector dir1, out GeoVector dir2, out GeoVector dir3)
Parameters
uvpatchBoundingRectThe patch of the surface in parametric space
locGeoPointOne vertex of the result
dir1GeoVectorOne of the three vectors of the parallelepiped
dir2GeoVectorOne of the three vectors of the parallelepiped
dir3GeoVectorOne of the three vectors of the parallelepiped
GetPlaneIntersection(PlaneSurface, double, double, double, double, double)
Returns the intersection curve(s) of this surface with the given plane. An empty array is returned if there is no intersection. umin, umax, vmin, vmax define the Parameterspace of this surface (not of the PlaneSurface) for the intersection. It is also the periodic domain in which the 2d curve for this surface will be returned, if this surface is periodic. the resulting curves may exceed the area provided by umin, umax, vmin, vmax.
public virtual IDualSurfaceCurve[] GetPlaneIntersection(PlaneSurface pl, double umin, double umax, double vmin, double vmax, double precision)
Parameters
plPlaneSurfaceplane to intersect with
umindoubleminimum u value of the parameter space of this surface to consider
umaxdoublemaximum u value of the parameter space of this surface to consider
vmindoubleminimum v value of the parameter space of this surface to consider
vmaxdoublemaximum v value of the parameter space of this surface to consider
precisiondoublemaximum allowed deviation of the resulting curves from the exact intersection
Returns
- IDualSurfaceCurve[]
intersection curves
GetPolynomialParameters()
Returns the coefficients of the implicit equation of the surface when it is an algebraic surface of degree at most 2 (plane, sphere, cone). The result holds 10 values c for the equation c[0]*x^2 + c[1]*y^2 + c[2]*z^2 + c[3]xy + c[4]yz + c[5]xz + c[6]*x + c[7]*y + c[8]*z + c[9] = 0, which describes the points (x, y, z) of the surface. Surfaces which cannot be described this way return null. Currently not used by CADability itself; see GetImplicitPolynomial() for the form the kernel works with.
public virtual double[] GetPolynomialParameters()
Returns
- double[]
The 10 coefficients of the implicit equation, or null
GetProjectedCurve(ICurve, double)
Returns the projection of the given curve in 2D coordinates. Should only be used for curves that are close to the surface.
public virtual ICurve2D GetProjectedCurve(ICurve curve, double precision)
Parameters
curveICurvethe 3d curve to project onto this surface
precisiondoublemaximum allowed deviation of the resulting 2d curve (mapped onto the surface) from the provided curve
Returns
GetPropertyEntry(IFrame)
Gets the IPropertyEntry to display this surface in the property grid (may be null)
public abstract IPropertyEntry GetPropertyEntry(IFrame frame)
Parameters
frameIFrame
Returns
GetSafeParameterSteps(double, double, double, double, out double[], out double[])
Gets spans of the parameterspace that are guaranteed to contain only one inflection point. The returned intu should contain umin as first and umax as last value (same with v)
public virtual void GetSafeParameterSteps(double umin, double umax, double vmin, double vmax, out double[] intu, out double[] intv)
Parameters
GetSaveUSteps()
Returns u values which subdivide the parameter range into intervals that GetExtrema() searches one by one for extrema in direction of the axes. Each interval must contain at most one extremum per axis direction (the periodic surfaces return quarter circles). The base implementation returns an empty array, which makes GetExtrema() find nothing.
protected virtual double[] GetSaveUSteps()
Returns
- double[]
Ascending u values from the start to the end of the parameter range, or an empty array
GetSaveVSteps()
Returns v values which subdivide the parameter range into intervals that GetExtrema() searches one by one for extrema in direction of the axes, see GetSaveUSteps(). The base implementation returns an empty array.
protected virtual double[] GetSaveVSteps()
Returns
- double[]
Ascending v values from the start to the end of the parameter range, or an empty array
GetSelfIntersections(BoundingRect)
Returns the curves (in the u/v system) along which the surface intersects itself within bounds, see
GetSelfIntersections(BoundingRect). The base implementation returns null: the elementary surfaces do not
intersect themselves.
public virtual ICurve2D[] GetSelfIntersections(BoundingRect bounds)
Parameters
boundsBoundingRectThe part of the parameter space to consider
Returns
- ICurve2D[]
The self intersection curves, or null when there are none
GetTangentCurves(GeoVector, double, double, double, double)
Returns curves where direction is perpendicular to the normal vector
public virtual ICurve2D[] GetTangentCurves(GeoVector direction, double umin, double umax, double vmin, double vmax)
Parameters
Returns
- ICurve2D[]
GetTouchingPoints(BoundingRect, ISurface, BoundingRect)
Returns a list of points where the surfaces touch each other (where the surfaces are tangential)
public virtual GeoPoint[] GetTouchingPoints(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds)
Parameters
thisBoundsBoundingRectotherISurfaceotherBoundsBoundingRect
Returns
- GeoPoint[]
GetUSingularities()
returns the values for the u parameter where this surface is singular i.e. changing v with this u parameter fixed doesn't change the 3D point.
public virtual double[] GetUSingularities()
Returns
- double[]
list of u singularities
GetVSingularities()
returns the values for the v parameter where this surface is singular i.e. changing u with this v parameter fixed doesn't change the 3D point.
public virtual double[] GetVSingularities()
Returns
- double[]
list of v singularities
GetZMinMax(Projection, double, double, double, double, ref double, ref double)
Gets the minimum and maximumm valus for the z-coordinate of a rectangular patch (in parametric space) of this surface under a certain projection
public virtual void GetZMinMax(Projection p, double umin, double umax, double vmin, double vmax, ref double zMin, ref double zMax)
Parameters
pProjectionthe projection
umindoubleleft bound of the rectangular patch
umaxdoubleright bound of the rectangular patch
vmindoublebottom bound of the rectangular patch
vmaxdoubletop bound of the rectangular patch
zMindoublereturned minimum
zMaxdoublereturned maximum
HasDiscontinuousDerivative(out ICurve2D[])
Tells whether there are lines in the parameter space across which the first derivative (and thus the normal) of the surface jumps. This is the case for a NurbsSurface of degree 1 with inner knots, which consists of planar or ruled strips with sharp bends between them. Faces on such a surface are split along these lines before they are triangulated or intersected.
public virtual bool HasDiscontinuousDerivative(out ICurve2D[] discontinuities)
Parameters
discontinuitiesICurve2D[]The 2d curves (in the u/v system) along which the derivative is discontinuous; null when the result is false
Returns
- bool
true when there are discontinuities, false for the usual smooth surfaces
HitTest(BoundingCube, out GeoPoint2D)
Returns true, if this surface interferes with the provided cube. If this is the case uv will contain a point (in the parameter system of the surface) which is inside the cube
public virtual bool HitTest(BoundingCube cube, out GeoPoint2D uv)
Parameters
cubeBoundingCubeuvGeoPoint2D
Returns
HitTest(BoundingCube, double, double, double, double)
Checks whether this surface restricted by the provided parameters interferes with the provided cube.
public virtual bool HitTest(BoundingCube cube, double umin, double umax, double vmin, double vmax)
Parameters
cubeBoundingCubeBounding cube for the test
umindoubleMinimum for the u parameter
umaxdoubleMaximum for the u parameter
vmindoubleMinimum for the v parameter
vmaxdoubleMaximum for the v parameter
Returns
- bool
true if the cube and the surface interfere
Intersect(BoundingRect, ISurface, BoundingRect)
Returns the intersection curves between this surface and the provided other surface. Both surfaces are bound by rectangles.
public virtual ICurve[] Intersect(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds)
Parameters
thisBoundsBoundingRectBounds for this surface
otherISurfaceOther surface
otherBoundsBoundingRectBounds of other surface
Returns
- ICurve[]
Array of intersection curves
Intersect(BoundingRect, ISurface, BoundingRect, GeoPoint)
Returns the intersection curves between this surface and the provided other surface. Both surfaces are bound by rectangles.
public virtual ICurve Intersect(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, GeoPoint seed)
Parameters
thisBoundsBoundingRectBounds for this surface
otherISurfaceOther surface
otherBoundsBoundingRectBounds of other surface
seedGeoPointA 3d point on the intersection curve which is sought: of all intersection curves only the one passing through this point is returned
Returns
- ICurve
Array of intersection curves
Intersect(ICurve, BoundingRect, out GeoPoint[], out GeoPoint2D[], out double[])
Returns the intersection of the provided curve with this surface.
The result may be empty.
public virtual void Intersect(ICurve curve, BoundingRect uvExtent, out GeoPoint[] ips, out GeoPoint2D[] uvOnFaces, out double[] uOnCurve3Ds)
Parameters
curveICurveThe curve to be intersected with
uvExtentBoundingRectThe part of the parameter space of this surface in which intersection points are searched. It is also the periodic domain in which the u/v values of the intersection points are returned
ipsGeoPoint[]Resulting 3d intersection points
uvOnFacesGeoPoint2D[]u/v values of the intersection points on this surface
uOnCurve3Dsdouble[]u parameter of intersection points on the curve
InvalidateSecondaryData()
Discards the cached data derived from the geometry of the surface: the extrema and the boxed surface used by PositionOf(GeoPoint) and by intersections. Derived classes must call this whenever they change the geometry, e.g. in Modify(ModOp).
protected void InvalidateSecondaryData()
IsExtruded(GeoVector)
returns true, if the provided direction can be interpreted as an extrusion direction of the surface
public virtual bool IsExtruded(GeoVector direction)
Parameters
directionGeoVector
Returns
IsParallel(BoundingRect, ISurface, BoundingRect)
Returns a double value, if this surface is parallel to the other surface. Returns double.MaxValue otherwise. In most cases the bounds may be ignored.
public virtual double IsParallel(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds)
Parameters
thisBoundsBoundingRectotherISurfaceotherBoundsBoundingRect
Returns
IsRotated(Axis)
returns true, if the provided direction can be interpreted as a surface of rotation around the provided rotationAxis
public virtual bool IsRotated(Axis rotationAxis)
Parameters
rotationAxisAxisthe axis to test
Returns
IsVanishingProjection(Projection, double, double, double, double)
Returns true if the given projection makes the surface disappear, i.e. degenerate to an edge.
public virtual bool IsVanishingProjection(Projection p, double umin, double umax, double vmin, double vmax)
Parameters
pProjectionthe projection
umindoubleumaxdoublevmindoublevmaxdouble
Returns
- bool
true if vanishing, falso otherwise
Make3dCurve(ICurve2D)
Returns a 3-dimensional curve from the given 2-dimensional curve. the 2-dimensional curve is interpreted in the u/v system of the surface.
public virtual ICurve Make3dCurve(ICurve2D curve2d)
Parameters
curve2dICurve2Dthe base curve
Returns
- ICurve
corresponding 3-d curve
MakeCanonicalForm()
Modifies this surface into a more canonical form and returns the modification for the parametric space which reverses this modification in 2d. Curves in the parametric space of this surface will become invalid unless modified by the returned transformation.
public virtual ModOp2D MakeCanonicalForm()
Returns
- ModOp2D
2d modification for the parametric space
MakeFace(SimpleShape)
Makes a Face from this surface with the given bounds in the parametric (u/v) space.
public virtual Face MakeFace(SimpleShape simpleShape)
Parameters
simpleShapeSimpleShapethe bounds
Returns
- Face
the created face or null
MaxDist(GeoPoint2D, GeoPoint2D, out GeoPoint2D)
Returns the maximum distance between the surface and the straight 3d line connecting the surface points at sp
and ep, i.e. the error made when the segment from sp to ep in the
parameter space is replaced by a straight line in 3d. The triangulation uses it to decide whether an edge of a triangle must be
subdivided. The base implementation only samples the distance at 1/4, 1/2 and 3/4 of the segment; the elementary surfaces
override it with exact computations.
public virtual double MaxDist(GeoPoint2D sp, GeoPoint2D ep, out GeoPoint2D mp)
Parameters
spGeoPoint2DStart point in the parameter space
epGeoPoint2DEnd point in the parameter space
mpGeoPoint2DThe u/v position where the maximum distance was found
Returns
- double
The maximum distance found
Modify(ModOp)
Modifies this surface with the given operation
public virtual void Modify(ModOp m)
Parameters
mModOphow to modif
Orientation(GeoPoint)
Returns the orientation of the provided point. The sign of the result may be used to distinguish between inside and outside.
public virtual double Orientation(GeoPoint p)
Parameters
pGeoPoint
Returns
PerpendicularFoot(GeoPoint)
Returns a list of perpendicular foot points of the surface. The list may be empty
public virtual GeoPoint2D[] PerpendicularFoot(GeoPoint fromHere)
Parameters
fromHereGeoPointSource point for the perpendicular foot
Returns
- GeoPoint2D[]
Array of foot-points, may be empty
PointAt(GeoPoint2D)
Returns the 3-dimensional point at the given u/v point
public abstract GeoPoint PointAt(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoPoint
point
PositionOf(GeoPoint)
Returns the u/v position of the given point. It is assumed that the point is on the surface, if not the result is undetermined.
public virtual GeoPoint2D PositionOf(GeoPoint p)
Parameters
pGeoPointpoint
Returns
- GeoPoint2D
position
PositionOf(GeoPoint, BoundingRect)
Returns the u/v position of the given point like PositionOf(GeoPoint), but for a periodic surface the result is
moved by multiples of the period so that it lies as close as possible to domain (typically the domain of a face).
public GeoPoint2D PositionOf(GeoPoint p, BoundingRect domain)
Parameters
pGeoPointThe point, which is assumed to lie on the surface
domainBoundingRectThe area of the parameter space the result should lie in
Returns
- GeoPoint2D
The u/v position, adjusted to the domain
Refine(GeoPoint[], int, bool, PlaneSurface, double)
Creates a BSpline of the given degree through the provided points. The name stems from an earlier implementation
which refined the interpolation until precision was met; now it simply interpolates the points and
pl and precision are not used. Only used by ToroidalSurface for its plane intersection.
public BSpline Refine(GeoPoint[] geopoints, int degree, bool closed, PlaneSurface pl, double precision)
Parameters
geopointsGeoPoint[]The points the BSpline passes through
degreeintThe degree of the BSpline
closedboolTrue to create a closed BSpline
plPlaneSurfaceNot used
precisiondoubleNot used
Returns
- BSpline
The interpolating BSpline
ReverseOrientation()
Reverses the orientation of this surface. The normal vector will point to the other side after this operation. The returned ModOp2D determins how (u,v) coordinates of the parameter space have to be transformed to define the same 3d point.
public virtual ModOp2D ReverseOrientation()
Returns
- ModOp2D
Transformation of the parameter space
SameGeometry(BoundingRect, ISurface, BoundingRect, double, out ModOp2D)
Returns true if this surface and the other surface are geometrically identical, i.e. describe the same surface
in 3D space. The may have a different u/v system. The returned firstToSecond contains
the ModOp to convert from the u/v system of the first surface to the second surface.
public virtual bool SameGeometry(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, double precision, out ModOp2D firstToSecond)
Parameters
thisBoundsBoundingRectBounds for this surface
otherISurfaceOther surface
otherBoundsBoundingRectBounds of other surface
precisiondoubleRequired precision
firstToSecondModOp2DTransformation between different u/v systems
Returns
- bool
True if the surfaces are geometrically equal
SetBounds(BoundingRect)
Mostly used internally
public virtual void SetBounds(BoundingRect boundingRect)
Parameters
boundingRectBoundingRect
UDirection(GeoPoint2D)
Returns the direction at the given u/v point in direction of the u-axis
public abstract GeoVector UDirection(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoVector
direction
VDirection(GeoPoint2D)
Returns the direction at the given u/v point in direction of the v-axis
public abstract GeoVector VDirection(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoVector
direction
cube(double)
Returns the cube of x; helper for the formulas of derived surfaces.
protected static double cube(double x)
Parameters
xdoubleThe value
Returns
- double
xxx
exp32(double)
Returns x to the power of 3/2, i.e. x*sqrt(x); helper for the formulas of derived surfaces.
protected static double exp32(double x)
Parameters
xdoubleThe value, must not be negative
Returns
- double
sqrt(xxx)
exp52(double)
Returns x to the power of 5/2, i.e. xxsqrt(x); helper for the formulas of derived surfaces.
protected static double exp52(double x)
Parameters
xdoubleThe value, must not be negative
Returns
- double
sqrt(xxxxx)
quad(double)
Returns the fourth power of x; helper for the formulas of derived surfaces.
protected static double quad(double x)
Parameters
xdoubleThe value
Returns
- double
xxx*x
sqr(double)
Returns the square of x; helper for the formulas of derived surfaces.
protected static double sqr(double x)
Parameters
xdoubleThe value
Returns
- double
x*x