Class Curves2D
This class provides some static Methods concerning the interaction of two ICurve2D objects.
Inheritance
Inherited Members
Namespace: CADability.Curve2D
Assembly: CADability.dll
Syntax
public class Curves2D
Methods
| Improve this Doc View SourceConnect(ICurve2D, ICurve2D)
Connect two curves: the endpoint of the first curve with the startpoint of the second curve.
Declaration
public static bool Connect(ICurve2D first, ICurve2D second)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | First curve |
| ICurve2D | second | Second curve |
Returns
| Type | Description |
|---|---|
| System.Boolean | 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.
Declaration
public static ICurve2D[] ConnectByTwoArcs(GeoPoint2D p1, GeoPoint2D p2, GeoVector2D dir1, GeoVector2D dir2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p1 | Startpoint |
| GeoPoint2D | p2 | Endpoint |
| GeoVector2D | dir1 | Starting direction |
| GeoVector2D | dir2 | ending direction |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static double DistanceAtDirection(ICurve2D first, ICurve2D second, GeoVector2D dir)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | Fisrt curve |
| ICurve2D | second | Second curve |
| GeoVector2D | dir | Direction of movement or distance |
Returns
| Type | Description |
|---|---|
| System.Double | Distance |
NearestPoint(GeoPoint2DWithParameter[], GeoPoint2D, out GeoPoint2DWithParameter)
Declaration
public static bool NearestPoint(GeoPoint2DWithParameter[] points, GeoPoint2D selectionPoint, out GeoPoint2DWithParameter nearestPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2DWithParameter[] | points | |
| GeoPoint2D | selectionPoint | |
| GeoPoint2DWithParameter | nearestPoint |
Returns
| Type | Description |
|---|---|
| System.Boolean |
SimpleMinimumDistance(ICurve2D, ICurve2D)
Declaration
public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | |
| ICurve2D | second |
Returns
| Type | Description |
|---|---|
| System.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.
Declaration
public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second, GeoPoint2D preferredPosition, out GeoPoint2D p1, out GeoPoint2D p2)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | first curve |
| ICurve2D | second | second curve |
| GeoPoint2D | preferredPosition | Position for parallel curves |
| GeoPoint2D | p1 | returns the point on the first curve |
| GeoPoint2D | p2 | returns the point on the second curve |
Returns
| Type | Description |
|---|---|
| System.Double | The value of the minimum distance |
SimpleMinimumDistance(ICurve2D, ICurve2D, out GeoPoint2D, out GeoPoint2D)
Returns the minimum distance of the two given curves.
Declaration
public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second, out GeoPoint2D p1, out GeoPoint2D p2)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | first curve |
| ICurve2D | second | second curve |
| GeoPoint2D | p1 | returns the point on the first curve |
| GeoPoint2D | p2 | returns the point on the second curve |
Returns
| Type | Description |
|---|---|
| System.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)
Declaration
public static GeoPoint2D[] TangentCircle(ICurve2D c1, ICurve2D c2, ICurve2D c3, GeoPoint2D p1, GeoPoint2D p2, GeoPoint2D p3)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | c1 | first tangential curve |
| ICurve2D | c2 | second tangential curve |
| ICurve2D | c3 | third tangential curve |
| GeoPoint2D | p1 | startpoint on c1 |
| GeoPoint2D | p2 | startpoint on c2 |
| GeoPoint2D | p3 | startpoint on c3 |
Returns
| Type | Description |
|---|---|
| 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)
Declaration
public static GeoPoint2D[] TangentCircle(ICurve2D first, ICurve2D second, double radius)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | first curve |
| ICurve2D | second | second curve |
| System.Double | radius | radius of the requsted circle |
Returns
| Type | Description |
|---|---|
| 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)
Declaration
public static GeoPoint2D[] TangentCircle(ICurve2D curve, GeoPoint2D point, double radius)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | curve | curve |
| GeoPoint2D | point | point on the circle |
| System.Double | radius | radius of the requsted circle |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static GeoPoint2D[] TangentLines(ICurve2D first, ICurve2D second)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | |
| ICurve2D | second |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static GeoPoint2D[] TangentLines(ICurve2D first, ICurve2D second, GeoPoint2D p1, GeoPoint2D p2)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve2D | first | first curve |
| ICurve2D | second | second curve |
| GeoPoint2D | p1 | point near first curve |
| GeoPoint2D | p2 | point near second curve |
Returns
| Type | Description |
|---|---|
| GeoPoint2D[] |