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
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
IsClosed
Determines, whether the curve is closed or open.
bool IsClosed { get; }
Property Value
IsComposed
bool IsComposed { get; }
Property Value
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
Length
Returns the length of the curve.
double Length { get; }
Property Value
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
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
SubCurves
ICurve[] SubCurves { get; }
Property Value
- ICurve[]
Methods
Approximate(bool, double)
ICurve Approximate(bool linesOnly, double maxError)
Parameters
Returns
- ICurve
The Approximation
Clone()
Returns an identical copy of this curve
ICurve Clone()
Returns
CloneModified(ModOp)
Returns a modified copy of this curve
ICurve CloneModified(ModOp m)
Parameters
mModOpmodification
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
PositiondoublePosition 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
pGeoPoint
Returns
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
Returns
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
directionGeoVectorDirection 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
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
planePlaneTo 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
pPlaneThe 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
cubeBoundingCubeCube 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
pPlaneThe 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
parameterdouble
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
positiondoubleWhere to calculate the derivatives
gradintNumber 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
PositiondoublePosition 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
positiondoublePosition 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
pGeoPointPoint, 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
pGeoPointPoint, whos position is requested
plPlanePlane 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
pGeoPointPoint, for which the position is requested
preferdoublepreferable 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
positiondouble
Returns
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
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
PositiondoubleWhere 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
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
directionGeoVector
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
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
positiondoublePosition where to calculate point and derivatives
pointGeoPointThe point at the required position
deriv1GeoVectorThe first derivative at the provided parameter
deriv2GeoVectorThe second derivative at the provided parameter