CurveBroker
A utility class for dealing with various different kinds of curves. Use this class to drastically reduce the amount of type-checking, casting and conversions you have to do.
Methods
Cast
#Cast an object to the correct curve type.
Parameters:
| data (object) | Data to cast. |
| p2 (out Line) | Output in case data is a Line. |
| p3 (out Triangle) | Output in case data is a Triangle. |
| p4 (out Rectangle3d) | Output in case data is a Rectangle3d. |
| pn (out Polyline) | Output in case data is a Polyline. |
| a360 (out Circle) | Output in case data is a Circle. |
| ax (out Arc) | Output in case data is an Arc. |
| c (out Curve) | Output in case data is a Curve. |
Returns: The type of data.
CastOrConvert
#Cast or convert an object to a curve type if possible.
Parameters:
| data (object) | Data to cast. |
| p2 (out Line) | Output in case data is a Line. |
| p3 (out Triangle) | Output in case data is a Triangle. |
| p4 (out Rectangle3d) | Output in case data is a Rectangle3d. |
| pn (out Polyline) | Output in case data is a Polyline. |
| a360 (out Circle) | Output in case data is a Circle. |
| ax (out Arc) | Output in case data is an Arc. |
| c (out Curve) | Output in case data is a Curve. |
Returns: Curve type, if any.
Convert
#Convert an object to a curve type if possible.
Parameters:
| data (object) | Data to cast. |
| p2 (out Line) | Output in case data is a Line. |
| p3 (out Triangle) | Output in case data is a Triangle. |
| p4 (out Rectangle3d) | Output in case data is a Rectangle3d. |
| pn (out Polyline) | Output in case data is a Polyline. |
| a360 (out Circle) | Output in case data is a Circle. |
| ax (out Arc) | Output in case data is an Arc. |
| c (out Curve) | Output in case data is a Curve. |
Returns: Numeric type, if any.
IsCurve
#Check whether a value is a kind of curve.
Parameters:
| data (object) | Data to check. |
Returns: Type of curve, or None is the data is null or not a curve type.
Simplify
#Simplify a curve and convert it to a more fundamental type if possible. If the curve cannot be simplified or is of an unknown type, it'll be returned wholesale.
Parameters:
| curve (object) |
ToRhinoCurve
#Try to convert a curve like type to a Rhino curve. This method uses all registered curve assistants. This method make sure that for all standard conversions the curve domain of the returned value matches the domain of the argument.
Parameters:
| datum (object) |
ToRhinoCurves
#Try to convert a collection of curve like data into Rhino curves.
Parameters:
| data (IEnumerable<object>) |