Transform point using localToSceneTransform

Pedro Duque Vieira pedro.duquevieira at gmail.com
Wed Jul 25 19:22:49 PDT 2012


Hi Jim,


> Hi Pavel,
> You claim that we need to add new methods if we treat a point as if it
> were a vector, but we would have to do that anyway to add methods that
> take vector.
> So, we can either add:
>         transform(Vector) - treats its arg as magnitudes
>            (and thus does a delta transform)
> or we can add:
>         deltaTransform(Point) - delta transforms the arg
>            (which is what you want to do with magnitudes)
>

There is a miss conception here. The proposed Vector isn't merely a
representation of a magnitude, it is a magnitude and an
angle/direction(although this is not stored internally in the instance) as
what exists in java3d and has a set of methods to compute/get vector
related stuff: get vector angle, get vector magnitude, get angle between 2
vectors, compute cross product between vectors, etc.
It isn't strictly necessary to do a deltaTransform to transform a Vector,
one can transform a vector like a point is transformed.


> It's a matter of whether the semantics are in the method name or the
> argument type.
> Furthermore, an array of doubles does not have an "am I a set of points
> or vectors" type attached to it so we do need to have 2 different method
> names for the methods that take arrays of doubles, whether or not we
> create a Vector class (whose sole purpose is to indicate that its values
> which are identical in nature to the Point class are to be considered as
> magnitudes).


If you use homogeneous coordinates notation, than an array of doubles
representing the vector will tell you that in fact it is a vector cause the
last value will be 0 (in contrast to a point which is 1).


>
> We can either encapsulate this information in a new class and add lots
> of methods for that new class, or we can encapsulate the information on
> the naming and documentation of new methods which use old types - both
> have equal expense in terms of method counts...
>                         ...jim


Thanks, best regards,

-- 
Pedro Duque Vieira


More information about the openjfx-dev mailing list