WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-23-2006, 06:57 PM
enkeli enkeli is offline
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.
Reply With Quote
  #2  
Old 05-25-2006, 01:59 PM
enkeli enkeli is offline
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
Reply With Quote
  #3  
Old 05-25-2006, 04:10 PM
Gladsomebeast Gladsomebeast is offline
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.
Reply With Quote
  #4  
Old 05-25-2006, 04:21 PM
enkeli enkeli is offline
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...
Reply With Quote
  #5  
Old 05-25-2006, 04:31 PM
Gladsomebeast Gladsomebeast is offline
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 = 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)
Reply With Quote
  #6  
Old 05-25-2006, 06:22 PM
enkeli enkeli is offline
Member
 
Join Date: Mar 2006
Location: Isla Vista
Posts: 24
Interesting, I shall try it and let you know if it works out.
Reply With Quote
  #7  
Old 05-25-2006, 07:38 PM
enkeli enkeli is offline
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. :-(
Reply With Quote
  #8  
Old 05-25-2006, 07:44 PM
Gladsomebeast Gladsomebeast is offline
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
Reply With Quote
  #9  
Old 05-25-2006, 08:13 PM
enkeli enkeli is offline
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!
Reply With Quote
  #10  
Old 05-25-2006, 09:27 PM
Gladsomebeast Gladsomebeast is offline
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
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Jump


All times are GMT -7. The time now is 01:48 PM.


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