aerocaps.geom.curves.BezierCurve3D#

class BezierCurve3D(control_points: List[Point3D], name: str = 'BezierCurve3D', construction: bool = False)[source]#

Bases: PCurve3D

Three-dimensional Bézier curve class

__init__(control_points: List[Point3D], name: str = 'BezierCurve3D', construction: bool = False)[source]#

Creates a three-dimensional Bézier curve objects from a list of control points

Parameters:
  • control_points (List[Point3D] 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: ‘BezierCurve3D’

  • 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

compute_t_corresponding_to_z(z_seek[, t0])

Computes the \(t\)-value corresponding to a given \(z\)-value

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\)

elevate_degree()

Elevates the degree of the Bézier curve.

evaluate(t)

Evaluates the line at one or more \(t\)-values

evaluate_pcurvedata(t)

Evaluates a verbose set of parametric curve data as a class based on an input parameter value or vector

evaluate_point3d(t)

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

plot(ax[, projection, nt])

Plots the curve on a matplotlib.pyplot.Axes or a pyvista.Plotter window

project_onto_principal_plane([plane])

Projects the curve onto a principal plane

reverse()

Creates a copy of the curve with the parametric direction reversed.

split(t_split)

Splits the curve into two curves at a given \(t\)-value by applying the de-Casteljau algorithm

to_iges(*args, **kwargs)

Converts the geometric object to an IGES entity.

to_rational_bezier_curve()

Converts the curve to a rational Bézier curve by setting all weights to unity

transform(**transformation_kwargs)

Creates a transformed copy of the curve by transforming each of the control points

Attributes

degree

compute_t_corresponding_to_x(x_seek: float, t0: float = 0.5)[source]#

Computes the \(t\)-value corresponding to a given \(x\)-value

Parameters:
  • x_seek (float) – \(x\)-value

  • t0 (float) – Initial guess for the output \(t\)-value. Default: 0.5

Returns:

\(t\)-value corresponding to x_seek

Return type:

float

compute_t_corresponding_to_y(y_seek: float, t0: float = 0.5)[source]#

Computes the \(t\)-value corresponding to a given \(y\)-value

Parameters:
  • y_seek (float) – \(y\)-value

  • t0 (float) – Initial guess for the output \(t\)-value. Default: 0.5

Returns:

\(t\)-value corresponding to y_seek

Return type:

float

compute_t_corresponding_to_z(z_seek: float, t0: float = 0.5)[source]#

Computes the \(t\)-value corresponding to a given \(z\)-value

Parameters:
  • z_seek (float) – \(z\)-value

  • t0 (float) – Initial guess for the output \(t\)-value. Default: 0.5

Returns:

\(t\)-value corresponding to z_seek

Return type:

float

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 three elements: the \(x\)- \(y\)-, and \(z\)-components of the second derivative. Otherwise, the output is a 2-D array of size \(\text{len}(t) \times 3\)

Return type:

numpy.ndarray

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\)- \(y\), and \(z\)-components of the first derivative. Otherwise, the output is a 2-D array of size \(\text{len}(t) \times 3\)

Return type:

numpy.ndarray

elevate_degree() BezierCurve3D[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:

BezierCurve3D

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 t is a float, the output is a 1-D array with three elements: the values of \(x\), \(y\), and \(x\). Otherwise, the output is an array of size \(\text{len}(t) \times 3\)

Return type:

numpy.ndarray

evaluate_pcurvedata(t: float) PCurveData3D[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:

PCurveData3D

evaluate_point3d(t: float) Point3D[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 t is a float, the output is a single point object. Otherwise, the output is a list of point objects

Return type:

Point3D or List[Point3D]

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 3\) where \(n\) is the curve degree

Return type:

numpy.ndarray

plot(ax: Axes, projection: str = None, nt: int = 201, **plt_kwargs)[source]#

Plots the curve on a matplotlib.pyplot.Axes or a pyvista.Plotter window

Parameters:
  • ax (plt.Axes or pv.Plotter) – Axes/window on which to plot

  • projection (str) – Projection on which to plot (either ‘XY’, ‘YZ’, ‘XZ’, or ‘XYZ’ for a 3-D plot). Only used if ax is a plt.Axes. Defaults to ‘XYZ’ if not specified. Default: None

  • nt (int) – Number of evenly-spaced parameter values to plot. Default: 201

  • plt_kwargs – Additional keyword arguments to pass to matplotlib.pyplot.Axes.plot or pyvista.Plotter.add_lines

project_onto_principal_plane(plane: str = 'XY') BezierCurve2D[source]#

Projects the curve onto a principal plane

Parameters:

plane (str) – Plane on which to project the line. Either ‘XY’, ‘YZ’, or ‘XZ’

Returns:

Projected curve

Return type:

BezierCurve2D

reverse() BezierCurve3D[source]#

Creates a copy of the curve with the parametric direction reversed. This is done by reversing the order of the control points

Returns:

Reversed curve

Return type:

BezierCurve3D

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:

Bezier3D, Bezier3D

to_iges(*args, **kwargs) IGESEntity[source]#

Converts the geometric object to an IGES entity. To add this IGES entity to an .igs file, use an IGESGenerator.

to_rational_bezier_curve() RationalBezierCurve3D[source]#

Converts the curve to a rational Bézier curve by setting all weights to unity

Returns:

Rational version of the curve

Return type:

RationalBezierCurve3D

transform(**transformation_kwargs) BezierCurve3D[source]#

Creates a transformed copy of the curve by transforming each of the control points

Parameters:

transformation_kwargs – Keyword arguments passed to Transformation3D

Returns:

Transformed curve

Return type:

BezierCurve3D