OCCCurve
¤
Class representing a general curve object.
Parameters:
-
native_curve(Geom_Curve) –An existing OCC curve.
-
name(str, default:None) –The name of the curve.
Attributes:
-
dimension(int) –The dimension of the curve.
-
domain(tuple[float, float]) –The domain of the parameter space of the curve.
-
end(Point) –The end point of the curve.
-
is_closed(bool) –Flag indicating that the curve is closed.
-
is_periodic(bool) –Flag indicating that the curve is periodic.
-
start(Point) –The start point of the curve.
Functions¤
aabb
¤
closest_parameters_curve
¤
closest_parameters_curve(
curve: OCCCurve, return_distance: bool = False
) -> tuple[float, float] | tuple[tuple[float, float], float]
Computes the curve parameters where the curve is the closest to another given curve.
Parameters:
-
curve(OCCCurve) –The curve to find the closest distance to.
-
return_distance(bool, default:False) –If True, return the minimum distance between the two curves in addition to the curve parameters.
Returns:
closest_point
¤
Compute the closest point on the curve to a given point. If an orthogonal projection is not possible, the start or end point is returned, whichever is closer.
Parameters:
-
point(Point) –The point to project to the curve.
-
return_parameter(bool, default:False) –If True, return the curve parameter in addition to the closest point.
Returns:
closest_points_curve
¤
closest_points_curve(
curve: OCCCurve, return_distance: bool = False
) -> tuple[Point, Point] | tuple[tuple[Point, Point], float]
Computes the points on curves where the curve is the closest to another given curve.
Parameters:
-
curve(OCCCurve) –The curve to find the closest distance to.
-
return_distance(bool, default:False) –If True, return the minimum distance between the curves in addition to the closest points.
Returns:
curvature_at
¤
Compute the curvature vector at a curve parameter.
Parameters:
-
t(float) –The curve parameter.
Returns:
-
Vector–
Raises:
-
ValueError–If the parameter is not in the curve domain.
divide_by_count
¤
divide_by_count(
count: int, return_points: bool = False, precision: float = 1e-06
) -> list[float] | tuple[list[float], list[Point]]
Divide the curve into a specific number of equal length segments.
Parameters:
-
count(int) –The number of segments.
-
return_points(bool, default:False) –If True, return the list of division parameters, and the points corresponding to those parameters. If False, return only the list of parameters.
-
precision(float, default:1e-06) –The precision used for calculating the segments.
Returns:
divide_by_length
¤
divide_by_length(
length: float, return_points: bool = False, precision: float = 1e-06
) -> list[float] | tuple[list[float], list[Point]]
Divide the curve into segments of a given length.
Note that the end point of the last segment might not coincide with the end point of the curve.
Parameters:
-
length(float) –The length of the segments.
-
return_points(bool, default:False) –If True, return the list of division parameters, and the points corresponding to those parameters. If False, return only the list of parameters.
-
precision(float, default:1e-06) –The precision used for calculating the segments.
Returns:
embedded
¤
embedded(surface) -> OCCCurve2d
Return a new curve embedded in the parameter space of the surface.
Parameters:
-
surface–The embedding surface.
Returns:
frame_at
¤
Compute the local frame at a curve parameter.
Parameters:
-
t(float) –The curve parameter.
Returns:
-
Frame–
Raises:
-
ValueError–If the parameter is not in the curve domain.
from_native
classmethod
¤
from_native(native_curve: Geom_Curve) -> OCCCurve
Construct a curve from an existing OCC BSplineCurve.
Parameters:
-
native_curve(Geom_Curve) –
Returns:
-
OCCCurve–
from_occ
classmethod
¤
from_occ(native_curve: Geom_Curve) -> OCCCurve
Construct a curve from an existing OCC BSplineCurve.
Parameters:
-
native_curve(Geom_Curve) –
Returns:
-
OCCCurve–
Warnings
.. deprecated:: 1.3
Use from_native instead.
length
¤
offset
¤
Return a new curve that is the offset of this curve over the specified distance in the given direction.
Parameters:
-
distance(float) –The offset distance.
-
direction(Vector) –The offset direction. Note that this direction defines the normal of the offset plane. At every point of the curve, a positive offset ditance will generate a corresponding offset point in the direction of the cross product vector of the curve tangent and the offset plane normal.
Returns:
-
OCCCurve–
parameter_at_distance
¤
Compute the parameter of a point on the curve at a given distance along the curve from a point at a given parameter.
Parameters:
-
t(float) –The parameter of the starting point.
-
distance(float) –The distance along the curve from the point at the given parameter.
-
precision(float, default:0.1) –The required precision of the result.
Returns:
-
float–The new parameter.
point_at
¤
Compute the point at a curve parameter.
Parameters:
-
t(float) –The curve parameter.
Returns:
-
Point–
Raises:
-
ValueError–If the parameter is not in the curve domain.
projected
¤
projected(surface) -> OCCCurve
Return a copy of the curve projected onto a surface.
Parameters:
-
surface–The projection surface.
Returns:
-
OCCCurve–
tangent_at
¤
Compute the tangent vector at a curve parameter.
Parameters:
-
t(float) –The curve parameter.
Returns:
-
Vector–
Raises:
-
ValueError–If the parameter is not in the curve domain.
to_polyline
¤
Convert the curve to a polyline.
Parameters:
-
n(int, default:100) –The number of polyline points.
Returns:
-
class:`compas.geometry.Polyline`–
to_step
¤
transform
¤
transform(T: Transformation) -> None