aerocaps.geom.surfaces.NURBSSurface#
- class NURBSSurface(points: List[List[Point3D]], knots_u: ndarray, knots_v: ndarray, weights: ndarray, name: str = 'NURBSSurface', construction: bool = False)[source]#
Bases:
SurfaceNURBS surface class
- __init__(points: List[List[Point3D]], knots_u: ndarray, knots_v: ndarray, weights: ndarray, name: str = 'NURBSSurface', construction: bool = False)[source]#
- Parameters:
points
knots_u
knots_v
weights
name (str) – Name of the geometric object. May be re-assigned a unique name when added to a
GeometryContainer. Default: ‘NURBSSurface’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.
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_g0g1withf=1.0.enforce_c0c1c2(other, surface_edge, ...)Equivalent to calling
enforce_g0g1g2withf=1.0.enforce_g0(other, surface_edge, ...)Enforces \(G^0\) continuity along the input
surface_edgeby equating the control points and weights along this edge to the corresponding control points and weights along theother_surface_edgeof the NURBS surface given byother.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:
evaluate(u, v)Evaluates the surface at a given \((u,v)\) parameter pair.
evaluate_grid(Nu, Nv)Evaluates the NURBS surface on a uniform \(N_u \times N_v\) grid of parameter values.
evaluate_point3d(u, v)Evaluates the NURBS surface at a single \((u,v)\) parameter pair and returns a point object.
extract_edge_curve(surface_edge)Extracts the control points, weights, and knots from one of the four edges of the NURBS surface and outputs a NURBS curve with these control points and weights
from_bezier_revolve(bezier, axis, ...)Creates a NURBS surface from the revolution of a Bézier curve about an axis.
Generates a list of
Point3DandLine3Dobjects representing the NURBS surface's control points and connections between themGets the control points in float array form.
get_edge(edge[, n_points])Evaluates the surface at
n_pointsparameter locations along a given edge.get_first_derivs_along_edge(edge[, ...])Evaluates the parallel or perpendicular derivative along a surface edge at
n_pointsparameter locations.Gets the array of control points in homogeneous coordinates, \(\mathbf{P}_{i,j} \cdot w_{i,j}\)
get_parallel_control_point_length(surface_edge)Gets the number of control points of the curve corresponding to the input surface edge.
get_parallel_degree(surface_edge)Gets the degree of the curve corresponding to the input surface edge.
get_parallel_knots(surface_edge)Gets the knots in the parametric direction parallel to the input surface edge.
Gets the number of control points in the parametric direction perpendicular 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_knots(surface_edge)Gets the knots 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_second_derivs_along_edge(edge[, ...])Evaluates the parallel or perpendicular second derivative along a surface edge at
n_pointsparameter 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.
has_internal_knots(direction)Whether the surface has internal knots in the specified direction
is_clamped(surface_edge)Checks if the NURBS surface is clamped along an edge
plot_control_point_mesh_lines(plot, ...)Plots the network of lines connecting the NURBS surface control points using the pyvista library
plot_control_points(plot, **point_kwargs)plot_surface(plot[, Nu, Nv])Projects the homogeneous coordinates onto the \(w=1\) hyperplane.
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 NURBS surface at \(u=u_0\) along the \(v\)-parametric direction.
split_at_v(v0)Splits the NURBS surface at \(v=v_0\) along the \(u\)-parametric direction.
to_iges(*args, **kwargs)Exports the NURBS surface 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 NURBS Surfaces are G0 continuous along their shared edge
verify_g1(other, surface_edge, ...[, n_points])Verifies that two NURBSSurfaces are G1 continuous along their shared edge
verify_g2(other, surface_edge, ...[, n_points])Verifies that two NURBSSurfaces are G2 continuous along their shared edge
Attributes
Surface degree in the \(u\)-parametric direction
Surface degree in the \(v\)-parametric direction
Shorthand for
degree_vShorthand for
degree_uNumber of control points in the \(u\)-parametric direction
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:
- 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.
- 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:
- 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.
- 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:
- 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.
- 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:
- 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.
- 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
- enforce_c0(other: NURBSSurface, 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 (NURBSSurface) – Another NURBS 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
otherwhich determines the positions of control points alongsurface_edgeof the current surface
- enforce_c0c1(other: NURBSSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#
Equivalent to calling
enforce_g0g1withf=1.0. See that method for more detailed documentation.- Parameters:
other (NURBSSurface) – Another NURBS 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
otherwhich determines the positions of control points alongsurface_edgeof the current surface
- enforce_c0c1c2(other: NURBSSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#
Equivalent to calling
enforce_g0g1g2withf=1.0. See that method for more detailed documentation.- Parameters:
other (NURBSSurface) – Another NURBS 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
otherwhich determines the positions of control points alongsurface_edgeof the current surface
- enforce_g0(other: NURBSSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge)[source]#
Enforces \(G^0\) continuity along the input
surface_edgeby equating the control points and weights along this edge to the corresponding control points and weights along theother_surface_edgeof the NURBS surface given byother. The control points of the surface from which this method is called are modified in-place, and the control points ofotherare left unchanged.Important
The parallel degree of the current surface along
surface_edgemust be equal to the parallel degree of theothersurface alongother_surface_edge, otherwise anAssertionErrorwill be raised. Additionally, the knot vector along thesurface_edgeof the current surface must be equal to the knot vector along theother_surface_edgeof the other surface.See also
enforce_c0Parametric continuity equivalent (\(C^0\))
- Parameters:
other (NURBSSurface) – Another NURBS 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
otherwhich determines the positions of control points alongsurface_edgeof the current surface
- enforce_g0g1(other: NURBSSurface, 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
othersurface. The control points of the surface from which this method is called are modified in-place, and the control points ofotherare left unchanged.See also
enforce_g0Geometric point continuity enforcement (\(G^0\))
enforce_c0c1Parametric continuity equivalent (\(C^1\))
- Parameters:
other (NURBSSurface) – Another NURBS 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
otherwhich determines the positions of control points alongsurface_edgeof the current surface
- enforce_g0g1g2(other: NURBSSurface, 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
othersurface. The control points of the surface from which this method is called are modified in-place, and the control points ofotherare left unchanged.See also
enforce_g0Geometric point continuity enforcement (\(G^0\))
enforce_g0g1Geometric tangent continuity enforcement (\(G^1\))
enforce_c0c1c2Parametric continuity equivalent (\(C^2\))
- Parameters:
other (NURBSSurface) – Another NURBS 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
otherwhich determines the positions of control points alongsurface_edgeof the current surface
- evaluate(u: float, v: float) ndarray[source]#
Evaluates the surface at a given \((u,v)\) parameter pair.
- Parameters:
- Returns:
1-D array of the form
array([x, y, z])representing the evaluated point on the surface- Return type:
- evaluate_grid(Nu: int, Nv: int) ndarray[source]#
Evaluates the NURBS surface on a uniform \(N_u \times N_v\) grid of parameter values.
- Parameters:
- Returns:
Array of size \(N_u \times N_v \times 3\)
- Return type:
- evaluate_point3d(u: float, v: float) Point3D[source]#
Evaluates the NURBS surface at a single \((u,v)\) parameter pair and returns a point object.
- extract_edge_curve(surface_edge: SurfaceEdge) NURBSCurve3D[source]#
Extracts the control points, weights, and knots from one of the four edges of the NURBS surface and outputs a NURBS curve with these control points and weights
- Parameters:
surface_edge (SurfaceEdge) – Edge along which to extract the curve
- Returns:
NURBS curve with control points, weights, and knots corresponding to the control points, weights, and knots along the edge of the surface
- Return type:
- classmethod from_bezier_revolve(bezier: BezierCurve3D, axis: Line3D, start_angle: Angle, end_angle: Angle) NURBSSurface[source]#
Creates a NURBS 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:
- generate_control_point_net()[source]#
Generates a list of
Point3DandLine3Dobjects representing the NURBS surface’s control points and connections between them
- get_control_point_array() ndarray[source]#
Gets the control points in float array form.
- Returns:
Array of size \(N_u \times N_v \times 3\)
- Return type:
- get_edge(edge: SurfaceEdge, n_points: int = 10) ndarray[source]#
Evaluates the surface at
n_pointsparameter 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:
- 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_pointsparameter 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 toperp.- 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:
- 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_u \times N_v \times 4\). 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:
- get_parallel_control_point_length(surface_edge: SurfaceEdge) int[source]#
Gets the number of control points of the curve corresponding to the input surface edge.
- Parameters:
surface_edge (SurfaceEdge) – Edge along which the number of control points is computed
- Returns:
Number of control points parallel to the edge
- Return type:
- get_parallel_degree(surface_edge: SurfaceEdge) int[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:
- get_parallel_knots(surface_edge: SurfaceEdge) ndarray[source]#
Gets the knots in the parametric direction parallel to the input surface edge.
- Parameters:
surface_edge (SurfaceEdge) – Edge along which the parallel knots are returned
- Returns:
Knots parallel to the edge
- Return type:
- get_perpendicular_control_point_length(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 number of perpendicular control points is computed
- Returns:
Number of control points perpendicular to the edge
- Return type:
- get_perpendicular_degree(surface_edge: SurfaceEdge) int[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:
- get_perpendicular_knots(surface_edge: SurfaceEdge) ndarray[source]#
Gets the knots in the parametric direction perpendicular to the input surface edge.
- Parameters:
surface_edge (SurfaceEdge) – Edge along which the perpendicular knots are returned
- Returns:
Knots perpendicular to the edge
- Return type:
- get_point(row_index: int, continuity_index: int, surface_edge: SurfaceEdge) Point3D[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\) NURBS 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}\) if there are no internal knot vectors. If the NURBS surface has internal knot vectors, the actual \(i\)-index of the point may be different, but the second-to-last point in the third row of control points will still be returned.
See also
set_pointSetter 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, or2surface_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:
- 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_pointsparameter 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 toperp.- 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:
- 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
NURBSSurfaceobject assigned to the variablesurf, the \(u\)-parameter corresponding to \(y=1.4\) along the \(v=0.8\) isoparametric curve can be computed usingu = 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
Nonefor 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. IfNone, \(v\) must be specified. Default:Nonev (float or None) – Value of \(v\) to solve for or specify. If left as
None, this parameter will be solved for. IfNone, \(u\) must be specified. Default:Noneuv_guess (float) – Starting guess for the unsolved \(u\) or \(v\) parameter. Default:
0.5x (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:
Noney (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:
Nonez (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:
- get_weight(row_index: int, continuity_index: int, surface_edge: SurfaceEdge)[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\) NURBS 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_weightSetter 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, or2surface_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:
- has_internal_knots(direction: str) bool[source]#
Whether the surface has internal knots in the specified direction
- is_clamped(surface_edge: SurfaceEdge) bool[source]#
Checks if the NURBS surface is clamped along an edge
- Parameters:
surface_edge (SurfaceEdge) – Edge where the perpendicular knots will be inspected
- Returns:
Whether the surface is clamped at the given edge
- Return type:
- property m: int#
Shorthand for
degree_v- Returns:
Surface degree in the \(v\)-parametric direction
- Return type:
- property n: int#
Shorthand for
degree_u- Returns:
Surface degree in the \(u\)-parametric direction
- Return type:
- plot_control_point_mesh_lines(plot: Plotter, **line_kwargs) Actor[source]#
Plots the network of lines connecting the NURBS surface control points using the pyvista library
- Parameters:
plot –
pyvista.Plotterinstanceline_kwargs – Keyword arguments to pass to the
pyvista.Plotter.add_lines
- Returns:
The lines actor
- Return type:
pv.Actor
- plot_control_points(plot: Plotter, **point_kwargs) Actor[source]#
Plots the NURBS surface control points using the pyvista library
- Parameters:
plot –
pyvista.Plotterinstancepoint_kwargs – Keyword arguments to pass to the
pyvista.Plotter.add_points
- Returns:
The points actor
- Return type:
pv.Actor
- plot_surface(plot: Plotter, Nu: int = 50, Nv: int = 50, **mesh_kwargs)[source]#
Plots the NURBS surface using the pyvista library
- Parameters:
plot –
pyvista.PlotterinstanceNu (int) – Number of points to evaluate in the \(u\)-parametric direction. Default:
50Nv (int) – Number of points to evaluate in the \(v\)-parametric direction. Default:
50mesh_kwargs – Keyword arguments to pass to
pyvista.Plotter.add_mesh
- Returns:
The evaluated NURBS surface
- Return type:
- 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:
- 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\) NURBS 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.get_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\) if there are no internal knot vectors.
See also
get_pointGetter 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, or2surface_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\) NURBS 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_weightGetter 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, or2surface_edge (SurfaceEdge) – Edge of the surface along which to retrieve the weight
- split_at_u(u0: float)[source]#
Splits the NURBS surface at \(u=u_0\) along the \(v\)-parametric direction.
- split_at_v(v0: float)[source]#
Splits the NURBS surface at \(v=v_0\) along the \(u\)-parametric direction.
- to_iges(*args, **kwargs) IGESEntity[source]#
Exports the NURBS surface to an IGES entity
- transform(**transformation_kwargs) NURBSSurface[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:
- verify_g0(other: NURBSSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge, n_points: int = 10)[source]#
Verifies that two NURBS Surfaces are G0 continuous along their shared edge
- verify_g1(other: NURBSSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge, n_points: int = 10)[source]#
Verifies that two NURBSSurfaces are G1 continuous along their shared edge
- verify_g2(other: NURBSSurface, surface_edge: SurfaceEdge, other_surface_edge: SurfaceEdge, n_points: int = 10)[source]#
Verifies that two NURBSSurfaces are G2 continuous along their shared edge