Skip to content

enhancement #13861

@Ujwal200707

Description

@Ujwal200707

Feature description

in your bezier_curve.py in graphs you can add a feature like
Currently, your BezierCurve class can evaluate the curve at any t, but it cannot compute the tangent direction or derivative of the curve — which is often useful for motion planning, animation, or drawing tools.
def derivative(self, t: float) -> tuple[float, float]:
This will compute the first derivative (tangent vector) of the Bézier curve at a given parameter t.

The derivative of an n-degree Bézier curve is another Bézier curve of degree n - 1:

def derivative(self, t: float) -> tuple[float, float]:
This method computes the tangent vector (or slope) of your Bézier curve at a specific parameter value t, where t ranges from 0 to 1.

When t = 0, you get the tangent direction at the start of the curve.

When t = 1, you get the tangent direction at the end of the curve.

Intermediate values (like t = 0.25, t = 0.5, etc.) give the tangent at those points.

This is extremely useful when:

You want to know the direction of motion along the curve.

You want to compute velocity or acceleration in animations.

You want to draw tangent lines on the curve.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions