aerocaps.geom.curves.Line2D#
- class Line2D(p0: ~aerocaps.geom.point.Point2D, p1: ~aerocaps.geom.point.Point2D = None, theta: ~aerocaps.units.angle.Angle = None, d: ~aerocaps.units.length.Length = <aerocaps.units.length.Length object>, name: str = 'Line2D', construction: bool = False)[source]#
Bases:
PCurve2DTwo-dimensional line class
- __init__(p0: ~aerocaps.geom.point.Point2D, p1: ~aerocaps.geom.point.Point2D = None, theta: ~aerocaps.units.angle.Angle = None, d: ~aerocaps.units.length.Length = <aerocaps.units.length.Length object>, name: str = 'Line2D', construction: bool = False)[source]#
Two-dimensional line defined by either two points or a point and an angle. If a second point (
p1) is defined, the curve will be evaluated as\[\begin{split}\begin{align} x(t) &= x_0 + t (x_1 - x_0) \\ y(t) &= y_0 + t (y_1 - y_0) \end{align}\end{split}\]If an angle (
theta) is specified instead, the curve will be evaluated as\[\begin{split}\begin{align} x(t) &= x_0 + d \cdot t \cdot \cos{\theta} \\ y(t) &= y_0 + d \cdot t \cdot \sin{\theta} \end{align}\end{split}\]- Parameters:
p0 (Point2D) – Origin of the line
p1 (Point2D or None) – Endpoint of the line. If
None,thetamust be specified. Default:Nonetheta (Angle or None) – Angle of the line (counter-clockwise positive, \(0^{\circ}\) defined along the \(x\)-axis). If
None,p1must be specified. Default:Noned (Length) – Used in conjunction with
thetato determine the point corresponding to \(t=1\). Ifp1is specified, this value is not used. Default:Length(m=1.0)name (str) – Name of the geometric object. May be re-assigned a unique name when added to a
GeometryContainer. Default: ‘Line2D’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
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\)
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
Gets a vector object determined by the starting and ending points of the line
plot(ax[, nt])Plots the line on a
matplotlib.pyplot.AxesAttributes
- 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:
- 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_vector() Vector2D[source]#
Gets a vector object determined by the starting and ending points of the line
- Returns:
Vector object
- Return type:
- plot(ax: Axes, nt: int = 10, **kwargs)[source]#
Plots the line on a
matplotlib.pyplot.Axes- Parameters:
ax (plt.Axes) – Axis on which to plot the line
nt (int) – Number of points along the line to output to the plot. Default:
10kwargs – Additional keyword arguments to pass to
matplotlib.pyplot.Axes.plot