Interface ICurve
Interface implemented by one-dimensional geometric objects (eg. line, circle, bspline etc.). The curve may be open or closed.
Namespace: CADability.GeoObject
Assembly: CADability.dll
Syntax
public interface ICurve
Properties
| Improve this Doc View SourceDescription
Returns a description of the curve, used in labels of the controlcenter.
Declaration
string Description { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
EndDirection
The direction of the curve at the endpoint. If the curve is closed, this is the direction where the parameter is 1.0.
Declaration
GeoVector EndDirection { get; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
EndPoint
The endpoint of the curve. If the curve is closed, this is the point where the parameter is 1.0.
Declaration
GeoPoint EndPoint { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoPoint |
IsClosed
Determines, whether the curve is closed or open.
Declaration
bool IsClosed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsComposed
Declaration
bool IsComposed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsSingular
Determines, whether this curve is singular, i.e. it is only a point, returns the same value for each parameter
Declaration
bool IsSingular { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Length
Returns the length of the curve.
Declaration
double Length { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
StartDirection
The direction of the curve at the start-point. If the curve is closed, this is the direction where the parameter is 0.0.
Declaration
GeoVector StartDirection { get; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
StartPoint
The start-point of the curve. If the curve is closed, this is the point where the parameter is 0.0.
Declaration
GeoPoint StartPoint { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoPoint |
SubCurves
Declaration
ICurve[] SubCurves { get; }
Property Value
| Type | Description |
|---|---|
| ICurve[] |
Methods
| Improve this Doc View SourceApproximate(Boolean, Double)
Declaration
ICurve Approximate(bool linesOnly, double maxError)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | linesOnly | true: no arcs, only lines |
| System.Double | maxError | Maximum derivation from the exact curve |
Returns
| Type | Description |
|---|---|
| ICurve | The Approximation |
Clone()
Returns an identical copy of this curve
Declaration
ICurve Clone()
Returns
| Type | Description |
|---|---|
| ICurve |
CloneModified(ModOp)
Returns a modified copy of this curve
Declaration
ICurve CloneModified(ModOp m)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp | m | modification |
Returns
| Type | Description |
|---|---|
| ICurve | modified copy |
DirectionAt(Double)
Returns the direction of the curve at a specified point. The parameter prosition of the start-point is 0.0, the parameter position of the endpoint is 1.0. Directions of a position outside this interval may be undefined.
Declaration
GeoVector DirectionAt(double Position)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Position | Position on the curve |
Returns
| Type | Description |
|---|---|
| GeoVector | The requested direction |
DistanceTo(GeoPoint)
Returns the minimal distance of point p to the curve.
Declaration
double DistanceTo(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p |
Returns
| Type | Description |
|---|---|
| System.Double |
GetExtent()
Returns the bounging cube for this curve
Declaration
BoundingCube GetExtent()
Returns
| Type | Description |
|---|---|
| BoundingCube | The cube bounding this curve |
GetExtrema(GeoVector)
Returns points of the curve (parameter values between 0.0 and 1.0) where the curve is tangential to
a plane defined by the normal vector direction. These points are minima or maxima in that
direction.
Declaration
double[] GetExtrema(GeoVector direction)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | direction | Direction for the extrema |
Returns
| Type | Description |
|---|---|
| System.Double[] | Positions of the extrema, if any |
GetPlanarState()
Determins the state of the curve in space. A curve may be either Planar (e.g. a cicle), NonPlanar (e.g. a polyline with vertices that dont shear a common plane) or UnderDetermined (e.g. a line defines a sheaf of planes (Ebenenbüschel))
Declaration
PlanarState GetPlanarState()
Returns
| Type | Description |
|---|---|
| PlanarState |
GetPlane()
Determins the plane in which the curve resides. Throws CurveException if the curve's PlanarState is NonPlanar or UnderDetermined.
Declaration
Plane GetPlane()
Returns
| Type | Description |
|---|---|
| Plane | The plane |
GetPlaneIntersection(Plane)
Returns the parameters of the intersection points with the provided plane
Declaration
double[] GetPlaneIntersection(Plane plane)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | plane | To intersect with |
Returns
| Type | Description |
|---|---|
| System.Double[] | Intersection parameters, may be empty |
GetProjectedCurve(Plane)
Orthogonally projects this curve into the given plane. Returns the 2D curve in the coordinate system of the given plane.
Declaration
ICurve2D GetProjectedCurve(Plane p)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | p | The plane this curve will be projected on |
Returns
| Type | Description |
|---|---|
| ICurve2D | The 2D curve in the given plane |
GetSavePositions()
Returns some positions (parameter values between 0.0 and 1.0) that can savely be used for Approximation purposes Usually not used by external applications
Declaration
double[] GetSavePositions()
Returns
| Type | Description |
|---|---|
| System.Double[] |
GetSelfIntersections()
Returns the self intersection position of this curve. The returned array contains pairs of parameter values. Each intersectionpoint corresponds to two parameters.
Declaration
double[] GetSelfIntersections()
Returns
| Type | Description |
|---|---|
| System.Double[] | Parameters of the intersection points |
HitTest(BoundingCube)
Determins whether this curve interferes with the provided cube.
Declaration
bool HitTest(BoundingCube cube)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingCube | cube | Cube to check interference with |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if curve and cube interfere |
IsInPlane(Plane)
Determines whether the curve resides in the given plane.
Declaration
bool IsInPlane(Plane p)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | p | The plane for the test |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, when the curve resides in the plane |
ParameterToPosition(Double)
convert the parameter, which is in a natural system (0..2*pi for circle, first knot to last knot for bspline) to the 0..1 normalized position
Declaration
double ParameterToPosition(double parameter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | parameter |
Returns
| Type | Description |
|---|---|
| System.Double | the position, 0..1 when inside the bounds |
PointAt(Double)
Returns the point of the given position. The parameter prosition of the start-point is 0.0, the parameter position of the endpoint is 1.0. Points of a position outside this interval may be undefined. The correlatioon between the parameter Position and the resulting point may be not linear.
Declaration
GeoPoint PointAt(double Position)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Position | Position on the curve |
Returns
| Type | Description |
|---|---|
| GeoPoint | The requested point |
PositionAtLength(Double)
Returns the parameter of the point at the given position. The position must be in the interval [0, Length]. The correlatioon between the parameter Position and the resulting position is linear. The result is usually used for PointAt(Double) or DirectionAt(Double).
Declaration
double PositionAtLength(double position)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | position | Position on the curve |
Returns
| Type | Description |
|---|---|
| System.Double | The requested position |
PositionOf(GeoPoint)
Returns the parametric position of the point on the curve. This function is invers to DirectionAt(Double). If the given point is not on the curve, the result is the position of a point on the curve, that is close to the given point, but not necessary of the closest point.
Declaration
double PositionOf(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | Point, whos position is requested |
Returns
| Type | Description |
|---|---|
| System.Double | the requested position |
PositionOf(GeoPoint, Plane)
Similar to the PointAt(Double) method. Returns the same result, if the point is on the curve. If the point is not on the curve the problem is looked at in the given plane. i.e. the closest point on the projected 2d curve from the projected 2d point is used.
Declaration
double PositionOf(GeoPoint p, Plane pl)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | Point, whos position is requested |
| Plane | pl | Plane for the computation of the closest point |
Returns
| Type | Description |
|---|---|
| System.Double | the requested position |
PositionOf(GeoPoint, Double)
Similar to PositionOf(GeoPoint). If the point is not on the curve and there are several solutions then the solution closest to the parameter prefer will be returned.
Declaration
double PositionOf(GeoPoint p, double prefer)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | Point, whos position is requested |
| System.Double | prefer | preferable solution close to this value |
Returns
| Type | Description |
|---|---|
| System.Double | the requested position |
PositionToParameter(Double)
convert the position (which is in the 0..1 interval) to the natural parameter value
Declaration
double PositionToParameter(double position)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | position |
Returns
| Type | Description |
|---|---|
| System.Double |
Reverse()
Reverses the direction of the curve.
Declaration
void Reverse()
SameGeometry(ICurve, Double)
Returns true, if this curve and the provided curve describe the same curve in space (maybe opposite direction)
Declaration
bool SameGeometry(ICurve other, double precision)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve | other | The curve to be compared with |
| System.Double | precision | The required precision |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if geometrically equal |
Split(Double)
Splits the curve at the given position. The position must be in the interval 0..1 and the curve must not be closed. For closed curves Split(Double, Double).
Declaration
ICurve[] Split(double Position)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Position | Where to split |
Returns
| Type | Description |
|---|---|
| ICurve[] | the splitted curve(s) |
Split(Double, Double)
Splits the closed curve into two open curves at the given positions.
Declaration
ICurve[] Split(double Position1, double Position2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Position1 | first Position |
| System.Double | Position2 | second Position |
Returns
| Type | Description |
|---|---|
| ICurve[] | the splitted curve(s) |
TangentPosition(GeoVector)
Returns a list of positions where the curve has the same or opposite direction as the given direction. Mainly used for visualisation purposes. If there are no such points (which is true in most cases) An empty array should be returned.
Declaration
double[] TangentPosition(GeoVector direction)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | direction |
Returns
| Type | Description |
|---|---|
| System.Double[] |
Trim(Double, Double)
Modifies start and endpoint of this curve. StartPos must be less than EndPos. if StartPos is less than 0.0 or EndPos greater than 1.0 this only works for lines and (circular or elliptical) arcs.
Declaration
void Trim(double StartPos, double EndPos)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | StartPos | New start position |
| System.Double | EndPos | New end position |
TryPointDeriv2At(Double, out GeoPoint, out GeoVector, out GeoVector)
Tries to get the point and the first and second derivative of the curve at the specified position. (0..1) Some curves do not implement the second derivative and hence will return false.
Declaration
bool TryPointDeriv2At(double position, out GeoPoint point, out GeoVector deriv1, out GeoVector deriv2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | position | Position where to calculate point and derivatives |
| GeoPoint | point | The point at the required position |
| GeoVector | deriv1 | The first derivative at the provided parameter |
| GeoVector | deriv2 | The second derivative at the provided parameter |
Returns
| Type | Description |
|---|---|
| System.Boolean |