Class SurfaceOfLinearExtrusion
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
Surface defined by a 3d curve and a direction. A point at (u,v) of the surface is defined by the point of the curve at parameter u plus v*direction. It is the surface that is generated by the curve moved along the direction. The curve may not have the direction as a tangential vector. Also the curve is defined in the interval [0,1], the parameterspace of this curve may also be defined by a startParameter and an endParameter.
public class SurfaceOfLinearExtrusion : ISurfaceImpl, ISurface, IOctTreeInsertable, ISerializable, IExportStep, IJsonSerialize
- Inheritance
-
SurfaceOfLinearExtrusion
- Implements
- Inherited Members
- Extension Methods
Constructors
SurfaceOfLinearExtrusion()
Empty constructor for the JSON deserialization (IJsonSerialize); the data is set by SetObjectData(IJsonReadData).
protected SurfaceOfLinearExtrusion()
SurfaceOfLinearExtrusion(ICurve, GeoVector, double, double)
Creates the surface swept by basisCurve moved along direction. The point at (u, v)
is the point of the curve plus v·direction; u runs from curveStartParameter at the start point of the
curve to curveEndParameter at its end point. Pass 0 and 1 unless a different u interval is required
(e.g. by an imported file). The curve is used as it is, not copied.
public SurfaceOfLinearExtrusion(ICurve basisCurve, GeoVector direction, double curveStartParameter, double curveEndParameter)
Parameters
basisCurveICurvethe curve to extrude; its tangents must not be parallel to
directiondirectionGeoVectordirection of the extrusion; its length is the distance one v unit covers
curveStartParameterdoubleu value of the start point of the curve
curveEndParameterdoubleu value of the end point of the curve
SurfaceOfLinearExtrusion(SerializationInfo, StreamingContext)
Constructor for the legacy binary deserialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.
protected SurfaceOfLinearExtrusion(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfothe data of the object
contextStreamingContextthe source of the deserialization
Properties
BasisCurve
The curve that is moved along Direction to generate this surface (the curve at v = 0). It is the object the surface works with, not a copy; do not modify it.
public ICurve BasisCurve { get; }
Property Value
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 override bool CanStretch { get; }
Property Value
Direction
The direction of the extrusion. Its length is the distance one v unit covers; the surface is unbounded in v.
public GeoVector Direction { 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
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
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 v, 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 override 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
GetDualSurfaceCurves(BoundingRect, ISurface, BoundingRect, List<GeoPoint>, List<Tuple<double, double, double, double>>)
Returns intersectionCurves
public override 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
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 a clone of this surface modified by the given ModOp.
public override 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 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
GetObjectData(IJsonWriteData)
Writes the basis curve, the direction and the u interval for the JSON serialization (IJsonSerialize).
public void GetObjectData(IJsonWriteData data)
Parameters
dataIJsonWriteDatareceives the properties
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
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 override void GetSafeParameterSteps(double umin, double umax, double vmin, double vmax, out double[] intu, out double[] intv)
Parameters
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
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 override bool HitTest(BoundingCube bc, out GeoPoint2D uv)
Parameters
bcBoundingCubeuvGeoPoint2D
Returns
IsExtruded(GeoVector)
returns true, if the provided direction can be interpreted as an extrusion direction of the surface
public override bool IsExtruded(GeoVector direction)
Parameters
directionGeoVector
Returns
IsVanishingProjection(Projection, double, double, double, double)
Returns true if the given projection makes the surface disappear, i.e. degenerate to an edge.
public override 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 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
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 override GeoPoint2D PositionOf(GeoPoint p)
Parameters
pGeoPointpoint
Returns
- GeoPoint2D
position
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
SetObjectData(IJsonReadData)
Reads the data written by GetObjectData(IJsonWriteData) for the JSON deserialization (IJsonSerialize).
public void SetObjectData(IJsonReadData data)
Parameters
dataIJsonReadDataprovides the properties
Simplify()
Simplifies the basis curve of an imported surface: a BSpline whose weights are all almost 1 loses its weights, and a non-planar curve is replaced by its projection into the plane through its start point perpendicular to Direction, which describes the same surface. The latter may change the u parameterization, so this must not be called when 2d curves (e.g. of edges) already refer to the surface; the STEP import (Face) calls it for the surface of an imported face before the 2d curves of the edges are computed.
public void Simplify()
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