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 ofn + 1
Bernstein basis polynomials of degreen
.- 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.
- frame
compas.geometry.Frame
, read-only The frame of the curve. This is always the world coordinate system.
- pointslist[
Methods
Compute the normal vector to the curve at the point at the given parameter.
Compute the point on the curve at the given parameter.
Compute the tangent vector to the curve at the point at the given parameter.
Transform this curve.
Inherited Methods
Converts the instance to a string.
Compute the axis-aligned bounding box of the curve.
Compute the closest point on the curve to a given point.
Compute the axis-aligned bounding box of the geometry.
Compute the oriented bounding box of the geometry.
Make an independent copy of the data object.
Compute the curvature vector of the curve at a parameter.
Compute the curve parameters that divide the curve into a specific number of equal length segments.
Compute the curve parameters that divide the curve into segments of specified length.
Compute the local frame of the curve at a parameter.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Load a curve from an OBJ file.
Load a curve from a STP file.
Compute the length of the curve.
Reverse the parametrisation of the curve.
Reverse a copy of the curve.
Rotate the geometry.
Returns a rotated copy of this geometry.
Scale the geometry.
Returns a scaled copy of this geometry.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Write the curve geometry to an OBJ file.
Convert the curve to a list of points.
Convert the curve to a polygon.
Convert the curve to a polyline.
Write the curve geometry to a STP file.
Returns a transformed copy of this geometry.
Translate the geometry.
Returns a translated copy of this geometry.
Validate the data against the object's data schema.