Don't draw backwards miters.

This commit is contained in:
Patrick Walton 2020-03-31 19:38:43 -07:00
parent 764953a643
commit e6d8aab974
1 changed files with 6 additions and 2 deletions

View File

@ -383,11 +383,15 @@ impl Contour {
LineJoin::Bevel => {}
LineJoin::Miter(miter_limit) => {
if let Some(prev_tangent_t) = prev_tangent.intersection_t(next_tangent) {
if prev_tangent_t < -EPSILON {
return;
}
let miter_endpoint = prev_tangent.sample(prev_tangent_t);
let threshold = miter_limit * distance;
if (miter_endpoint - join_point).square_length() <= threshold * threshold {
self.push_endpoint(miter_endpoint);
if (miter_endpoint - join_point).square_length() > threshold * threshold {
return;
}
self.push_endpoint(miter_endpoint);
}
}
LineJoin::Round => {