WorldViz User Forum get vertex with on the fly object
 Register FAQ Search Today's Posts Mark Forums Read

#1
05-23-2006, 05:57 PM
 enkeli Member Join Date: Mar 2006 Location: Isla Vista Posts: 24
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.
#2
05-25-2006, 12:59 PM
 enkeli Member Join Date: Mar 2006 Location: Isla Vista Posts: 24
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
#3
05-25-2006, 03:10 PM
 Gladsomebeast Member Join Date: Mar 2005 Location: Isla Vizta, CA Posts: 397
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.
#4
05-25-2006, 03:21 PM
 enkeli Member Join Date: Mar 2006 Location: Isla Vista Posts: 24
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...
#5
05-25-2006, 03:31 PM
 Gladsomebeast Member Join Date: Mar 2005 Location: Isla Vizta, CA Posts: 397
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.translate( 1, 0, 0 )

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

viz.callback(viz.KEYDOWN_EVENT,onkeydown)```
#6
05-25-2006, 05:22 PM
 enkeli Member Join Date: Mar 2006 Location: Isla Vista Posts: 24
Interesting, I shall try it and let you know if it works out.
#7
05-25-2006, 06:38 PM
 enkeli Member Join Date: Mar 2006 Location: Isla Vista Posts: 24
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. :-(
#8
05-25-2006, 06:44 PM
 Gladsomebeast Member Join Date: Mar 2005 Location: Isla Vizta, CA Posts: 397
Boy that Vizard is a whily one. Maby I'll have something for ya tomorrow. Something with the new viz.link() functianlity or something.
__________________
Paul Elliott
WorldViz LLC
#9
05-25-2006, 07:13 PM
 enkeli Member Join Date: Mar 2006 Location: Isla Vista Posts: 24
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!
#10
05-25-2006, 08:27 PM
 Gladsomebeast Member Join Date: Mar 2005 Location: Isla Vizta, CA Posts: 397
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 )`
__________________
Paul Elliott
WorldViz LLC

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

All times are GMT -7. The time now is 12:37 AM.