Table of Contents

Class ProjectedCurve

Namespace
CADability
Assembly
CADability.dll

A 2d curve as a projection of a 3d curve onto a surface. Sometimes it is easier to calculate points in 3d than in 2d. Then we use this as a more exact for of the curve than we get, when we approximate the curve in 2d.

public class ProjectedCurve : GeneralCurve2D, ICurve2D, IQuadTreeInsertable, ISerializable
Inheritance
ProjectedCurve
Implements
Inherited Members

Constructors

ProjectedCurve(ICurve, ISurface, bool, BoundingRect, double)

public ProjectedCurve(ICurve curve3D, ISurface surface, bool forward, BoundingRect domain, double precision = 0)

Parameters

curve3D ICurve
surface ISurface
forward bool
domain BoundingRect
precision double

ProjectedCurve(ICurve, ISurface, double, double, BoundingRect)

public ProjectedCurve(ICurve curve3D, ISurface surface, double startParam, double endParam, BoundingRect domain)

Parameters

curve3D ICurve
surface ISurface
startParam double
endParam double
domain BoundingRect

ProjectedCurve(SerializationInfo, StreamingContext)

protected ProjectedCurve(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo
context StreamingContext

Properties

Curve3D

public ICurve Curve3D { get; }

Property Value

ICurve

Curve3DFromParams

public ICurve Curve3DFromParams { get; }

Property Value

ICurve

IsReverse

public bool IsReverse { get; }

Property Value

bool

Surface

public ISurface Surface { get; }

Property Value

ISurface

Methods

Clone()

Returns an independent copy of this curve of the same type. Modifying the copy does not affect this curve.

public override ICurve2D Clone()

Returns

ICurve2D

the copy

Copy(ICurve2D)

Copies the data of the given object to this object. Both objects must be of the same type.

public override void Copy(ICurve2D toCopyFrom)

Parameters

toCopyFrom ICurve2D

Copies the data of this object

DirectionAt(double)

Returns the direction of the curve at the provided normalized position.

public override GeoVector2D DirectionAt(double Position)

Parameters

Position double

Where to get the direction

Returns

GeoVector2D

The direction

GetModified(ModOp2D)

Returns a ICurve which is this curve modified by m. The curve can be of different type, e.g. a Circle may return an Ellpse

public override ICurve2D GetModified(ModOp2D m)

Parameters

m ModOp2D

Returns

ICurve2D

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public override void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

GetTriangulationBasis(out GeoPoint2D[], out GeoVector2D[], out double[])

Supplies the base points of the triangulation (see MakeTriangulation()): a list of parameters, ascending from 0.0 to 1.0, with the points and the directions of the curve at them. Between two consecutive base points the curve must be free of kinks, and it should bend to one side only, so that the triangle spanned by the two points and their tangents encloses that piece of the curve; the knots of a spline or the quadrant points of an arc are typical choices. GetInflectionPoints() and Length use the same basis to bracket their numerical work. The default implementation takes the parameters 0.0, 0.25, 0.5, 0.75 and 1.0 with the normalized DirectionAt(double).

protected override void GetTriangulationBasis(out GeoPoint2D[] points, out GeoVector2D[] directions, out double[] parameters)

Parameters

points GeoPoint2D[]

the base points on the curve

directions GeoVector2D[]

the directions of the curve at the base points

parameters double[]

the normalized parameters of the base points, ascending

Move(double, double)

Move the curve by the given offset

public override void Move(double x, double y)

Parameters

x double
y double

PointAt(double)

Returns the point of the curve at the provided normalized position

public override GeoPoint2D PointAt(double Position)

Parameters

Position double

Where to get the direction

Returns

GeoPoint2D

The point

PositionOf(GeoPoint2D)

The position of p on this curve. For a point of the curve it follows exactly from the 3d curve; the base implementation interpolates the 2d points of the curve, which was up to a few 1e-6 off, more than eps. The boolean operations trim the 2d curves of the intersection edges at the positions of their vertices, so a 2d curve ended beside its vertex and the loop of edges on a face did not close (a sphere whose axis lies in a face of a box, but not parallel to an edge of it, gave no union). Points that are not on the curve still use the base implementation.

public override double PositionOf(GeoPoint2D p)

Parameters

p GeoPoint2D

Returns

double

Reverse()

Reverses the direction of this curve

public override void Reverse()

Split(double)

Splits the curve at the given normalized parameter. The curve itself remains unchanged.

public override ICurve2D[] Split(double Position)

Parameters

Position double

the parameter where to split

Returns

ICurve2D[]

two new curves, the part from 0.0 to Position and the part from Position to 1.0; a single copy of the whole curve when Position is not strictly between 0.0 and 1.0

Trim(double, double)

Returns a new curve of the same type which is the part of this curve between the two normalized parameters. The curve itself remains unchanged. Normally StartPos is less than EndPos; for a closed curve (Circle2D, Ellipse2D) reversed parameters select the part that runs across the start point of the curve, for other curves the behaviour depends on the type (a Line2D or Arc2D returns the part in reversed direction).

public override ICurve2D Trim(double StartPos, double EndPos)

Parameters

StartPos double

parameter of the start of the part

EndPos double

parameter of the end of the part

Returns

ICurve2D

the trimmed curve, or null when the result would be degenerate (e.g. an arc with zero sweep)

TryPointDeriv2At(double, out GeoPoint2D, out GeoVector2D, out GeoVector2D)

Returns the point and the first two derivatives of the curve with respect to the normalized parameter at position (see TryPointDeriv2At(double, out GeoPoint2D, out GeoVector2D, out GeoVector2D)). This base implementation only provides the point and DirectionAt(double) as first derivative, sets the second derivative to the null vector and returns false; curves that know their second derivative override it.

public override bool TryPointDeriv2At(double position, out GeoPoint2D point, out GeoVector2D deriv, out GeoVector2D deriv2)

Parameters

position double

the normalized parameter

point GeoPoint2D

the point at the parameter

deriv GeoVector2D
deriv2 GeoVector2D

the second derivative, the null vector when not available

Returns

bool

true if the second derivative is available, false otherwise