aerocaps.geom.curves.BezierCurve2D#
- class BezierCurve2D(control_points: List[Point2D], name: str = 'BezierCurve2D', construction: bool = False)[source]#
Bases:
PCurve2DTwo-dimensional Bézier curve class
- __init__(control_points: List[Point2D], name: str = 'BezierCurve2D', construction: bool = False)[source]#
Creates a two-dimensional Bézier curve objects from a list of control points
- Parameters:
control_points (List[Point2D] or numpy.ndarray) – Control points for the Bézier curve
name (str) – Name of the geometric object. May be re-assigned a unique name when added to a
GeometryContainer. Default: ‘BezierCurve2D’construction (bool) – Whether this is a geometry used only for construction of other geometries. If
True, this geometry will not be exported or plotted. Default:False
Methods
compute_t_corresponding_to_x(x_seek[, t0])Computes the \(t\)-value corresponding to a given \(x\)-value
compute_t_corresponding_to_y(y_seek[, t0])Computes the \(t\)-value corresponding to a given \(y\)-value
convert_to_3d([plane])Converts the 2-D Bézier curve to a 3-D Bézier curve by mapping it onto a principal plane.
d2cdt2(t)Evaluates the second derivative of the curve with respect to \(t\)
dcdt(t)Evaluates the first derivative of the curve with respect to \(t\)
Elevates the degree of the Bézier curve.
evaluate(t)Evaluates the line at one or more \(t\)-values
Evaluates a verbose set of parametric curve data as a class based on an input parameter value or vector
Evaluates the line at one or more \(t\)-values and returns a single point object or list of point objects
get_control_point_array([unit])Gets an array representation of the control points
split(t_split)Splits the curve into two curves at a given \(t\)-value by applying the de-Casteljau algorithm
transform(**transformation_kwargs)Creates a transformed copy of the curve by transforming each of the control points
Attributes
Curve degree
- compute_t_corresponding_to_x(x_seek: float, t0: float = 0.5) float[source]#
Computes the \(t\)-value corresponding to a given \(x\)-value
- compute_t_corresponding_to_y(y_seek: float, t0: float = 0.5) float[source]#
Computes the \(t\)-value corresponding to a given \(y\)-value
- convert_to_3d(plane: str = 'XY') BezierCurve3D[source]#
Converts the 2-D Bézier curve to a 3-D Bézier curve by mapping it onto a principal plane. This is done by inserting a column of zeros.
- Parameters:
plane (str) – Principal plane, one of ‘XY’, ‘YZ’, or ‘XZ’
- Returns:
Planar 3-D Bézier curve
- Return type:
- d2cdt2(t: float) ndarray[source]#
Evaluates the second derivative of the curve with respect to \(t\)
- Parameters:
t (float or int or numpy.ndarray) – Either a single \(t\)-value, a number of evenly spaced \(t\)-values between 0 and 1, or a 1-D array of \(t\)-values
- Returns:
If \(t\) is a
float, the output is a 1-D array containing two elements: the \(x\)- and \(y\)-components of the second derivative. Otherwise, the output is a 2-D array of size \(\text{len}(t) \times 2\)- Return type:
- dcdt(t: float) ndarray[source]#
Evaluates the first derivative of the curve with respect to \(t\)
- Parameters:
t (float or int or numpy.ndarray) – Either a single \(t\)-value, a number of evenly spaced \(t\)-values between 0 and 1, or a 1-D array of \(t\)-values
- Returns:
If \(t\) is a
float, the output is a 1-D array containing two elements: the \(x\)- and \(y\)-components of the first derivative. Otherwise, the output is a 2-D array of size \(\text{len}(t) \times 2\)- Return type:
- elevate_degree() BezierCurve2D[source]#
Elevates the degree of the Bézier curve. See algorithm source here.
- Returns:
A new Bézier curve with identical shape to the current one but with one additional control point.
- Return type:
- evaluate(t: float) ndarray[source]#
Evaluates the line at one or more \(t\)-values
- Parameters:
t (float or int or numpy.ndarray) – Either a single \(t\)-value, a number of evenly spaced \(t\)-values between 0 and 1, or a 1-D array of \(t\)-values
- Returns:
If
tis afloat, the output is a 1-D array with two elements: the values of \(x\) and \(y\). Otherwise, the output is an array of size \(\text{len}(t) \times 2\)- Return type:
- evaluate_pcurvedata(t: float) PCurveData2D[source]#
Evaluates a verbose set of parametric curve data as a class based on an input parameter value or vector
- Parameters:
t (float or int or numpy.ndarray) – Either a single \(t\)-value, a number of evenly spaced \(t\)-values between 0 and 1, or a 1-D array of \(t\)-values
- Returns:
Parametric curve information, including derivative and curvature data
- Return type:
- evaluate_point2d(t: float) Point2D[source]#
Evaluates the line at one or more \(t\)-values and returns a single point object or list of point objects
- Parameters:
t (float or int or numpy.ndarray) – Either a single \(t\)-value, a number of evenly spaced \(t\)-values between 0 and 1, or a 1-D array of \(t\)-values
- Returns:
If
tis afloat, the output is a single point object. Otherwise, the output is a list of point objects- Return type:
- get_control_point_array(unit: str = 'm') ndarray[source]#
Gets an array representation of the control points
- Parameters:
unit (str) – Physical length unit used to determine the output array. Default:
"m"- Returns:
Array of size \((n+1)\times 2\) where \(n\) is the curve degree
- Return type:
- split(t_split: float)[source]#
Splits the curve into two curves at a given \(t\)-value by applying the de-Casteljau algorithm
- Parameters:
t_split (float) – \(t\)-value at which to split the curve
- Returns:
Two new curves split at the input \(t\)-value
- Return type:
Bezier2D, Bezier2D
- transform(**transformation_kwargs) BezierCurve2D[source]#
Creates a transformed copy of the curve by transforming each of the control points
- Parameters:
transformation_kwargs – Keyword arguments passed to
Transformation2D- Returns:
Transformed curve
- Return type: