Bezier

class compas.geometry.Bezier[source]

Bases: Curve

A Bezier curve is defined by control points and a degree.

A Bezier curve of degree n is a linear combination of n + 1 Bernstein basis polynomials of degree n.

Parameters:
pointssequence[point]

A sequence of control points, represented by their location in 3D space.

namestr, optional

The name of the curve.

See also

compas.geometry.NubrsCurve

Examples

Construct a Bezier curve from control points.

>>> points = [[0.0, 0.0, 0.0], [0.5, 1.0, 0.0], [1.0, 0.0, 0.0]]
>>> curve = Bezier(points)

The degree of the curve is equal to the number of control points minus one.

>>> curve.degree
2

Note that the input control points are automatically converted to COMPAS points.

>>> curve.points
[Point(0.000, 0.000, 0.000), Point(0.500, 1.000, 0.000), Point(1.000, 0.000, 0.000)]
Attributes:
pointslist[compas.geometry.Point]

The control points.

degreeint, read-only

The degree of the curve.

framecompas.geometry.Frame, read-only

The frame of the curve. This is always the world coordinate system.

Methods

normal_at

Compute the normal vector to the curve at the point at the given parameter.

point_at

Compute the point on the curve at the given parameter.

tangent_at

Compute the tangent vector to the curve at the point at the given parameter.

transform

Transform this curve.

Inherited Methods

ToString

Converts the instance to a string.

aabb

Compute the axis-aligned bounding box of the curve.

closest_point

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

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.

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_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

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.

offset

reverse

Reverse the parametrisation of the curve.

reversed

Reverse a copy of the curve.

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.

smooth

split

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.

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.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

trim

validate_data

Validate the data against the object's data schema.