WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   get vertex with on the fly object (https://forum.worldviz.com/showthread.php?t=592)

enkeli 05-23-2006 05:57 PM

get vertex with on the fly object
 
Hello, I was wondering if it's possible to get the value of a vertex of an on-the-fly object? I create a line, then scale it, then I need the value of the scaled vertex.

enkeli 05-25-2006 12:59 PM

Please help, all I need is a get method for the vertex position. I'm pretty sure the values exist somewhere. Something like:

[ x, y, z ] = myOnTheFlyLine.getVertex( 0 ) # to get the x,y,z of the 0th vertex
[ x, y, z ] = myOnTheFlyLine.getVertex( 1 ) # to get the x,y,z of the 1th vertex

Gladsomebeast 05-25-2006 03:10 PM

Sadly, Vizard provides no way to get the vertex positions:( The workaround is to recorde the positions of the vertexes when you add/modify them.

enkeli 05-25-2006 03:21 PM

Sadly that workaround would not work for me, as after I set a vertex I scale the object. To get that new point, I would need to do quite a bit of math which I would like to avoid...

Gladsomebeast 05-25-2006 03:31 PM

Hmm. OK, heres a possible solution: add a child object to the on-the-fly object before you scale it. Translate the child object to the position of the vertex you are interested in. Then scale the on-the-fly object. Then print out the child objects position.

Code:

l = viz.add( 'logo.wrl' )

b = l.add( 'ball.wrl' )
b.translate( 1, 0, 0 )

def onkeydown(key):
        l.scale( 3, 3, 3 )
        print b.get( viz.POSITION )

viz.callback(viz.KEYDOWN_EVENT,onkeydown)


enkeli 05-25-2006 05:22 PM

Interesting, I shall try it and let you know if it works out.

enkeli 05-25-2006 06:38 PM

Hey. I tried it, however the position of the ball, while it appears in the world where it is translated/scaled to, the position values remain the same. :-(

Gladsomebeast 05-25-2006 06:44 PM

Boy that Vizard is a whily one. Maby I'll have something for ya tomorrow. Something with the new viz.link() functianlity or something.

enkeli 05-25-2006 07:13 PM

I got it!
b.get( viz.POSITION ) gets the position locally, while
b.get( viz.POSITION, viz.ABSOLUTE_WORLD ) gets what I want :-)

Thanks for the help!

Gladsomebeast 05-25-2006 08:27 PM

Instead of adding a model, such as 'ball.wrl', add a Group to increase performace and avoid having to remove the ball.
Code:

vertexTracker = logo.add( viz.GROUP )


All times are GMT -7. The time now is 09:14 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC