Curve

class compas.geometry.Curve[source]

Bases: Geometry

Class representing a general parametric curve.

Parameters:
framecompas.geometry.Frame, optional

The local coordinate system of the curve. Default is the world coordinate system.

namestr, optional

The name of the curve.

Notes

The curve is a “pluggable”. This means that it does not provide an actual implementation of a parametric curve, but rather serves as an interface for different backends. If a backend is available, it will be used to construct the curve and provide its functionality. This backend is referred to as the “plugin” implementation of the curve.

To activate the plugin mechanism, the backend should provide an implementation of the new_curve() function, and of any other function that can be implemented through the functionality available in the backend.

Attributes:
framecompas.geometry.Frame

The frame of the curve.

transformationcompas.geometry.Transformation, read-only

The transformation from the local coordinate system of the curve (frame) to the world coordinate system.

planecompas.geometry.Plane, read-only

The plane of the curve.

dimensionint, read-only

The spatial dimension of the curve. In most cases this will be 3. For curves embedded on a surface, this is 2.

domaintuple[float, float], read-only

The domain of the parameter space of the curve is the interval [0.0, 1.0].

is_closedbool, read-only

True if the curve is closed.

is_periodicbool, read-only

True if the curve is periodic.

Methods

aabb

Compute the axis-aligned bounding box of the curve.

closest_point

Compute the closest point on the curve to a given point.

curvature_at

Compute the curvature vector of the curve at a parameter.

divide_by_count

Compute the curve parameters that divide the curve into a specific number of equal length segments.

divide_by_length

Compute the curve parameters that divide the curve into segments of specified length.

fair

frame_at

Compute the local frame of the curve at a parameter.

from_obj

Load a curve from an OBJ file.

from_step

Load a curve from a STP file.

length

Compute the length of the curve.

normal_at

Compute the normal of the curve at a parameter.

offset

point_at

Compute a point of the curve at a parameter.

reverse

Reverse the parametrisation of the curve.

reversed

Reverse a copy of the curve.

smooth

split

tangent_at

Compute the tangent vector of the curve at a parameter.

to_obj

Write the curve geometry to an OBJ file.

to_points

Convert the curve to a list of points.

to_polygon

Convert the curve to a polygon.

to_polyline

Convert the curve to a polyline.

to_step

Write the curve geometry to a STP file.

transform

Transform the local coordinate system of the curve.

trim

Inherited Methods

ToString

Converts the instance to a string.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

rotate

Rotate the geometry.

rotated

Returns a rotated copy of this geometry.

scale

Scale the geometry.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

validate_data

Validate the data against the object's data schema.