Transform point using localToSceneTransform
Anthony Vanelverdinghe
anthony.vanelverdinghe at gmail.com
Thu Jul 26 04:47:48 PDT 2012
Imho, javafx.math.geometry (or whatever package the Matrix/Point/...
classes will end up in) should be:
* "mathematically correct". To me this implies: separate classes for
separate concepts. And Vector and Point are different concepts.
* complete. In a sense that they comprise a cohesive set of classes
which are functionally on par with their counterparts in existing 3D
math libraries:
javax.vecmath (
http://java.net/projects/vecmath/sources/svn/show/trunk/src/javax/vecmath )
com.jme3.math (
http://jmonkeyengine.org/javadoc/com/jme3/math/package-summary.html )
org.jscience.mathematics.vector (
http://jscience.org/api/org/jscience/mathematics/vector/package-summary.html
)
org.apache.commons.math3.geometry.euclidean.threed (
http://commons.apache.org/math/apidocs/org/apache/commons/math3/geometry/euclidean/threed/package-summary.html
)
...
Kind regards
Anthony
Op 25/07/2012 22:49, Pavel Safrata schreef:
> I think the main point is that even though both vector and point
> consist of three doubles, they are different kinds of animals. Point
> contains coordinates, Vector contains magnitudes/distances. We will
> probably want to provide methods for computing angle between vectors
> or vector length. Having angle between points or point length doesn't
> make any natural sense. If we provide those methods on Point3D, they
> will look weird, and javadoc will have to explain that in this case we
> treat the point as "relative distance vector" (taken from J2D that has
> to do that). Also transforming a point in space results in another
> point in space whereas transforming a vector is a different operation
> that results in a vector. With both guys represented as a single class
> we need to provide two different transform methods, one of them for
> treating a "point" as point, the second one for treating a "point" as
> vector (named deltaTransform). J2D does that (has a single "point" and
> needs to explain in javadoc how it is treated, but it doesn't have the
> convenience "vector algerbra" methods so the problems are smaller),
> J3D doesn't (distinguishes point and vector as different things).
>
> Unfortunately I haven't been involved in the past discussions so I
> probably don't have enough insight. I don't really want to question
> already made decisions but when we've already got to this point it
> would be great if somebody could sum up the reasons for the decision
> to represent both things by Point.
>
> Thanks,
> Pavel
>
> On 25.7.2012 17:54, Richard Bair wrote:
>> Haha, you're going to make me read the thread :-)
>>
>> Generally speaking I'd prefer to just use Point3D vs. adding a
>> Vector, primarily because we already made this decision several
>> releases ago. Without having to read the whole thread, can you give a
>> short summary of the impact using Point3D has vs. a class named
>> Vector3D?
>>
>> Richard
>>
>> On Jul 25, 2012, at 6:54 AM, Pavel Safrata wrote:
>>
>>> I think that if we define Vector*D as the class that represents
>>> magnitudes without position, and we use it for our magnitudes
>>> without position, we don't need any deltaTransforms, do we?
>>>
>>> Richard, what do you think about introducing Vector2D and Vector3D?
>>> I think the classes would be nice (to distinguish between specific
>>> points in space and magnitudes without position) but we would have
>>> to deprecate methods in Rotate that use Point3D as rotation axis and
>>> introduce different ones that use Vector3D, we would also need to
>>> deprecate the static axes defined in this class and define vector
>>> ones with different names..
>>>
>>> Thanks,
>>> Pavel
>>>
>>> On 25.7.2012 1:34, Pedro Duque Vieira wrote:
>>>> Hi Jim,
>>>>
>>>> Maybe we're talking about two different ways of performing the same
>>>> calculations, probably we come from different backgrounds.
>>>>
>>>> What I meant with Vector3d is a 4x1 matrix with the last element as 0
>>>> (homogeneous coordinates). We can then have methods on the Vector3d
>>>> class
>>>> to give us things we expect to retrieve from vectors: like angle,
>>>> magnitude, doing the cross product of two vectors, calculating the
>>>> angle
>>>> between two vectors.
>>>> As a reference one can look at the java3d implementation of Vector3d:
>>>> http://docs.oracle.com/cd/E17802_01/j2se/javase/technologies/desktop/java3d/forDevelopers/J3D_1_3_API/j3dapi/javax/media/j3d/Transform3D.html
>>>>
>>>>
>>>>
>>>> Thanks, best regards,
>>>>
>>>> On Wed, Jul 25, 2012 at 12:06 AM, Jim Graham
>>>> <james.graham at oracle.com>wrote:
>>>>
>>>>> Hi Pedro,
>>>>>
>>>>> delta transform is transform without translation. It is primarily
>>>>> used to
>>>>> transform magnitudes that have no position so you only modify them
>>>>> with the
>>>>> scale, shear, and rotation aspects of the matrix (i.e. everything
>>>>> but the
>>>>> translate components).
>>>>>
>>>>> For some reason I got the impression that Vector was only used to
>>>>> represent magnitude because people were bringing up delta
>>>>> transforms in the
>>>>> context of talking about it. If it is a 1x4 vector then it is just
>>>>> Point3D+perspective-w-element, [x,y,z,w] no? Point3D can
>>>>> participate in
>>>>> 4x4 transforms, supplying an implicit w=1 component, though it
>>>>> can't store
>>>>> the resulting w component if the matrix doesn't have 0,0,0,1 for
>>>>> the last 4
>>>>> elements (i.e. in perspective camera matrices)...
>>>>>
>>>>> ...jim
>>>>>
>>>>>
>>>>> On 7/24/2012 3:55 PM, Pedro Duque Vieira wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>> I've already commented on this in the matrix algebra thread, but I
>>>>>>> wanted to throw into this discussion the following point:
>>>>>>> I'm neutral on whether or not we need Vector - I'll leave that
>>>>>>> to the
>>>>>>> people with extensive 3D experience to comment. But, if
>>>>>>> transformation
>>>>>>> of vectors makes better sense to do a delta transform, and if we
>>>>>>> are
>>>>>>> adding deltaTransform() methods for other types (which I think
>>>>>>> we should
>>>>>>> do), then I think the "transform" method that does a "delta
>>>>>>> transform"
>>>>>>> on a Vector should actually be named "deltaTransform" for
>>>>>>> consistency,
>>>>>>> even if it is obvious that a vector should only be transformed that
>>>>>>> way...
>>>>>>>
>>>>>>>
>>>>>> I don't know what a delta transform is (never used it on my 3d work
>>>>>> background), so I cannot comment on that part.
>>>>>> All I can say is that I did use transform a vector by a given matrix
>>>>>> transform and it makes sense. It's basically a multiplication of
>>>>>> a 4x4
>>>>>> matrix transform with a 1x4 matrix, just like what happens when you
>>>>>> transform a point3d.
>>>>>> So I think:
>>>>>> - void transform(Vector3d)
>>>>>> Should be present on the transform3d class.
>>>>>>
>>>>>> Just my 2 cents,
>>>>>>
>>>>>>
>>>
>
>
More information about the openjfx-dev
mailing list