CCurveHearth
Workflows

Coding workflows · Quadratic Bézier points

03
Built around your work

A concrete starting point

Evaluate a quadratic Bézier point from three two-dimensional controls bounded by 1e100 in magnitude. Check both endpoints and the midpoint, rejecting non-finite coordinates or a parameter outside zero through one without changing the controls.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Quadratic Bézier points

A concrete starting point
from math import isfinite
def quadratic_bezier(points, t):
    def valid(v):
        return type(v) in (int, float) and -1e100 <= v <= 1e100 and isfinite(v)
    if type(points) not in (list, tuple) or len(points) != 3:
        raise ValueError("three control points")
    if any(type(p) not in (list, tuple) or len(p) != 2 or not all(map(valid,p)) for p in points):
        raise ValueError("bounded finite 2D controls")
    if not valid(t) or not 0 <= t <= 1: raise ValueError("parameter 0 through 1")
    def mix(a,b): return tuple((1-t)*x+t*y for x,y in zip(a,b))
    return mix(mix(points[0],points[1]),mix(points[1],points[2]))

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗