Table of Contents

Interface ICurve

Namespace
CADability.GeoObject
Assembly
CADability.dll

Interface implemented by one-dimensional geometric objects (eg. line, circle, bspline etc.). The curve may be open or closed.

public interface ICurve : IGeoObject, ILayer, IStyle, IOctTreeInsertable, IComparable
Inherited Members

Properties

EndDirection

The direction of the curve at the endpoint. If the curve is closed, this is the direction where the parameter is 1.0.

GeoVector EndDirection { get; }

Property Value

GeoVector

EndPoint

The endpoint of the curve. If the curve is closed, this is the point where the parameter is 1.0.

GeoPoint EndPoint { get; set; }

Property Value

GeoPoint

IsClosed

Determines, whether the curve is closed or open.

bool IsClosed { get; }

Property Value

bool

IsComposed

Returns true, if the curve is composed of other curves. Paths and Polylines are composed curves.

bool IsComposed { get; }

Property Value

bool

IsSingular

Determines, whether this curve is singular, i.e. it is only a point, returns the same value for each parameter

bool IsSingular { get; }

Property Value

bool

Length

Returns the length of the curve.

double Length { get; }

Property Value

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.

GeoVector StartDirection { get; }

Property Value

GeoVector

StartPoint

The start-point of the curve. If the curve is closed, this is the point where the parameter is 0.0.

GeoPoint StartPoint { get; set; }

Property Value

GeoPoint

SubCurves

Returns subcurves of composed curves. Paths and Polylines are composed curves.

ICurve[] SubCurves { get; }

Property Value

ICurve[]

Methods

Approximate(bool, double)

Returns a Path or a Polyline that approximates the curve with lines or lines and arcs.

ICurve Approximate(bool linesOnly, double maxError)

Parameters

linesOnly bool

true: no arcs, only lines

maxError double

Maximum derivation from the exact curve

Returns

ICurve

The Approximation

Clone()

Returns an identical copy of this curve

ICurve Clone()

Returns

ICurve

CloneModified(ModOp)

Returns a modified copy of this curve

ICurve CloneModified(ModOp m)

Parameters

m ModOp

modification

Returns

ICurve

modified copy

DirectionAt(double)

Returns the direction of the curve at a specified point. The parameter position 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.

GeoVector DirectionAt(double Position)

Parameters

Position double

Position on the curve

Returns

GeoVector

The requested direction

DistanceTo(GeoPoint)

Returns the minimal distance of point p to the curve.

double DistanceTo(GeoPoint p)

Parameters

p GeoPoint

Returns

double

Extend(double, double)

Extend the curve at the beginning or/and end. Not all curves are extendable, if they are not extendable they should return false. The units is the actual length of the curve, not the parameter space.

bool Extend(double atStart, double atEnd)

Parameters

atStart double
atEnd double

Returns

bool

GetExtent()

Returns the bounging cube for this curve

BoundingCube GetExtent()

Returns

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.

double[] GetExtrema(GeoVector direction)

Parameters

direction GeoVector

Direction for the extrema

Returns

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))

PlanarState GetPlanarState()

Returns

PlanarState

GetPlane()

Determins the plane in which the curve resides. Throws CurveException if the curve's PlanarState is NonPlanar or UnderDetermined.

Plane GetPlane()

Returns

Plane

The plane

GetPlaneIntersection(Plane)

Returns the parameters of the intersection points with the provided plane

double[] GetPlaneIntersection(Plane plane)

Parameters

plane Plane

To intersect with

Returns

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.

ICurve2D GetProjectedCurve(Plane p)

Parameters

p Plane

The plane this curve will be projected on

Returns

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

double[] GetSavePositions()

Returns

double[]

GetSelfIntersections()

Returns the self intersection position of this curve. The returned array contains pairs of parameter values. Each intersectionpoint corresponds to two parameters.

double[] GetSelfIntersections()

Returns

double[]

Parameters of the intersection points

HitTest(BoundingCube)

Determins whether this curve interferes with the provided cube.

bool HitTest(BoundingCube cube)

Parameters

cube BoundingCube

Cube to check interference with

Returns

bool

True, if curve and cube interfere

IsInPlane(Plane)

Determines whether the curve resides in the given plane.

bool IsInPlane(Plane p)

Parameters

p Plane

The plane for the test

Returns

bool

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

double ParameterToPosition(double parameter)

Parameters

parameter double

Returns

double

the position, 0..1 when inside the bounds

PointAndDerivativesAt(double, int)

Returns all derivatives up to grad. The first vector is actually the point at this position.

IReadOnlyList<GeoVector> PointAndDerivativesAt(double position, int grad)

Parameters

position double

Where to calculate the derivatives

grad int

Number of derivatives. grad==2 returns the point, the first and the second derivative

Returns

IReadOnlyList<GeoVector>

Sequence of derivatives: element 0 = point-vector (P), 1 = first derivative (P'), 2 = second (P''), … . Length ≥ grad+1.

PointAt(double)

Returns the point of the given position. The parameter position 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 correlation between the parameter Position and the resulting point may be not linear.

GeoPoint PointAt(double Position)

Parameters

Position double

Position on the curve

Returns

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 correlation between the parameter Position and the resulting position is linear. The result is usually used for PointAt(double) or DirectionAt(double).

double PositionAtLength(double position)

Parameters

position double

Position on the curve

Returns

double

The requested position

PositionOf(GeoPoint)

Returns the parametric position of the point on the curve. This function is inverse 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.

double PositionOf(GeoPoint p)

Parameters

p GeoPoint

Point, for which the position is requested

Returns

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.

double PositionOf(GeoPoint p, Plane pl)

Parameters

p GeoPoint

Point, whos position is requested

pl Plane

Plane for the computation of the closest point

Returns

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.

double PositionOf(GeoPoint p, double prefer)

Parameters

p GeoPoint

Point, for which the position is requested

prefer double

preferable solution close to this value

Returns

double

the requested position

PositionToParameter(double)

convert the position (which is in the 0..1 interval) to the natural parameter value

double PositionToParameter(double position)

Parameters

position double

Returns

double

Reverse()

Reverses the direction of the curve.

void Reverse()

SameGeometry(ICurve, double)

Returns true, if this curve and the provided curve describe the same curve in space (maybe opposite direction)

bool SameGeometry(ICurve other, double precision)

Parameters

other ICurve

The curve to be compared with

precision double

The required precision

Returns

bool

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).

ICurve[] Split(double Position)

Parameters

Position double

Where to split

Returns

ICurve[]

the splitted curve(s)

Split(double, double)

Splits the closed curve into two open curves at the given positions.

ICurve[] Split(double Position1, double Position2)

Parameters

Position1 double

first Position

Position2 double

second Position

Returns

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.

double[] TangentPosition(GeoVector direction)

Parameters

direction GeoVector

Returns

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.

void Trim(double StartPos, double EndPos)

Parameters

StartPos double

New start position

EndPos double

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.

bool TryPointDeriv2At(double position, out GeoPoint point, out GeoVector deriv1, out GeoVector deriv2)

Parameters

position double

Position where to calculate point and derivatives

point GeoPoint

The point at the required position

deriv1 GeoVector

The first derivative at the provided parameter

deriv2 GeoVector

The second derivative at the provided parameter

Returns

bool