Table of Contents

Class Curves2D

Namespace
CADability.Curve2D
Assembly
CADability.dll

This class provides some static Methods concerning the interaction of two ICurve2D objects.

public class Curves2D
Inheritance
Curves2D
Inherited Members

Constructors

Curves2D()

public Curves2D()

Methods

Connect(ICurve2D, ICurve2D)

Connect two curves: the endpoint of the first curve with the startpoint of the second curve.

public static bool Connect(ICurve2D first, ICurve2D second)

Parameters

first ICurve2D

First curve

second ICurve2D

Second curve

Returns

bool

true if succeede, false otherwise

ConnectByTwoArcs(GeoPoint2D, GeoPoint2D, GeoVector2D, GeoVector2D)

Constructs two arcs that connect p1 and p2 and are tangential to dir1 and dir2 respectively.

public static ICurve2D[] ConnectByTwoArcs(GeoPoint2D p1, GeoPoint2D p2, GeoVector2D dir1, GeoVector2D dir2)

Parameters

p1 GeoPoint2D

Startpoint

p2 GeoPoint2D

Endpoint

dir1 GeoVector2D

Starting direction

dir2 GeoVector2D

ending direction

Returns

ICurve2D[]

DistanceAtDirection(ICurve2D, ICurve2D, GeoVector2D)

Calculates the distance of the two curves in the provided direction. In other words this means how far con you move the first curve in the direction dir so that it touches the second curve? The result may be double.MaxValue if the curves will never touch eac other, or it might be negative if you would have to move first in the opposite direction of dir to touch second.

note

Currently only implemented for Line2D and Arc2D

.
public static double DistanceAtDirection(ICurve2D first, ICurve2D second, GeoVector2D dir)

Parameters

first ICurve2D

Fisrt curve

second ICurve2D

Second curve

dir GeoVector2D

Direction of movement or distance

Returns

double

Distance

NearestPoint(GeoPoint2DWithParameter[], GeoPoint2D, out GeoPoint2DWithParameter)

public static bool NearestPoint(GeoPoint2DWithParameter[] points, GeoPoint2D selectionPoint, out GeoPoint2DWithParameter nearestPoint)

Parameters

points GeoPoint2DWithParameter[]
selectionPoint GeoPoint2D
nearestPoint GeoPoint2DWithParameter

Returns

bool

SimpleMinimumDistance(ICurve2D, ICurve2D)

public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second)

Parameters

first ICurve2D
second ICurve2D

Returns

double

SimpleMinimumDistance(ICurve2D, ICurve2D, GeoPoint2D, out GeoPoint2D, out GeoPoint2D)

Returns the minimum distance of the two given curves. If the curves are parallel, the connection of p1 and p2 will go through preferredPosition.

public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second, GeoPoint2D preferredPosition, out GeoPoint2D p1, out GeoPoint2D p2)

Parameters

first ICurve2D

first curve

second ICurve2D

second curve

preferredPosition GeoPoint2D

Position for parallel curves

p1 GeoPoint2D

returns the point on the first curve

p2 GeoPoint2D

returns the point on the second curve

Returns

double

The value of the minimum distance

SimpleMinimumDistance(ICurve2D, ICurve2D, out GeoPoint2D, out GeoPoint2D)

Returns the minimum distance of the two given curves.

public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second, out GeoPoint2D p1, out GeoPoint2D p2)

Parameters

first ICurve2D

first curve

second ICurve2D

second curve

p1 GeoPoint2D

returns the point on the first curve

p2 GeoPoint2D

returns the point on the second curve

Returns

double

The value of the minimum distance

TangentCircle(ICurve2D, ICurve2D, ICurve2D, GeoPoint2D, GeoPoint2D, GeoPoint2D)

Calculates the center points and the tangential points of the circles that are tangential to the given curves. If the curves are lines or circles all possible solutions are revealed. If the curves are more complex, only the solution that is closest to the given points is revealed. Each solution consists of 4 points: 1.: the center, 2.: the tangential point to c1, 3.: the tangential point to c2, 4.: the tangential point to c3. The radius mus be calculated by the distance of the center to one of the tangential points. The length of the returned array is a multiple of 4 (or 0)

public static GeoPoint2D[] TangentCircle(ICurve2D c1, ICurve2D c2, ICurve2D c3, GeoPoint2D p1, GeoPoint2D p2, GeoPoint2D p3)

Parameters

c1 ICurve2D

first tangential curve

c2 ICurve2D

second tangential curve

c3 ICurve2D

third tangential curve

p1 GeoPoint2D

startpoint on c1

p2 GeoPoint2D

startpoint on c2

p3 GeoPoint2D

startpoint on c3

Returns

GeoPoint2D[]

Quadruples of GeoPoint2D defining 0 or more circles

TangentCircle(ICurve2D, ICurve2D, double)

Calculates the center points and the tangential points of the circles that are tangential to the given curves and have the given radius. There may be any number of solutions, including no solution. Each solution consists of three points: 1.: the center, 2.: the tangential point to the first curve, 3.: the tangential point to the second curve. The length of the returned array is a multiple of 3 (or 0)

public static GeoPoint2D[] TangentCircle(ICurve2D first, ICurve2D second, double radius)

Parameters

first ICurve2D

first curve

second ICurve2D

second curve

radius double

radius of the requsted circle

Returns

GeoPoint2D[]

the requested center points

TangentCircle(ICurve2D, GeoPoint2D, double)

Calculates the center points and the tangential point of the circles that are tangential to a given curve with a given circlepoint and have the given radius. There may be any number of solutions, including no solution. Each solution consists of two points: 1.: the center, 2.: the tangential point to the curve. The length of the returned array is a multiple of 2 (or 0)

public static GeoPoint2D[] TangentCircle(ICurve2D curve, GeoPoint2D point, double radius)

Parameters

curve ICurve2D

curve

point GeoPoint2D

point on the circle

radius double

radius of the requsted circle

Returns

GeoPoint2D[]

the requested center points

TangentLines(ICurve2D, ICurve2D)

Calculates lines that are tangential to both the first and the second curve. Returns an array of 2D points, where each pair of points represent a line. The number of points is always even. Implemented for circles or arcs only.

public static GeoPoint2D[] TangentLines(ICurve2D first, ICurve2D second)

Parameters

first ICurve2D
second ICurve2D

Returns

GeoPoint2D[]

TangentLines(ICurve2D, ICurve2D, GeoPoint2D, GeoPoint2D)

Calculates the start- and endpoints of lines that are tangential to the given curves. There may be any number of solutions, including no solution. Each solution consists of two points: 1.: the startpoint, 2.: the endpoint of the Line. the startpoint lies on the first curve, the endpoint on the second. The length of the returned array is a multiple of 2 (or 0). If both curves are circles or arcs, all possible solutions are returned. If a curve is mor complex than a circle (e.g. bspline, ellipse) only the solution closest to the points p1 and p2 is returned.

public static GeoPoint2D[] TangentLines(ICurve2D first, ICurve2D second, GeoPoint2D p1, GeoPoint2D p2)

Parameters

first ICurve2D

first curve

second ICurve2D

second curve

p1 GeoPoint2D

point near first curve

p2 GeoPoint2D

point near second curve

Returns

GeoPoint2D[]