You are right about Oriented2D and Scaled2D, they should not be
implemented by Double2D. I am just using a line with a dot at the end to
portray the directions without any transformations. That is quite a
different approach which might not fit well into VectorPortrayal2D
because it uses its own shape.
I attached my class and how the direction vectors look like.
On 01.10.2015 16:03, Sean Luke wrote:
> On Oct 1, 2015, at 3:37 AM, Christian Meyer
> <[log in to unmask]> wrote:
>> Good addition. It would be nice if Double2D / Int2D are supported
>> as well, representing vectors.
> Oh, duh, of course I should have included that. Well, Double2D
> anyway for sure. Probably could have done Point2D.Double etc. too.
>> Those classes could just implement Oriented and Scaled interfaces
>> to make it work. This would be great for visualizing flow fields.
> The problem here is that Oriented2D and Scaled2D are actually
> interfaces in the *portrayal* package, and Double2D and Int2D are in
> sim.util (intended to be separable from the rest of MASON). I'll
> just special-case them in VectorPortrayal2D.
>> 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.
> Well, there's always atan. :-) But yes, speed will be an issue. I
> could special-case a vector shape that's all horizontal and vertical
> lines to bypass all the affine transformations, but you'd need to
> give me an idea of what shape I should use. What are you using?