Class OffsetSurface
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
The surface at a constant distance from another surface: the point at (u, v) is the point of BaseSurface at (u, v) moved by Offset along the normal of the base surface, so both surfaces share the same parameter space. GetOffsetSurface(double) returns it for surfaces that have no exact offset of their own kind, and the STEP import creates it for OFFSET_SURFACE entities. Derivatives are computed from the derivatives of the base surface; where the base surface is curved more strongly than the offset (radius of curvature below the offset) the offset surface is singular.
public class OffsetSurface : ISurfaceImpl, ISurface, IOctTreeInsertable, ISerializable, IExportStep
- Inheritance
-
OffsetSurface
- Implements
- Inherited Members
- Extension Methods
Constructors
OffsetSurface(ISurface, double, BoundingRect?)
Creates the offset of baseSurface at the distance offset.
public OffsetSurface(ISurface baseSurface, double offset, BoundingRect? usedArea = null)
Parameters
baseSurfaceISurfacethe surface to offset; it is used as it is, not copied
offsetdoublethe distance along the normal of the base surface; negative values offset against the normal
usedAreaBoundingRect?the rectangle in parameter space that is actually used, if known; it helps methods that need to sample the surface
OffsetSurface(SerializationInfo, StreamingContext)
Constructor for the legacy binary deserialization (ISerializable). Files are written in the JSON format now; the binary format is still read.
protected OffsetSurface(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfothe data of the object
contextStreamingContextthe source of the deserialization
Properties
BaseSurface
The surface this surface is the offset of.
public ISurface BaseSurface { get; }
Property Value
IsRuled
returns wheather the surface is linear in u or v direction
public override RuledSurfaceMode IsRuled { get; }
Property Value
IsUPeriodic
Returns true, if this surface is periodic in the u direction (e.g. a cylinder) false otherwise.
public override bool IsUPeriodic { get; }
Property Value
IsVPeriodic
Returns true, if this surface is periodic in the v direction (e.g. a torus) false otherwise.
public override bool IsVPeriodic { get; }
Property Value
Offset
The distance between the base surface and this surface, measured along the normal of the base surface; negative when this surface lies on the back side of the base surface.
public double Offset { get; }
Property Value
UPeriod
Returns the u priod of this surface if it is u periodic 0.0 otherwise
public override double UPeriod { get; }
Property Value
VPeriod
Returns the v priod of this surface if it is v periodic 0.0 otherwise
public override double VPeriod { get; }
Property Value
Methods
Approximate(double, double, double, double, double)
Approximates this surface in the given part of its parameter space by a non rational NurbsSurface with
the same parametrisation: the point at (u, v) of the result is (within precision) the point at (u, v)
of this surface. The surface is interpolated by a cubic spline surface through a grid of points, which is refined in
each direction until the points between the grid points are within precision, or up to 256 segments.
public override NurbsSurface Approximate(double umin, double umax, double vmin, double vmax, double precision)
Parameters
umindoublethe lower bound of u
umaxdoublethe upper bound of u
vmindoublethe lower bound of v
vmaxdoublethe upper bound of v
precisiondoublethe maximum distance of the approximation from this surface
Returns
- NurbsSurface
the approximation
Clone()
Returns an identical but independant copy of this surface
public override 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 override void CopyData(ISurface CopyFrom)
Parameters
CopyFromISurfacewhere to copy the data from
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 override 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
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 override 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 override ICurve FixedV(double u, double umin, double umax)
Parameters
Returns
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 override GeoPoint2D[] GetLineIntersection(GeoPoint startPoint, GeoVector direction)
Parameters
Returns
GetModified(ModOp)
Returns the modified surface. Under a rotation, reflection or translation, optionally with a uniform scaling, this is again an offset surface. Under any other modification, e.g. a scaling with different factors along the axes, the image of an offset surface is no offset surface: its distance to the modified base surface depends on the direction of the normal. Then the part of the parameter space in which the surface is used (the domain of its face) is approximated by a NurbsSurface in the same (u, v) parametrisation (see Approximate(double, double, double, double, double)), and the modified approximation is returned, so the 2d curves of the face stay valid.
public override ISurface GetModified(ModOp m)
Parameters
mModOpthe modification
Returns
- ISurface
the modified surface
GetNaturalBounds(out double, out double, out double, out double)
Returns the natural bounds of the surface. The returned values may be infinite
public override void GetNaturalBounds(out double umin, out double umax, out double vmin, out double vmax)
Parameters
GetNormal(GeoPoint2D)
Returns the normal vector (perpendicular to the surface) at the given u/v point
public override 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 override ISurface GetOffsetSurface(double offset)
Parameters
offsetdoubleOffset to this surface
Returns
- ISurface
The offset surface
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 override 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
GetPropertyEntry(IFrame)
Gets the IPropertyEntry to display this surface in the property grid (may be null)
public override IPropertyEntry GetPropertyEntry(IFrame frame)
Parameters
frameIFrame
Returns
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 override 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 override 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 override 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
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 override ICurve Make3dCurve(ICurve2D curve2d)
Parameters
curve2dICurve2Dthe base curve
Returns
- ICurve
corresponding 3-d curve
Modify(ModOp)
Modifies this surface with the given operation
public override void Modify(ModOp m)
Parameters
mModOphow to modif
PointAt(GeoPoint2D)
Returns the 3-dimensional point at the given u/v point
public override GeoPoint PointAt(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoPoint
point
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 override 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 override 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
UDirection(GeoPoint2D)
Returns the direction at the given u/v point in direction of the u-axis
public override 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 override GeoVector VDirection(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoVector
direction