aerocaps.geom.surfaces.RationalBezierSurface#

class RationalBezierSurface(points: List[List[Point3D]], weights: ndarray, name: str = 'RationalBezierSurface', construction: bool = False)[source]#

Bases: Surface

Rational Bézier surface class. A NURBS surface with no internal knot vectors.

__init__(points: List[List[Point3D]], weights: ndarray, name: str = 'RationalBezierSurface', construction: bool = False)[source]#
Parameters:
  • points

  • weights

  • name (str) – Name of the geometric object. May be re-assigned a unique name when added to a GeometryContainer. Default: ‘RationalBezierSurface’

  • 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

d2Sdu2(u, v)

Evaluates the second derivative with respect to \(u\) at a single \((u,v)\) pair

d2Sdu2_grid(Nu, Nv)

Evaluates the second derivative with respect to \(u\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

d2Sdu2_uvvecs(u, v)

Evaluates the second derivative of the surface with respect to \(u\) at arbitrary vectors of \(u\) and \(v\)-values.

d2Sdv2(u, v)

Evaluates the second derivative with respect to \(v\) at a single \((u,v)\) pair

d2Sdv2_grid(Nu, Nv)

Evaluates the second derivative with respect to \(v\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

d2Sdv2_uvvecs(u, v)

Evaluates the second derivative of the surface with respect to \(v\) at arbitrary vectors of \(u\) and \(v\)-values.

dSdu(u, v)

Evaluates the first derivative with respect to \(u\) at a single \((u,v)\) pair

dSdu_grid(Nu, Nv)

Evaluates the first derivative with respect to \(u\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

dSdu_uvvecs(u, v)

Evaluates the first derivative of the surface with respect to \(u\) at arbitrary vectors of \(u\) and \(v\)-values.

dSdv(u, v)

Evaluates the first derivative with respect to \(v\) at a single \((u,v)\) pair

dSdv_grid(Nu, Nv)

Evaluates the first derivative with respect to \(v\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

dSdv_uvvecs(u, v)

Evaluates the first derivative of the surface with respect to \(v\) at arbitrary vectors of \(u\) and \(v\)-values.

elevate_degree_u()

Elevates the degree of the rational Bézier surface in the \(u\)-parametric direction.

elevate_degree_v()

Elevates the degree of the rational Bézier surface in the \(v\)-parametric direction.

enforce_c0(other, surface_edge, ...)

For zeroth-degree continuity, there is no difference between geometric (\(G^0\)) and parametric (\(C^0\)) continuity.

enforce_c0c1(other, surface_edge, ...)

Equivalent to calling enforce_g0g1 with f=1.0.

enforce_c0c1c2(other, surface_edge, ...)

Equivalent to calling enforce_g0g1g2 with f=1.0.

enforce_g0(other, surface_edge, ...)

Enforces \(G^0\) continuity along the input surface_edge by equating the control points and weights along this edge to the corresponding control points and weights along the other_surface_edge of the rational Bézier surface given by other.

enforce_g0g1(other, f, surface_edge, ...)

First enforces \(G^0\) continuity, then tangent (\(G^1\)) continuity is enforced according to the following equations:

enforce_g0g1g2(other, f, surface_edge, ...)

First enforces \(G^0\) and \(G^1\) continuity, then curvature (\(G^2\)) continuity is enforced according to the following equations:

enforce_g0g1g2_multiface([adjacent_surf_u0, ...])

evaluate(u, v)

Evaluates the surface at a given \((u,v)\) parameter pair.

evaluate_grid(Nu, Nv)

Evaluates the rational Bézier surface on a uniform \(N_u \times N_v\) grid of parameter values.

evaluate_point3d(u, v)

Evaluates the rational Bézier surface at a single \((u,v)\) parameter pair and returns a point object.

extract_edge_curve(surface_edge)

Extracts the control points and weights from one of the four edges of the rational Bézier surface and outputs a rational Bézier curve with these control points and weights

fill_surface_from_four_boundaries(...[, ...])

Creates a fill surface from four boundary curves by linearly interpolating the left_curve and right_curve and displacing the edges created by the interpolation to form the top_curve and bottom_curve boundaries.

from_bezier_revolve(bezier, axis, ...)

Creates a rational Bézier surface from the revolution of a Bézier curve about an axis.

generate_control_point_net()

Generates a list of Point3D and Line3D objects representing the rational Bézier surface's control points and connections between them

get_control_point_array()

Converts the nested list of control points to a 3-D ndarray.

get_corner_index(surface_corner)

Gets the \(i\)- and \(j\)-indices of the control point corresponding to the input corner

get_edge(edge[, n_points])

Evaluates the surface at n_points parameter locations along a given edge.

get_first_deriv_cp_sens_along_edge(edge, i, j)

Gets the sensitivity of the first \(u\)- or \(v\)-derivative along an edge with respect to control point \(\mathbf{P}_{i,j}\)

get_first_derivs_along_edge(edge[, ...])

Evaluates the parallel or perpendicular derivative along a surface edge at n_points parameter locations.

get_homogeneous_control_points()

Gets the array of control points in homogeneous coordinates, \(\mathbf{P}_{i,j} \cdot w_{i,j}\)

get_parallel_degree(surface_edge)

Gets the degree of the curve corresponding to the input surface edge.

get_parallel_n_points(surface_edge)

Gets the number of control points in the parametric direction parallel to the input surface edge.

get_perpendicular_degree(surface_edge)

Gets the degree of the curve in the parametric direction perpendicular to the input surface edge.

get_perpendicular_n_points(surface_edge)

Gets the number of control points in the parametric direction perpendicular to the input surface edge.

get_point(row_index, continuity_index, ...)

Gets the point corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied.

get_point_ij(row_index, continuity_index, ...)

Gets the point indices corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied.

get_second_deriv_cp_sens_along_edge(edge, i, j)

Gets the sensitivity of the second \(u\)- or \(v\)-derivative along an edge with respect to control point \(\mathbf{P}_{i,j}\)

get_second_derivs_along_edge(edge[, ...])

Evaluates the parallel or perpendicular second derivative along a surface edge at n_points parameter locations.

get_u_or_v_given_uvxyz([u, v, uv_guess, x, y, z])

Computes one parametric value given the other and a specified \(x\)-, \(y\)-, or \(z\)-location.

get_weight(row_index, continuity_index, ...)

Gets the weight corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied.

plot_control_point_mesh_lines(plot, ...)

Plots the network of lines connecting the rational Bézier surface control points using the pyvista library

plot_control_points(plot, **point_kwargs)

plot_surface(plot[, Nu, Nv])

project_homogeneous_control_points(...)

Projects the homogeneous coordinates onto the \(w=1\) hyperplane.

reverse_u()

Reverses the surface in the \(u\)-direction

reverse_v()

Reverses the surface in the \(v\)-direction

set_point(point, row_index, ...)

Sets the point corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied.

set_weight(weight, row_index, ...)

Sets the weight corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied.

split_at_u(u0)

Splits the rational Bezier surface at \(u=u_0\) along the \(v\)-parametric direction.

split_at_v(v0)

Splits the rational Bezier surface at \(v=v_0\) along the \(u\)-parametric direction.

to_iges(*args, **kwargs)

Converts the geometric object to an IGES entity.

transform(**transformation_kwargs)

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

verify_g0(other, surface_edge, ...[, n_points])

Verifies that two RationalBezierSurfaces are G0 continuous along their shared edge

verify_g1(other, surface_edge, ...[, n_points])

Verifies that two RationalBezierSurfaces are G1 continuous along their shared edge

verify_g2(other, surface_edge, ...[, n_points])

Verifies that two RationalBezierSurfaces are G2 continuous along their shared edge

Attributes

degree_u

Surface degree in the \(u\)-parametric direction

degree_v

Surface degree in the \(v\)-parametric direction

knots_u

Knots in the \(u\)-direction

knots_v

Knots in the \(v\)-direction

m

Shorthand for degree_v

n

Shorthand for degree_u

n_points_u

Number of control points in the \(u\)-parametric direction

n_points_v

Number of control points in the \(v\)-parametric direction

d2Sdu2(u: float, v: float) ndarray[source]#

Evaluates the second derivative with respect to \(u\) at a single \((u,v)\) pair

Parameters:
  • u (float) – Position along \(u\) in parametric space. Normally in the range \([0,1]\)

  • v (float) – Position along \(v\) in parametric space. Normally in the range \([0,1]\)

Returns:

1-D array containing the \(x\)-, \(y\)-, and \(z\)-components of the second derivative

Return type:

np.ndarray

d2Sdu2_grid(Nu: int, Nv: int) ndarray[source]#

Evaluates the second derivative with respect to \(u\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

Parameters:
  • Nu (int) – Number of evenly spaced \(u\) values

  • Nv (int) – Number of evenly spaced \(v\) values

Returns:

Array of size \(N_u \times N_v \times 3\)

Return type:

np.ndarray

d2Sdu2_uvvecs(u: ndarray, v: ndarray)[source]#

Evaluates the second derivative of the surface with respect to \(u\) at arbitrary vectors of \(u\) and \(v\)-values.

Parameters:
  • u (np.ndarray) – 1-D array of \(u\)-parameter values

  • v (np.ndarray) – 1-D array of \(v\)-parameter values

Returns:

Array of size \(\text{len}(u) \times \text{len}(v) \times 3\)

Return type:

np.ndarray

d2Sdv2(u: float, v: float)[source]#

Evaluates the second derivative with respect to \(v\) at a single \((u,v)\) pair

Parameters:
  • u (float) – Position along \(u\) in parametric space. Normally in the range \([0,1]\)

  • v (float) – Position along \(v\) in parametric space. Normally in the range \([0,1]\)

Returns:

1-D array containing the \(x\)-, \(y\)-, and \(z\)-components of the second derivative

Return type:

np.ndarray

d2Sdv2_grid(Nu: int, Nv: int) ndarray[source]#

Evaluates the second derivative with respect to \(v\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

Parameters:
  • Nu (int) – Number of evenly spaced \(u\) values

  • Nv (int) – Number of evenly spaced \(v\) values

Returns:

Array of size \(N_u \times N_v \times 3\)

Return type:

np.ndarray

d2Sdv2_uvvecs(u: ndarray, v: ndarray)[source]#

Evaluates the second derivative of the surface with respect to \(v\) at arbitrary vectors of \(u\) and \(v\)-values.

Parameters:
  • u (np.ndarray) – 1-D array of \(u\)-parameter values

  • v (np.ndarray) – 1-D array of \(v\)-parameter values

Returns:

Array of size \(\text{len}(u) \times \text{len}(v) \times 3\)

Return type:

np.ndarray

dSdu(u: float, v: float) ndarray[source]#

Evaluates the first derivative with respect to \(u\) at a single \((u,v)\) pair

Parameters:
  • u (float) – Position along \(u\) in parametric space. Normally in the range \([0,1]\)

  • v (float) – Position along \(v\) in parametric space. Normally in the range \([0,1]\)

Returns:

1-D array containing the \(x\)-, \(y\)-, and \(z\)-components of the second derivative

Return type:

np.ndarray

dSdu_grid(Nu: int, Nv: int) ndarray[source]#

Evaluates the first derivative with respect to \(u\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

Parameters:
  • Nu (int) – Number of evenly spaced \(u\) values

  • Nv (int) – Number of evenly spaced \(v\) values

Returns:

Array of size \(N_u \times N_v \times 3\)

Return type:

np.ndarray

dSdu_uvvecs(u: ndarray, v: ndarray)[source]#

Evaluates the first derivative of the surface with respect to \(u\) at arbitrary vectors of \(u\) and \(v\)-values.

Parameters:
  • u (np.ndarray) – 1-D array of \(u\)-parameter values

  • v (np.ndarray) – 1-D array of \(v\)-parameter values

Returns:

Array of size \(\text{len}(u) \times \text{len}(v) \times 3\)

Return type:

np.ndarray

dSdv(u: float, v: float)[source]#

Evaluates the first derivative with respect to \(v\) at a single \((u,v)\) pair

Parameters:
  • u (float) – Position along \(u\) in parametric space. Normally in the range \([0,1]\)

  • v (float) – Position along \(v\) in parametric space. Normally in the range \([0,1]\)

Returns:

1-D array containing the \(x\)-, \(y\)-, and \(z\)-components of the second derivative

Return type:

np.ndarray

dSdv_grid(Nu: int, Nv: int) ndarray[source]#

Evaluates the first derivative with respect to \(v\) on a linearly-spaced grid of \(u\)- and \(v\)-values.

Parameters:
  • Nu (int) – Number of evenly spaced \(u\) values

  • Nv (int) – Number of evenly spaced \(v\) values

Returns:

Array of size \(N_u \times N_v \times 3\)

Return type:

np.ndarray

dSdv_uvvecs(u: ndarray, v: ndarray)[source]#

Evaluates the first derivative of the surface with respect to \(v\) at arbitrary vectors of \(u\) and \(v\)-values.

Parameters:
  • u (np.ndarray) – 1-D array of \(u\)-parameter values

  • v (np.ndarray) – 1-D array of \(v\)-parameter values

Returns:

Array of size \(\text{len}(u) \times \text{len}(v) \times 3\)

Return type:

np.ndarray

property degree_u: int#

Surface degree in the \(u\)-parametric direction

property degree_v: int#

Surface degree in the \(v\)-parametric direction

elevate_degree_u() RationalBezierSurface[source]#

Elevates the degree of the rational Bézier surface in the \(u\)-parametric direction.

Returns:

A new rational Bézier surface with identical shape to the current one but with one additional row of control points in the \(u\)-parametric direction

Return type:

RationalBezierSurface

elevate_degree_v() RationalBezierSurface[source]#

Elevates the degree of the rational Bézier surface in the \(v\)-parametric direction.

Returns:

A new rational Bézier surface with identical shape to the current one but with one additional row of control points in the \(v\)-parametric direction

Return type:

RationalBezierSurface

enforce_c0(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#

For zeroth-degree continuity, there is no difference between geometric (\(G^0\)) and parametric (\(C^0\)) continuity. Because this method is simply a convenience method that calls enforce_g0, see the documentation for that method for more detailed documentation.

Parameters:
  • other (RationalBezierSurface) – Another rational Bézier surface along which an edge will be used for stitching

  • surface_edge (SurfaceEdge) – The edge of the current surface to modify

  • other_surface_edge (SurfaceEdge) – Tool edge of surface other which determines the positions of control points along surface_edge of the current surface

enforce_c0c1(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#

Equivalent to calling enforce_g0g1 with f=1.0. See that method for more detailed documentation.

Parameters:
  • other (RationalBezierSurface) – Another rational Bézier surface along which an edge will be used for stitching

  • surface_edge (SurfaceEdge) – The edge of the current surface to modify

  • other_surface_edge (SurfaceEdge) – Tool edge of surface other which determines the positions of control points along surface_edge of the current surface

enforce_c0c1c2(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#

Equivalent to calling enforce_g0g1g2 with f=1.0. See that method for more detailed documentation.

Parameters:
  • other (RationalBezierSurface) – Another rational Bézier surface along which an edge will be used for stitching

  • surface_edge (SurfaceEdge) – The edge of the current surface to modify

  • other_surface_edge (SurfaceEdge) – Tool edge of surface other which determines the positions of control points along surface_edge of the current surface

enforce_g0(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#

Enforces \(G^0\) continuity along the input surface_edge by equating the control points and weights along this edge to the corresponding control points and weights along the other_surface_edge of the rational Bézier surface given by other. The control points of the surface from which this method is called are modified in-place, and the control points of other are left unchanged.

Important

The parallel degree of the current surface along surface_edge must be equal to the parallel degree of the other surface along other_surface_edge, otherwise an AssertionError will be raised. If these degrees are not equal, first elevate the degree of the surface with the lower parallel degree until the degrees match using either elevate_degree_u or elevate_degree_v, whichever is appropriate.

See also

enforce_c0

Parametric continuity equivalent (\(C^0\))

Parameters:
  • other (RationalBezierSurface) – Another rational Bézier surface along which an edge will be used for stitching

  • surface_edge (SurfaceEdge) – The edge of the current surface to modify

  • other_surface_edge (SurfaceEdge) – Tool edge of surface other which determines the positions of control points along surface_edge of the current surface

enforce_g0g1(other: RationalBezierSurface, f: float, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#

First enforces \(G^0\) continuity, then tangent (\(G^1\)) continuity is enforced according to the following equations:

\[\mathcal{W}^{b,\mathcal{E}_b}_{k,1} = \mathcal{W}^{b,\mathcal{E}_b}_{k,0} + f \frac{p_{\perp}^{a,\mathcal{E}_a}}{p_{\perp}^{b,\mathcal{E}_b}} \left( \mathcal{W}^{a,\mathcal{E}_a}_{k,0} - \mathcal{W}^{a,\mathcal{E}_a}_{k,1} \right) \text{ for }k=0,1,\ldots,p_{\parallel}^{b,\mathcal{E}_b}\]
\[\mathcal{P}^{b,\mathcal{E}_b}_{k,1} = \frac{\mathcal{W}^{b,\mathcal{E}_b}_{k,0}}{\mathcal{W}^{b,\mathcal{E}_b}_{k,1}} \mathcal{P}^{b,\mathcal{E}_b}_{k,0} + f \frac{p_{\perp}^{a,\mathcal{E}_a}}{p_{\perp}^{b,\mathcal{E}_b}} \frac{1}{\mathcal{W}^{b,\mathcal{E}_b}_{k,1}} \left[\mathcal{W}^{a,\mathcal{E}_a}_{k,0} \mathcal{P}^{a,\mathcal{E}_a}_{k,0} - \mathcal{P}^{a,\mathcal{E}_a}_{k,1} \mathcal{W}^{a,\mathcal{E}_a}_{k,1} \right] \text{ for }k=0,1,\ldots,p_{\parallel}^{b,\mathcal{E}_b}\]

Here, \(b\) corresponds to the current surface, and \(a\) corresponds to the other surface. The control points of the surface from which this method is called are modified in-place, and the control points of other are left unchanged.

See also

enforce_g0

Geometric point continuity enforcement (\(G^0\))

enforce_c0c1

Parametric continuity equivalent (\(C^1\))

Parameters:
  • other (RationalBezierSurface) – Another rational Bézier surface along which an edge will be used for stitching

  • f (float) – Tangent proportionality factor

  • surface_edge (SurfaceEdge) – The edge of the current surface to modify

  • other_surface_edge (SurfaceEdge) – Tool edge of surface other which determines the positions of control points along surface_edge of the current surface

enforce_g0g1g2(other: RationalBezierSurface, f: float, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#

First enforces \(G^0\) and \(G^1\) continuity, then curvature (\(G^2\)) continuity is enforced according to the following equations:

\[\mathcal{W}^{b,\mathcal{E}_b}_{k,2} = 2 \mathcal{W}^{b,\mathcal{E}_b}_{k,1} - \mathcal{W}^{b,\mathcal{E}_b}_{k,0} + f^2 \frac{p_{\perp}^{a,\mathcal{E}_a}(p_{\perp}^{a,\mathcal{E}_a}-1)}{p_{\perp}^{b,\mathcal{E}_b}(p_{\perp}^{b,\mathcal{E}_b}-1)} \left[ \mathcal{W}^{a,\mathcal{E}_a}_{k,0} - 2 \mathcal{W}^{a,\mathcal{E}_a}_{k,1} + \mathcal{W}^{a,\mathcal{E}_a}_{k,2} \right] \text{ for }k=0,1,\ldots,p_{\parallel}^{b,\mathcal{E}_b}\]
\[\mathcal{P}^{b,\mathcal{E}_b}_{k,2} = 2 \frac{\mathcal{W}^{b,\mathcal{E}_b}_{k,1}}{\mathcal{W}^{b,\mathcal{E}_b}_{k,2}} \mathcal{P}^{b,\mathcal{E}_b}_{k,1} - \frac{\mathcal{W}^{b,\mathcal{E}_b}_{k,0}}{\mathcal{W}^{b,\mathcal{E}_b}_{k,2}} \mathcal{P}^{b,\mathcal{E}_b}_{k,0} + f^2 \frac{p_{\perp}^{a,\mathcal{E}_a}(p_{\perp}^{a,\mathcal{E}_a}-1)}{p_{\perp}^{b,\mathcal{E}_b}(p_{\perp}^{b,\mathcal{E}_b}-1)} \frac{1}{\mathcal{W}^{b,\mathcal{E}_b}_{k,2}} \left[ \mathcal{W}^{a,\mathcal{E}_a}_{k,1} \mathcal{P}^{a,\mathcal{E}_a}_{k,0} - 2 \mathcal{W}^{a,\mathcal{E}_a}_{k,1} \mathcal{P}^{a,\mathcal{E}_a}_{k,1} + \mathcal{W}^{a,\mathcal{E}_a}_{k,2} \mathcal{P}^{a,\mathcal{E}_a}_{k,2} \right] \text{ for }k=0,1,\ldots,p_{\parallel}^{b,\mathcal{E}_b}\]

Here, \(b\) corresponds to the current surface, and \(a\) corresponds to the other surface. The control points of the surface from which this method is called are modified in-place, and the control points of other are left unchanged.

See also

enforce_g0

Geometric point continuity enforcement (\(G^0\))

enforce_g0g1

Geometric tangent continuity enforcement (\(G^1\))

enforce_c0c1c2

Parametric continuity equivalent (\(C^2\))

Parameters:
  • other (RationalBezierSurface) – Another rational Bézier surface along which an edge will be used for stitching

  • f (float) – Tangent proportionality factor

  • surface_edge (SurfaceEdge) – The edge of the current surface to modify

  • other_surface_edge (SurfaceEdge) – Tool edge of surface other which determines the positions of control points along surface_edge of the current surface

enforce_g0g1g2_multiface(adjacent_surf_u0: RationalBezierSurface = None, adjacent_surf_u1: RationalBezierSurface = None, adjacent_surf_v0: RationalBezierSurface = None, adjacent_surf_v1: RationalBezierSurface = None, other_edge_u0: SurfaceEdge = None, other_edge_u1: SurfaceEdge = None, other_edge_v0: SurfaceEdge = None, other_edge_v1: SurfaceEdge = None, f_u0_initial: float = 1.0, f_u1_initial: float = 1.0, f_v0_initial: float = 1.0, f_v1_initial: float = 1.0, n_deriv_points: int = 10) OptimizeResult[source]#

Warning

This is an experimental feature and should not be used in production geometries

Enforces \(G^0\), \(G^1\), and \(G^2\) continuity across multiple adjacent boundaries of a surface, up to all four boundaries. This is done by first enforcing \(G^0\) continuity at all required boundaries and then optimizing the locations of the second and third rows of control points to minimize \(G^1\) and \(G^2\) error at n_deriv_points locations along each of the boundary curves. The following is the cost function that is minimized:

\[J(x_k) = \sum\limits_{l=1}^2 \sum\limits_{i=0}^{n_p n_{\mathcal{E}}} \left( \left. \frac{\partial^l \mathbf{S}_i^a(u,v)}{\partial \mu^l} \right|_{u=u_i,v=v_i} - \frac{f_{\text{sgn},i}}{f^l_i(x_k)} \left. \frac{\partial^l \mathbf{S}^b(u,v,x_k)}{\partial \mu^l} \right|_{u=u_i,v=v_i} \right)^2\]

where

  • \(x_k\) is the set of design variables to be optimized including the internal control point locations and tangent proportionality factors across each boundary

  • \(n_p\) is the number of discrete derivative calculations on each boundary (specified by n_deriv_points)

  • \(n_\mathcal{E}\) is the number of edges across which continuity is being enforced

  • \(\mathbf{S}_i^a(u,v)\) is a surface specified by adjacent_surf_u0, etc.

  • \(\mu\) is equal to either \(u\) or \(v\), determined by the parametric direction perpendicular to the edge

  • \((u_i,v_i)\) is the point along an edge where the derivative is being evaluated

  • \(f_{\text{sgn},i}\) is the sign of the proportionality factor, \(-1\) if both the target edge and other edge specified by \(i\) end in \(0\) or both end in \(1\), \(1\) otherwise

  • \(f_i(x_k)\) is the tangent proportionality factor

  • \(\mathbf{S}^b(u,v,x_k)\) is the target surface (self)

  • \(l\) is the derivative order

For maximum performance of the optimizer, the exact Jacobian is calculated:

\[\frac{\partial J(x_k)}{\partial x_k} = 2 \sum\limits_{l=1}^2 \sum\limits_{i=0}^{n_p n_{\mathcal{E}}} \left( \left. \frac{\partial^l \mathbf{S}_i^a(u,v)}{\partial \mu^l} \right|_{u=u_i,v=v_i} - \frac{f_{\text{sgn},i}}{f^l_i(x_k)} \left. \frac{\partial^l \mathbf{S}^b(u,v,x_k)}{\partial \mu^l} \right|_{u=u_i,v=v_i} \right) \left[ -f_{\text{sgn},i} \frac{\partial}{\partial x_k} \left( \frac{1}{f^l_i} \right) \left( \left. \frac{\partial^l \mathbf{S}^b(u,v,x_k)}{\partial \mu^l} \right|_{u=u_i,v=v_i} \right) -\frac{f_{\text{sgn},i}}{f_i^l} \frac{\partial}{\partial x_k} \left( \left. \frac{\partial^l \mathbf{S}^b(u,v,x_k)}{\partial \mu^l} \right|_{u=u_i,v=v_i} \right) \right]\]

Note

This method is reserved for the complex case where continuity is required across boundaries that share a surface corner. In the case of continuity with a single surface or a pair of surfaces with common boundaries on opposite sides of the surface (such as the \(v_0\) and \(v_1\) boundaries), the much simpler enforce_g0g1g2 should be used.

images/bezier_enforce_g0g1g2_multiface.*

Multi-face \(G^0\), \(G^1\), and \(G^2\) continuity enforcement#

Parameters:
  • adjacent_surf_u0 (BezierSurface) – Surface sharing the \(u_0\) boundary of target_surf. Default: None

  • adjacent_surf_u1 (BezierSurface) – Surface sharing the \(u_1\) boundary of target_surf. Default: None

  • adjacent_surf_v0 (BezierSurface) – Surface sharing the \(v_0\) boundary of target_surf. Default: None

  • adjacent_surf_v1 (BezierSurface) – Surface sharing the \(v_1\) boundary of target_surf. Default: None

  • other_edge_u0 (SurfaceEdge) – Edge of surface adjacent_surf_u0 that will be stitched. Default: None

  • other_edge_u1 (SurfaceEdge) – Edge of surface adjacent_surf_u0 that will be stitched. Default: None

  • other_edge_v0 (SurfaceEdge) – Edge of surface adjacent_surf_u0 that will be stitched. Default: None

  • other_edge_v1 (SurfaceEdge) – Edge of surface adjacent_surf_u0 that will be stitched. Default: None

  • f_u0_initial (float) – Initial value of the tangent proportionality factor across boundary \(u_0\). The final value selected by the optimizer will be different from this value. Default: 1.0

  • f_u1_initial (float) – Initial value of the tangent proportionality factor across boundary \(u_1\). The final value selected by the optimizer will be different from this value. Default: 1.0

  • f_v0_initial (float) – Initial value of the tangent proportionality factor across boundary \(v_0\). The final value selected by the optimizer will be different from this value. Default: 1.0

  • f_v1_initial (float) – Initial value of the tangent proportionality factor across boundary \(v_1\). The final value selected by the optimizer will be different from this value. Default: 1.0

  • n_deriv_points (int) – Number of discrete locations where the continuity error will be evaluated. Default: 10

Returns:

Result from the \(G^1\)- and \(G^2\)-continuity error minimization problem solution

Return type:

OptimizeResult

evaluate(u: float, v: float) ndarray[source]#

Evaluates the surface at a given \((u,v)\) parameter pair.

Parameters:
  • u (float) – Position along \(u\) in parametric space. Normally in the range \([0,1]\)

  • v (float) – Position along \(v\) in parametric space. Normally in the range \([0,1]\)

Returns:

1-D array of the form array([x, y, z]) representing the evaluated point on the surface

Return type:

numpy.ndarray

evaluate_grid(Nu: int, Nv: int) ndarray[source]#

Evaluates the rational Bézier surface on a uniform \(N_u \times N_v\) grid of parameter values.

Parameters:
  • Nu (int) – Number of uniformly spaced parameter values in the \(u\)-direction

  • Nv (int) – Number of uniformly spaced parameter values in the \(v\)-direction

Returns:

Array of size \(N_u \times N_v \times 3\)

Return type:

numpy.ndarray

evaluate_point3d(u: float, v: float) Point3D[source]#

Evaluates the rational Bézier surface at a single \((u,v)\) parameter pair and returns a point object.

Parameters:
  • u (float) – Position along \(u\) in parametric space. Normally in the range \([0,1]\)

  • v (float) – Position along \(v\) in parametric space. Normally in the range \([0,1]\)

Returns:

Point object corresponding to the \((u,v)\) pair

Return type:

Point3D

extract_edge_curve(surface_edge: SurfaceEdge) RationalBezierCurve3D[source]#

Extracts the control points and weights from one of the four edges of the rational Bézier surface and outputs a rational Bézier curve with these control points and weights

Parameters:

surface_edge (SurfaceEdge) – Edge along which to extract the curve

Returns:

Rational Bézier curve with control points corresponding to the control points along the edge of the surface

Return type:

RationalBezierCurve3D

static fill_surface_from_four_boundaries(left_curve: BezierCurve3D, right_curve: BezierCurve3D, top_curve: BezierCurve3D, bottom_curve: BezierCurve3D, displacement_degree: int = 3) RationalBezierSurface[source]#

Creates a fill surface from four boundary curves by linearly interpolating the left_curve and right_curve and displacing the edges created by the interpolation to form the top_curve and bottom_curve boundaries.

../_images/fill_surface.png

Fill surface from four curve boundaries

Warning

While this method works for non-planar sets of boundary curves, the primary intended use is for co-planar boundary curves. Undesirable surface shapes may result if using non-planar curves.

Parameters:
Returns:

Fill surface

Return type:

RationalBezierSurface

classmethod from_bezier_revolve(bezier: BezierCurve3D, axis: Line3D, start_angle: Angle, end_angle: Angle)[source]#

Creates a rational Bézier surface from the revolution of a Bézier curve about an axis.

Parameters:
  • bezier (BezierCurve3D) – Bézier curve to revolve

  • axis (Line3D) – Axis of revolution

  • start_angle (Angle) – Starting angle for the revolve

  • end_angle (Angle) – Ending angle for the revolve

Returns:

Surface of revolution

Return type:

RationalBezierSurface

generate_control_point_net()[source]#

Generates a list of Point3D and Line3D objects representing the rational Bézier surface’s control points and connections between them

Returns:

Control points and lines between adjacent control points in flattened lists

Return type:

List[Point3D], List[Line3D]

get_control_point_array() ndarray[source]#

Converts the nested list of control points to a 3-D ndarray.

Returns:

3-D array

Return type:

numpy.ndarray

get_corner_index(surface_corner: ~aerocaps.geom.surfaces.SurfaceCorner) -> (<class 'int'>, <class 'int'>)[source]#

Gets the \(i\)- and \(j\)-indices of the control point corresponding to the input corner

Parameters:

surface_corner (SurfaceCorner) – Corner from which to retrieve the index

Returns:

\(i\)-index and \(j\)-index, respectively

Return type:

int, int

get_edge(edge: SurfaceEdge, n_points: int = 10) ndarray[source]#

Evaluates the surface at n_points parameter locations along a given edge.

Parameters:
  • edge (SurfaceEdge) – Edge along which to evaluate

  • n_points (int) – Number of evenly-spaced parameter locations at which to evaluate the edge curve. Default: 10

Returns:

2-D array of size \(n_\text{points} \times 3\)

Return type:

numpy.ndarray

get_first_deriv_cp_sens_along_edge(edge: SurfaceEdge, i: int, j: int, n_points: int = 10, perp: bool = True) ndarray[source]#

Gets the sensitivity of the first \(u\)- or \(v\)-derivative along an edge with respect to control point \(\mathbf{P}_{i,j}\)

Parameters:
  • edge (SurfaceEdge) – Edge along which to evaluate

  • i (int) – \(i\)-index of the control point

  • j (int) – \(j\)-index of the control point

  • n_points (int) – Number of evenly-spaced parameter locations at which to evaluate the derivative. Default: 10

  • perp (bool) – Whether to evaluate the cross-derivative. If False, the derivative along the parameter direction parallel to the edge will be evaluated instead. Default: True

Returns:

2-D array of size \(n_\text{points} \times 3\)

Return type:

numpy.ndarray

get_first_derivs_along_edge(edge: SurfaceEdge, n_points: int = 10, perp: bool = True) ndarray[source]#

Evaluates the parallel or perpendicular derivative along a surface edge at n_points parameter locations. The derivative represents either \(\frac{\partial \mathbf{S}(u,v)}{\partial u}\) or \(\frac{\partial \mathbf{S}(u,v)}{\partial v}\) depending on which edge is selected and which value is assigned to perp.

Parameters:
  • edge (SurfaceEdge) – Edge along which to evaluate

  • n_points (int) – Number of evenly-spaced parameter locations at which to evaluate the derivative. Default: 10

  • perp (bool) – Whether to evaluate the cross-derivative. If False, the derivative along the parameter direction parallel to the edge will be evaluated instead. Default: True

Returns:

2-D array of size \(n_\text{points} \times 3\)

Return type:

numpy.ndarray

get_homogeneous_control_points() ndarray[source]#

Gets the array of control points in homogeneous coordinates, \(\mathbf{P}_{i,j} \cdot w_{i,j}\)

Returns:

Array of size \((n + 1) \times (m + 1) \times 4\), where \(n\) is the surface degree in the \(u\)-direction and \(m\) is the surface degree in the \(v\)-direction. The four elements of the last array dimension are, in order, the \(x\)-coordinate, \(y\)-coordinate, \(z\)-coordinate, and weight of each control point.

Return type:

numpy.ndarray

get_parallel_degree(surface_edge: SurfaceEdge)[source]#

Gets the degree of the curve corresponding to the input surface edge.

Parameters:

surface_edge (SurfaceEdge) – Edge along which the parallel degree is evaluated

Returns:

Degree parallel to the edge

Return type:

int

get_parallel_n_points(surface_edge: SurfaceEdge) int[source]#

Gets the number of control points in the parametric direction parallel to the input surface edge.

Parameters:

surface_edge (SurfaceEdge) – Edge along which the parallel number of control points is evaluated

Returns:

Number of control points parallel to the edge

Return type:

int

get_perpendicular_degree(surface_edge: SurfaceEdge)[source]#

Gets the degree of the curve in the parametric direction perpendicular to the input surface edge.

Parameters:

surface_edge (SurfaceEdge) – Edge along which the perpendicular degree is evaluated

Returns:

Degree perpendicular to the edge

Return type:

int

get_perpendicular_n_points(surface_edge: SurfaceEdge) int[source]#

Gets the number of control points in the parametric direction perpendicular to the input surface edge.

Parameters:

surface_edge (SurfaceEdge) – Edge along which the perpendicular number of control points is evaluated

Returns:

Number of control points perpendicular to the edge

Return type:

int

get_point(row_index: int, continuity_index: int, surface_edge: SurfaceEdge)[source]#

Gets the point corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied. For example, for a \(6 \times 5\) rational Bézier surface, the following code

p = surf.get_point(2, 1, ac.SurfaceEdge.v0)

returns the point \(\mathbf{P}_{2,1}\) and

p = surf.get_point(2, 1, ac.SurfaceEdge.u1)

returns the point \(\mathbf{P}_{6-1,2} = \mathbf{P}_{5,2}\).

See also

set_point

Setter equivalent of this method

Parameters:
  • row_index (int) – Index along the surface edge control points

  • continuity_index (int) – Index in the parametric direction perpendicular to the surface edge. Normally either 0, 1, or 2

  • surface_edge (SurfaceEdge) – Edge of the surface along which to retrieve the control point

Returns:

Point used to enforce \(G^x\) continuity, where \(x\) is the value of continuity_index

Return type:

Point3D

get_point_ij(row_index: int, continuity_index: int, surface_edge: ~aerocaps.geom.surfaces.SurfaceEdge) -> (<class 'int'>, <class 'int'>)[source]#

Gets the point indices corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied.

Parameters:
  • row_index (int) – Index along the surface edge control points

  • continuity_index (int) – Index in the parametric direction perpendicular to the surface edge. Normally either 0, 1, or 2

  • surface_edge (SurfaceEdge) – Edge of the surface along which to retrieve the control point

Returns:

Point indices used to enforce \(G^x\) continuity, where \(x\) is the value of continuity_index

Return type:

int, int

get_second_deriv_cp_sens_along_edge(edge: SurfaceEdge, i: int, j: int, n_points: int = 10, perp: bool = True) ndarray[source]#

Gets the sensitivity of the second \(u\)- or \(v\)-derivative along an edge with respect to control point \(\mathbf{P}_{i,j}\)

Parameters:
  • edge (SurfaceEdge) – Edge along which to evaluate

  • i (int) – \(i\)-index of the control point

  • j (int) – \(j\)-index of the control point

  • n_points (int) – Number of evenly-spaced parameter locations at which to evaluate the derivative. Default: 10

  • perp (bool) – Whether to evaluate the cross-derivative. If False, the derivative along the parameter direction parallel to the edge will be evaluated instead. Default: True

Returns:

2-D array of size \(n_\text{points} \times 3\)

Return type:

numpy.ndarray

get_second_derivs_along_edge(edge: SurfaceEdge, n_points: int = 10, perp: bool = True) ndarray[source]#

Evaluates the parallel or perpendicular second derivative along a surface edge at n_points parameter locations. The derivative represents either \(\frac{\partial^2 \mathbf{S}(u,v)}{\partial u^2}\) or \(\frac{\partial^2 \mathbf{S}(u,v)}{\partial v^2}\) depending on which edge is selected and which value is assigned to perp.

Parameters:
  • edge (SurfaceEdge) – Edge along which to evaluate

  • n_points (int) – Number of evenly-spaced parameter locations at which to evaluate the second derivative. Default: 10

  • perp (bool) – Whether to evaluate the cross-derivative. If False, the second derivative along the parameter direction parallel to the edge will be evaluated instead. Default: True

Returns:

2-D array of size \(n_\text{points} \times 3\)

Return type:

numpy.ndarray

get_u_or_v_given_uvxyz(u: float = None, v: float = None, uv_guess: float = 0.5, x: Length = None, y: Length = None, z: Length = None)[source]#

Computes one parametric value given the other and a specified \(x\)-, \(y\)-, or \(z\)-location. As an example, given a RationalBezierSurface object assigned to the variable surf, the \(u\)-parameter corresponding to \(y=1.4\) along the \(v=0.8\) isoparametric curve can be computed using

u = surf.get_u_or_v_given_uvxyz(v=0.8, y=1.4)

Note that the inputs are keyword arguments to avoid having to specify None for each of the arguments not used.

Parameters:
  • u (float or None) – Value of \(u\) to solve for or specify. If left as None, this parameter will be solved for. If None, \(v\) must be specified. Default: None

  • v (float or None) – Value of \(v\) to solve for or specify. If left as None, this parameter will be solved for. If None, \(u\) must be specified. Default: None

  • uv_guess (float) – Starting guess for the unsolved \(u\) or \(v\) parameter. Default: 0.5

  • x (Length or None) – \(x\)-location corresponding to the \(u\) or \(v\) parameter to be solved. If this value is outside the surface geometry, the root-finder will fail and an error will be raised. If unspecified, either \(y\) or \(z\) must be specified. Default: None

  • y (Length or None) – \(y\)-location corresponding to the \(u\) or \(v\) parameter to be solved. If this value is outside the surface geometry, the root-finder will fail and an error will be raised. If unspecified, either \(x\) or \(z\) must be specified. Default: None

  • z (Length or None) – \(z\)-location corresponding to the \(u\) or \(v\) parameter to be solved. If this value is outside the surface geometry, the root-finder will fail and an error will be raised. If unspecified, either \(x\) or \(y\) must be specified. Default: None

Returns:

The value of \(u\) if \(v\) is specified or \(v\) if \(u\) is specified

Return type:

float

get_weight(row_index: int, continuity_index: int, surface_edge: SurfaceEdge) float[source]#

Gets the weight corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied. For example, for a \(6 \times 5\) rational Bézier surface, the following code

w = surf.get_weight(2, 1, ac.SurfaceEdge.v0)

returns the weight \(w_{2,1}\) and

w = surf.get_weight(2, 1, ac.SurfaceEdge.u1)

returns the weight \(w_{6-1,2} = w_{5,2}\).

See also

set_weight

Setter equivalent of this method

Parameters:
  • row_index (int) – Index along the surface edge weights

  • continuity_index (int) – Index in the parametric direction perpendicular to the surface edge. Normally either 0, 1, or 2

  • surface_edge (SurfaceEdge) – Edge of the surface along which to retrieve the weight

Returns:

Weight used to enforce \(G^x\) continuity, where \(x\) is the value of continuity_index

Return type:

float

property knots_u: ndarray#

Knots in the \(u\)-direction

property knots_v: ndarray#

Knots in the \(v\)-direction

property m: int#

Shorthand for degree_v

Returns:

Surface degree in the \(v\)-parametric direction

Return type:

int

property n: int#

Shorthand for degree_u

Returns:

Surface degree in the \(u\)-parametric direction

Return type:

int

property n_points_u: int#

Number of control points in the \(u\)-parametric direction

property n_points_v: int#

Number of control points in the \(v\)-parametric direction

plot_control_point_mesh_lines(plot: Plotter, **line_kwargs) Actor[source]#

Plots the network of lines connecting the rational Bézier surface control points using the pyvista library

Parameters:
Returns:

The lines actor

Return type:

pv.Actor

plot_control_points(plot: Plotter, **point_kwargs) Actor[source]#

Plots the rational Bézier surface control points using the pyvista library

Parameters:
Returns:

The points actor

Return type:

pv.Actor

plot_surface(plot: Plotter, Nu: int = 50, Nv: int = 50, **mesh_kwargs)[source]#

Plots the rational Bézier surface using the pyvista library

Parameters:
  • plotpyvista.Plotter instance

  • Nu (int) – Number of points to evaluate in the \(u\)-parametric direction. Default: 50

  • Nv (int) – Number of points to evaluate in the \(v\)-parametric direction. Default: 50

  • mesh_kwargs – Keyword arguments to pass to pyvista.Plotter.add_mesh

Returns:

The evaluated rational Bézier surface

Return type:

pyvista.core.pointset.StructuredGrid

static project_homogeneous_control_points(homogeneous_points: ~numpy.ndarray) -> (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>)[source]#

Projects the homogeneous coordinates onto the \(w=1\) hyperplane.

Returns:

The projected coordinates in three-dimensional space followed by the weight array

Return type:

numpy.ndarray, numpy.ndarray

reverse_u() RationalBezierSurface[source]#

Reverses the surface in the \(u\)-direction

reverse_v() RationalBezierSurface[source]#

Reverses the surface in the \(v\)-direction

set_point(point: Point3D, row_index: int, continuity_index: int, surface_edge: SurfaceEdge)[source]#

Sets the point corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied. For example, for a \(6 \times 5\) rational Bézier surface, the following code

p = ac.Point3D.from_array(np.array([3.0, 4.0, 5.0]))
surf.set_point(p, 2, 1, ac.SurfaceEdge.v0)

sets the value of point \(\mathbf{P}_{2,1}\) to \([3,4,5]^T\) and

p = ac.Point3D.from_array(np.array([3.0, 4.0, 5.0]))
surf.set_point(p, 2, 1, ac.SurfaceEdge.u1)

sets the value of point \(\mathbf{P}_{6-1,2} = \mathbf{P}_{5,2}\) to \([3,4,5]^T\).

See also

get_point

Getter equivalent of this method

Parameters:
  • point (Point3D) – Point object to apply at the specified indices

  • row_index (int) – Index along the surface edge control points

  • continuity_index (int) – Index in the parametric direction perpendicular to the surface edge. Normally either 0, 1, or 2

  • surface_edge (SurfaceEdge) – Edge of the surface along which to retrieve the control point

set_weight(weight: float, row_index: int, continuity_index: int, surface_edge: SurfaceEdge)[source]#

Sets the weight corresponding to a particular index along the edge curve with perpendicular index corresponding to the level of continuity being applied. For example, for a \(6 \times 5\) rational Bézier surface, the following code

surf.set_weight(0.9, 2, 1, ac.SurfaceEdge.v0)

sets the value of weight \(w_{2,1}\) to \(0.9\) and

surf.set_weight(1.1, 2, 1, ac.SurfaceEdge.u1)

sets the value of weight \(w_{6-1,2} = w_{5,2}\) to \(1.1\).

See also

get_weight

Getter equivalent of this method

Parameters:
  • weight (float) – Weight to apply at the specified indices

  • row_index (int) – Index along the surface edge weights

  • continuity_index (int) – Index in the parametric direction perpendicular to the surface edge. Normally either 0, 1, or 2

  • surface_edge (SurfaceEdge) – Edge of the surface along which to retrieve the weight

split_at_u(u0: float)[source]#

Splits the rational Bezier surface at \(u=u_0\) along the \(v\)-parametric direction.

split_at_v(v0: float)[source]#

Splits the rational Bezier surface at \(v=v_0\) along the \(u\)-parametric direction.

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.

transform(**transformation_kwargs) RationalBezierSurface[source]#

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

Parameters:

transformation_kwargs – Keyword arguments passed to Transformation3D

Returns:

Transformed surface

Return type:

RationalBezierSurface

verify_g0(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge, n_points: int = 10)[source]#

Verifies that two RationalBezierSurfaces are G0 continuous along their shared edge

verify_g1(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge, n_points: int = 10)[source]#

Verifies that two RationalBezierSurfaces are G1 continuous along their shared edge

verify_g2(other: RationalBezierSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge, n_points: int = 10)[source]#

Verifies that two RationalBezierSurfaces are G2 continuous along their shared edge