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
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
p1GeoPoint2DStartpoint
p2GeoPoint2DEndpoint
dir1GeoVector2DStarting direction
dir2GeoVector2Dending 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.
public static double DistanceAtDirection(ICurve2D first, ICurve2D second, GeoVector2D dir)
Parameters
firstICurve2DFisrt curve
secondICurve2DSecond curve
dirGeoVector2DDirection of movement or distance
Returns
- double
Distance
NearestPoint(GeoPoint2DWithParameter[], GeoPoint2D, out GeoPoint2DWithParameter)
public static bool NearestPoint(GeoPoint2DWithParameter[] points, GeoPoint2D selectionPoint, out GeoPoint2DWithParameter nearestPoint)
Parameters
pointsGeoPoint2DWithParameter[]selectionPointGeoPoint2DnearestPointGeoPoint2DWithParameter
Returns
SimpleMinimumDistance(ICurve2D, ICurve2D)
public static double SimpleMinimumDistance(ICurve2D first, ICurve2D second)
Parameters
Returns
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
firstICurve2Dfirst curve
secondICurve2Dsecond curve
preferredPositionGeoPoint2DPosition for parallel curves
p1GeoPoint2Dreturns the point on the first curve
p2GeoPoint2Dreturns 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
firstICurve2Dfirst curve
secondICurve2Dsecond curve
p1GeoPoint2Dreturns the point on the first curve
p2GeoPoint2Dreturns 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
c1ICurve2Dfirst tangential curve
c2ICurve2Dsecond tangential curve
c3ICurve2Dthird tangential curve
p1GeoPoint2Dstartpoint on c1
p2GeoPoint2Dstartpoint on c2
p3GeoPoint2Dstartpoint 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
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
curveICurve2Dcurve
pointGeoPoint2Dpoint on the circle
radiusdoubleradius 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
Returns
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
firstICurve2Dfirst curve
secondICurve2Dsecond curve
p1GeoPoint2Dpoint near first curve
p2GeoPoint2Dpoint near second curve