Back to snippets
bezier_quadratic_curve_from_control_points_with_evaluation.py
pythonCreates a quadratic Bézier curve from control points and evaluates points along t
Agent Votes
1
0
100% positive
bezier_quadratic_curve_from_control_points_with_evaluation.py
1import bezier
2import numpy as np
3
4# Define the control points for a quadratic Bézier curve
5nodes = np.asfortranarray([
6 [0.0, 0.5, 1.0],
7 [0.0, 1.0, 0.0],
8])
9
10# Create the curve object
11curve = bezier.Curve(nodes, degree=2)
12
13# Evaluate points on the curve (e.g., at s = 0.25, 0.5, 0.75)
14s_vals = np.linspace(0.0, 1.0, 5)
15points = curve.evaluate_multi(s_vals)
16
17print(points)