Fix Capper & Joiner bugs introduced by 856a70c
Some constants were not updated properly when switching from raster.Point to fixed.26_6
This commit is contained in:
parent
2b7eb15daa
commit
aed127b02f
|
@ -47,8 +47,8 @@ var RoundCapper Capper = CapperFunc(roundCapper)
|
||||||
|
|
||||||
func roundCapper(p Adder, halfWidth fixed.Int26_6, pivot, n1 fixed.Point26_6) {
|
func roundCapper(p Adder, halfWidth fixed.Int26_6, pivot, n1 fixed.Point26_6) {
|
||||||
// The cubic Bézier approximation to a circle involves the magic number
|
// The cubic Bézier approximation to a circle involves the magic number
|
||||||
// (√2 - 1) * 4/3, which is approximately 141/256.
|
// (√2 - 1) * 4/3, which is approximately 35/64.
|
||||||
const k = 141
|
const k = 35
|
||||||
e := pRot90CCW(n1)
|
e := pRot90CCW(n1)
|
||||||
side := pivot.Add(e)
|
side := pivot.Add(e)
|
||||||
start, end := pivot.Sub(n1), pivot.Add(n1)
|
start, end := pivot.Sub(n1), pivot.Add(n1)
|
||||||
|
@ -111,8 +111,8 @@ func addArc(p Adder, pivot, n0, n1 fixed.Point26_6) {
|
||||||
// We approximate the arc by 0, 1, 2 or 3 45-degree quadratic segments plus
|
// We approximate the arc by 0, 1, 2 or 3 45-degree quadratic segments plus
|
||||||
// a final quadratic segment from s to n1. Each 45-degree segment has
|
// a final quadratic segment from s to n1. Each 45-degree segment has
|
||||||
// control points {1, 0}, {1, tan(π/8)} and {1/√2, 1/√2} suitably scaled,
|
// control points {1, 0}, {1, tan(π/8)} and {1/√2, 1/√2} suitably scaled,
|
||||||
// rotated and translated. tan(π/8) is approximately 106/256.
|
// rotated and translated. tan(π/8) is approximately 27/64.
|
||||||
const tpo8 = 106
|
const tpo8 = 27
|
||||||
var s fixed.Point26_6
|
var s fixed.Point26_6
|
||||||
// We determine which octant the angle between n0 and n1 is in via three
|
// We determine which octant the angle between n0 and n1 is in via three
|
||||||
// dot products. m0, m1 and m2 are n0 rotated clockwise by 45, 90 and 135
|
// dot products. m0, m1 and m2 are n0 rotated clockwise by 45, 90 and 135
|
||||||
|
|
Loading…
Reference in New Issue