Transform point using localToSceneTransform

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Fri Jul 27 15:19:09 PDT 2012


Hello all

Le 28/07/12 00:03, Kevin Rushforth a écrit :
> Easy conversion between the Point and vector classes is important even 
> if you don't have a common base class. Otherwise developers have to do 
> a bunch of manual copying (or things like subtracting a 0 vector from 
> a vector to convert it to a point).

I think that omitting converters may be safer for a similar reason than 
omitting the Affine.setTranslate/setScale/setRotation methods: in many 
cases, users invoked Affine.setTranslate(...) in situations where they 
should really invoke Affine.translate(...); the fact that their original 
Affine was the identity transform may not be as universal as they though.

I think this is similar for Point/Vector: I think that when a user 
converts a point to a vector, what he really wants is to get the 
distance relative to some origin. The origin may be (0,0,0) in 95% of 
cases, but not always (e.g. in map projections with "false easting" and 
"false northing"). Forcing a user to write "vector = point - origin" 
make his code more future-proof, by making more obvious where an origin 
is involved - even if it is (0,0,0) - and easier to adjust in case the 
origin moved.

     Martin



More information about the openjfx-dev mailing list