Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Outline things #359

Merged
merged 11 commits into from Jul 7, 2020
Merged

Various Outline things #359

merged 11 commits into from Jul 7, 2020

Conversation

@s3bk
Copy link
Contributor

s3bk commented Jun 17, 2020

Outline:

  • merge combine two outlines
  • transformed variant of transform that takes self
  • mirror_and_close to mirror a Contour on the line between its first and last point
  • `with_capacity'
  • len
  • from_rect_rounded

Contour:

  • from_rect_rounded: SVG style rect with rounded corners
  • push_svg_arc: SVG arc
@bors-servo
Copy link
Contributor

bors-servo commented Jun 25, 2020

The latest upstream changes (presumably #366) made this pull request unmergeable. Please resolve the merge conflicts.

@pcwalton
Copy link
Collaborator

pcwalton commented Jun 25, 2020

Could you elaborate as to what mirror_and_close() is for?

/// Draws an ellipse section with radii given in `radius` rotated by `x_axis_rotation` to 'to' in the given `direction`.
/// If `large_arc` is true, draws an arc bigger than a 180°, otherwise smaller than 180°.
/// note that `x_axis_rotation` is in radians.
pub fn push_svg_arc(&mut self, radius: Vector2F, x_axis_rotation: f32, large_arc: bool, direction: ArcDirection, to: Vector2F) {

This comment has been minimized.

@pcwalton

pcwalton Jun 25, 2020

Collaborator

How does this compare to the arc implementation that pathfinder_canvas uses?

This comment has been minimized.

@s3bk

s3bk Jul 6, 2020

Author Contributor

Path2D::ellipse_section takes

  • center
  • axis
  • start_angle
  • end_angle: f32,
  • direction

svg_arc takes

  • last point (implicit)
  • radius
  • axis rotation
  • large arc flag, because there are two possible circles
  • destination point
#[inline]
pub fn from_rect_rounded(rect: RectF, radius: Vector2F) -> Contour {
use std::f32::consts::SQRT_2;
const QUARTER_ARC_CP_FROM_OUTSIDE: f32 = (3.0 - 4.0 * (SQRT_2 - 1.0)) / 3.0;

This comment has been minimized.

@pcwalton

pcwalton Jun 25, 2020

Collaborator

Where does this number come from?

This comment has been minimized.

@s3bk

s3bk Jul 6, 2020

Author Contributor

It is from https://www.chartwellyorke.com/mx/explore/geometric-modeling/circle-spline-approximation.pdf
page 4. Except that I am using 1 - 4/3 (√2-1) = 3/3 - 4/3 (√2-1) = (3 - 4(√2-1))/3

@s3bk
Copy link
Contributor Author

s3bk commented Jul 6, 2020

Could you elaborate as to what mirror_and_close() is for?

mirror_and_close isn't really necessary. It is a nice utility for constructing symmetric paths as it allows constructing only one half of it and then mirroring it automatically.

The symmetry line is between the first and last point on the existing Contour.

@pcwalton
Copy link
Collaborator

pcwalton commented Jul 7, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Jul 7, 2020

📌 Commit bff7111 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Jul 7, 2020

Testing commit bff7111 with merge 915f0ae...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 7, 2020

☀️ Test successful - checks-travis
Approved by: pcwalton
Pushing 915f0ae to master...

@bors-servo bors-servo merged commit 915f0ae into servo:master Jul 7, 2020
3 checks passed
3 checks passed
Travis CI - Pull Request Build Passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.