NURBSCurve
#
- class ansys.geometry.core.shapes.curves.nurbs.NURBSCurve#
Bases:
ansys.geometry.core.shapes.curves.curve.Curve
Represents a NURBS curve.
Notes
This class is a wrapper around the NURBS curve class from the geomdl library. By leveraging the geomdl library, this class provides a high-level interface to create and manipulate NURBS curves. The geomdl library is a powerful library for working with NURBS curves and surfaces. For more information, see https://pypi.org/project/geomdl/.
Overview#
Check a parameter is within the parametric range of the curve. |
|
Check a point is contained by the curve. |
Create a NURBS curve from control points. |
Get the parametrization of the NURBS curve. |
|
Create a transformed copy of the curve. |
|
Evaluate the curve at the given parameter. |
|
Project a point to the NURBS curve. |
Get the underlying NURBS curve. |
|
Get the control points of the curve. |
|
Get the degree of the curve. |
|
Get the knot vector of the curve. |
|
Get the weights of the control points. |
Determine if two curves are equal. |
Import detail#
from ansys.geometry.core.shapes.curves.nurbs import NURBSCurve
Property detail#
- property NURBSCurve.geomdl_nurbs_curve: geomdl.NURBS.Curve#
Get the underlying NURBS curve.
Notes
This property gives access to the full functionality of the NURBS curve coming from the geomdl library. Use with caution.
Method detail#
- classmethod NURBSCurve.from_control_points(control_points: list[ansys.geometry.core.math.Point3D], degree: int, knots: list[ansys.geometry.core.typing.Real], weights: list[ansys.geometry.core.typing.Real] = None) NURBSCurve #
Create a NURBS curve from control points.
- NURBSCurve.__eq__(other: NURBSCurve) bool #
Determine if two curves are equal.
- NURBSCurve.parameterization() ansys.geometry.core.shapes.parameterization.Parameterization #
Get the parametrization of the NURBS curve.
The parameter is defined in the interval [0, 1] by default. Information is provided about the parameter type and form.
- Returns:
Parameterization
Information about how the NURBS curve is parameterized.
- NURBSCurve.transformed_copy(matrix: ansys.geometry.core.math.Matrix44) NURBSCurve #
Create a transformed copy of the curve.
- Parameters:
- matrix
Matrix44
Transformation matrix.
- matrix
- Returns:
NURBSCurve
Transformed copy of the curve.
- NURBSCurve.evaluate(parameter: ansys.geometry.core.typing.Real) ansys.geometry.core.shapes.curves.curve_evaluation.CurveEvaluation #
Evaluate the curve at the given parameter.
- Parameters:
- parameter
Real
Parameter to evaluate the curve at.
- parameter
- Returns:
CurveEvaluation
Evaluation of the curve at the given parameter.
- abstract NURBSCurve.contains_param(param: ansys.geometry.core.typing.Real) bool #
Check a parameter is within the parametric range of the curve.
- abstract NURBSCurve.contains_point(point: ansys.geometry.core.math.Point3D) bool #
Check a point is contained by the curve.
The point can either lie within the curve or on its boundary.
- NURBSCurve.project_point(point: ansys.geometry.core.math.Point3D, initial_guess: ansys.geometry.core.typing.Real | None = None) ansys.geometry.core.shapes.curves.curve_evaluation.CurveEvaluation #
Project a point to the NURBS curve.
This method returns the evaluation at the closest point.
- Parameters:
- point
Point3D
Point to project to the curve.
- initial_guess
Real
,optional
Initial guess for the optimization algorithm. If not provided, the midpoint of the domain is used.
- point
- Returns:
CurveEvaluation
Evaluation at the closest point on the curve.
Notes
Based on the NURBS book, the projection of a point to a NURBS curve is the solution to the following optimization problem: minimize the distance between the point and the curve. The distance is defined as the Euclidean distance squared. For more information, please refer to the implementation of the distance_squared function.