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#

contains_param

Check a parameter is within the parametric range of the curve.

contains_point

Check a point is contained by the curve.

from_control_points

Create a NURBS curve from control points.

parameterization

Get the parametrization of the NURBS curve.

transformed_copy

Create a transformed copy of the curve.

evaluate

Evaluate the curve at the given parameter.

project_point

Project a point to the NURBS curve.

geomdl_nurbs_curve

Get the underlying NURBS curve.

control_points

Get the control points of the curve.

degree

Get the degree of the curve.

knots

Get the knot vector of the curve.

weights

Get the weights of the control points.

__eq__

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.

property NURBSCurve.control_points: list[ansys.geometry.core.math.Point3D]#

Get the control points of the curve.

property NURBSCurve.degree: int#

Get the degree of the curve.

property NURBSCurve.knots: list[ansys.geometry.core.typing.Real]#

Get the knot vector of the curve.

property NURBSCurve.weights: list[ansys.geometry.core.typing.Real]#

Get the weights of the control points.

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.

Parameters:
control_pointslist[Point3D]

Control points of the curve.

degreeint

Degree of the curve.

knotslist[Real]

Knot vector of the curve.

weightslist[Real], optional

Weights of the control points.

Returns:
NURBSCurve

NURBS curve.

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:
matrixMatrix44

Transformation 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:
parameterReal

Parameter to evaluate the curve at.

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:
pointPoint3D

Point to project to the curve.

initial_guessReal, optional

Initial guess for the optimization algorithm. If not provided, the midpoint of the domain is used.

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.