Open sbinet opened 8 years ago
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.
The package
golang.org/x/image/math/fixed
defines fixed point integer types such asfixed.Int26_6
andfixed.Int52_12
(and correspondingPoint
andRectangle
struct types).migrating
vg.Length
from:to:
would (perhaps) ease interoperabiliy with all the other 2D packages.