plot
plot copied to clipboard
vg: consider migrating vg.Length and vg.Point to x/image/math/fixed
The package golang.org/x/image/math/fixed
defines fixed point integer types such as fixed.Int26_6
and fixed.Int52_12
(and corresponding Point
and Rectangle
struct types).
migrating vg.Length
from:
package vg
type Length float64
to:
package vg
import "golang.org/x/image/math/fixed"
type Length fixed.Int26_6
would (perhaps) ease interoperabiliy with all the other 2D packages.
I don't think we should do this. The image/math/fixed package is there for rasterizing images. Rasterization uses integer-addressed pixels, and fixed-point values make this easier. Vg deals with vector graphics, which work in floating point space. Sure, rounding may happen in the way-way-back end, but all the libraries called by the Canvases provide work in floats. Using fixed-point types would make our lives more difficult.
fair enough.
what about shiny/unit.Unit
then?
https://godoc.org/golang.org/x/exp/shiny/unit
(yes, shiny
is still experimental...)
I may be OK with that, but I wouldn't be in a huge rush to do it. I'm not bothered because shiny's experimental; it's made by "core go developers" and sits in a github.com/golang repo, so it's guaranteed to be viewed as the standard UI package for Go. The thing that bothers me is that a package like 'unit' isn't shiny specific; it's more generally applicable, for example, gonum/plot could very well use it. I would prefer to wait to see if they move it out of the shiny directory. It seems strange to create a plot using a seemingly-shiny-specific unit package.