Skip to content

Commit

Permalink
Add additional documentation around flatten_arc
Browse files Browse the repository at this point in the history
Clarified the function's behavior and input invariants
  • Loading branch information
armansito committed Nov 22, 2023
1 parent bae1d1a commit 6e6d02a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shader/flatten.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ fn flatten_cubic(cubic: CubicPoints, path_ix: u32, local_to_device: Transform, o
// Flattens the circular arc that subtends the angle begin-center-end. It is assumed that
// ||begin - center|| == ||end - center||. `begin`, `end`, and `center` are defined in the path's
// local coordinate space.
//
// The direction of the arc is always a counter-clockwise (Y-down) rotation starting from `begin`,
// towards `end`, centered at `center`, and will be subtended by `angle` (which is assumed to be
// positive). A line segment will always be drawn from the arc's terminus to `end`, regardless of
// `angle`.
//
// `begin`, `end`, center`, and `angle` should be chosen carefully to ensure a smooth arc with the
// correct winding.
fn flatten_arc(
path_ix: u32, begin: vec2f, end: vec2f, center: vec2f, angle: f32, transform: Transform
) {
Expand Down

0 comments on commit 6e6d02a

Please sign in to comment.