mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Fix strokeBounds calculation when a rotation matrix is in use.
The bounding box of the rotated pen ellipse was calculated wrongly.
This commit is contained in:
parent
daa1343155
commit
3ccb4a6ebe
1 changed files with 6 additions and 5 deletions
|
@ -1889,12 +1889,13 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
// dy/dt = b cos(t) cos(phi) - a sin(t) sin(phi) = 0
|
||||
// this can be simplified to:
|
||||
// tan(t) = -b * tan(phi) / a // x
|
||||
// tan(t) = b * cot(phi) / a // y
|
||||
// tan(t) = b * cot(phi) / a // y
|
||||
// Solving for t gives:
|
||||
// t = pi * n - arctan(b tan(phi)) // x
|
||||
// t = pi * n + arctan(b cot(phi)) // y
|
||||
var tx = - Math.atan(b * Math.tan(phi)),
|
||||
ty = + Math.atan(b / Math.tan(phi)),
|
||||
// t = pi * n - arctan(b * tan(phi) / a) // x
|
||||
// t = pi * n + arctan(b * cot(phi) / a)
|
||||
// = pi * n + arctan(b / tan(phi) / a) // y
|
||||
var tx = -Math.atan(b * Math.tan(phi) / a),
|
||||
ty = Math.atan(b / (Math.tan(phi) * a)),
|
||||
// Due to symetry, we don't need to cycle through pi * n solutions:
|
||||
x = a * Math.cos(tx) * Math.cos(phi)
|
||||
- b * Math.sin(tx) * Math.sin(phi),
|
||||
|
|
Loading…
Reference in a new issue