Good addition. It would be nice if Double2D / Int2D are supported as
well, representing vectors. Those classes could just implement Oriented
and Scaled interfaces to make it work. This would be great for
visualizing flow fields.
Drawing them directly without calculating angle and length first is way
faster though, but this does not work together with OrientedPortrayal2D
which needs the orientation. I guess I need to stick to my custom
portrayal for the flow fields.
On 30.09.2015 22:57, Sean Luke wrote:
> I have committed changes to MASON to include a new class called VectorPortrayal2D, which makes it possible to portrayal clusters of number grids, or a single object grid, as a vector field: a grid of little vectors.
> You can use VectorPortrayal2D in combination with up to three DoubleGrid2D grids to display a grid of vectors each with an (1) orientation (2) size and (3) color, values queried from these grids respectively. Alternatively you can use it in combination with an ObjectGrid2D, in which case it will query the underlying objects in the grid to get the vector information from them, using the Oriented2D, Scaled2D, and Valuable interfaces. VectorField could in theory be used with SparseGrid2D or DenseGrid2D as well, though that's a less useful scenario. I suppose it could be used with hex grids: I don't see why not, but I've not tested it in this configuration.
> The changes are as follows:
> - Added Scaled2D interface
> - Changed Scalable2D interface to extend Scaled2D
> - Modified OrientedPortrayal2D to have a default scaling of 1.0 rather than 0.5. This will be the non-backward-compatible change which would affect people (though it's minor to fix).
> - Modified OrientedPortrayal2D to include several new shapes, including arrows.
> - Added VectorPortrayal2D, which subclasses from OrientedPortrayal2D