Access to "live" shape geometry ?

Hi,

is there a possibility to get the world coordinates for a Shape3D geometry ?
I mean not the vertices I entered for initially defining the geometry but the vertice (in the world coordinate system) after all transforms have been applied.

I tried the COORDINATE_READ/WRITE flags but they seem to have no effect in this direction.

Any ideas ?

i no this one!! jumps about


Vector3f q1 = new Vector3f(model.getVworldBounds().getCenter());

hope thats correct :slight_smile:

thanks for the quick reply :slight_smile:

this was close :wink: but I was looking to get the coordinates per vertex.

Something like myShape3D.getGeometry().getCoordinate(some vertex) and now I get the VWorld coords for this vertex (Point3f).

I need it for some rayIntersectsTriangle based collision computations.

The only way I can think of doing this (at the moment) is to get the LocalToVworld Transform and apply this to the vertex I am interested. But this would mean I would compute the same transformations that Xith uses internally again. I hope this is not necessary.

update:

I tried the myShape3D.getLocalToVworld().transform(Vector3f) function on a vertex of my rotating test cube. This gives me the rotated version of the given vertex but there seems no translation being done ???

update(2):

ok, using myShape3D.getLocalToVworld().transform(Point3f) does the trick.

anyone having a better idea on how to do this ? Are the Vworld coords of the geometry somewhere buffered (Flags ?) ?

Ca$cade

Hi,

[quote]The only way I can think of doing this (at the moment) is to get the LocalToVworld Transform and apply this to the vertex I am interested. But this would mean I would compute the same transformations that Xith uses internally again. I hope this is not necessary.
[/quote]

[quote]Are the Vworld coords of the geometry somewhere buffered (Flags ?) ?
[/quote]
No. Xith3D does not apply local-to-vworld transform to vertices itself - it just passes both transform and original vertices to graphic card hardware via OpenGL, and hardware (GPU) does the transform. This is a basic idea of hardware-accelerated rendering - to avoid such caluclations on the CPU. So if you need transformed vertices, you have to transform them yourself.

Alternatively, you can think about changing your calculations to shape-local coordinate system - this will be much faster to transform your ray using inverse localToVWorld, then caluclate intersection in shape-local coordinates, and transform result back if needed (count how many transforms you save on larger geometries).

[quote]I tried the myShape3D.getLocalToVworld().transform(Vector3f) function on a vertex of my rotating test cube. This gives me the rotated version of the given vertex but there seems no translation being done
[/quote]
Strange - it should work as expected. Did you define translation using TransformGroup or just View transform? If you used LookAt or View Transform, then you moved your view relative to VWorld, so this translation (if any) is not part of LocalToVWorld.

Yuri

I used just the TransformGroup not the View related functions. As I posted above the function on Vector3f did not translate where the function on Point3f did.

I am just coding a small class to take care of the orientation of an object. I did not fully understand how to use the lookAt function to get what I needed: A vehicle based camera. The vehicle defines the platform and has Yaw, Pitch, Roll angles and the camera can be rotated horizontally and vertically in respect to the platform orientation.

If anyone is interested I can post the code to get the rotationMatrix from the YawPitchRoll angles (using the Euler to Quaterion to Matrix way) also I don’t know at this point if I am running into problems like gimbal lock etc.

Hi,

We almost ready with a conceptually new ViewingPlatform scenegraph integration approach, which isolates moving of the platform itself and rotating/moving camera installed on it.

The approach is quite different from one found in Java3D, but gives MUCH MORE flexibility and ease of use than in Java3D.

I plan to post changes and sample how to use it within 1-2 days (I am currently on business trip, so I will do this when I will have time).

Yuri

Big thanks goes to Yuri your hint on transforming the intersection ray into object coordinate space :slight_smile:

this is of course a hundred times better than my first approach.

Here is how I compute intersections:

wrapped the Shape3D class to include a set of planes (triangles) computed from its geometry.
The intersection ray is transformed into the coord space of the Shape3D and then checked against the planes.
The intersection returns then the set of intersections at float precision and picks the one that is closest to the origin.

now ray intersection and picking works nice.

Ca$