S or /

SourceClass QuadraticBezierShape

from egui import QuadraticBezierShape
class QuadraticBezierShape:

A quadratic Bézier Curve.

See also CubicBezierShape.

Properties§

@property def closed(self, /) -> bool§
@closed.setter def closed(self, /, closed: bool) -> None§
@property def fill(self, /) -> Color32§
@fill.setter def fill(self, /, fill: Color32) -> None§
@property def stroke(self, /) -> PathStroke§
@stroke.setter def stroke(self, /, stroke: Any) -> None§

Methods§

Sourcedef flatten(self, /, tolerance: float |None) -> list[Pos2]§

find a set of points that approximate the quadratic Bézier curve. the number of points is determined by the tolerance. the points may not be evenly distributed in the range [0.0,1.0] (t value)

Sourcedef for_each_flattened_with_t(self, /, tolerance: float) -> list[tuple[Pos2, float]]§

Compute a flattened approximation of the curve, invoking a callback at each step.

The callback takes the point and corresponding curve parameter at each step.

This implements the algorithm described by Raph Levien at https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html

Source@staticmethod def from_points_stroke(points: Sequence[Pos2], closed: bool, fill: Color32, stroke: Any) -> QuadraticBezierShape§

Create a new quadratic Bézier shape based on the 3 points and stroke.

The first point is the starting point and the last one is the ending point of the curve. The middle point is the control points. The points should be in the order [start, control, end]

Sourcedef logical_bounding_rect(self, /) -> Rect§

Logical bounding rectangle (ignoring stroke width)

def points(self, /) -> list[Pos2]§
Sourcedef sample(self, /, t: float) -> Pos2§

Calculate the point (x,y) at t based on the quadratic Bézier curve equation. t is in [0.0,1.0] Bézier Curve

def set_points(self, /, points: Sequence[Pos2]) -> None§
Sourcedef to_path_shape(self, /, tolerance: float |None) -> PathShape§

Convert the quadratic Bézier curve to one PathShape. The tolerance will be used to control the max distance between the curve and the base line.

Sourcedef transform(self, /, transform: RectTransform) -> QuadraticBezierShape§

Transform the curve with the given transform.

Sourcedef visual_bounding_rect(self, /) -> Rect§

The visual bounding rectangle (includes stroke width)