PDA

View Full Version : Locating the Coordinates of Vertices for on the fly objects


shivanangel
10-30-2006, 01:10 PM
Hi again,

I'm trying to determine the location of a vertex after it has been transformed. Is there any kind of function call that will give me the coordinates in (X,Y,Z) space? I've already tried the usual, viz.get and so forth with no avail.

The actual vertex is being heavily manipulated by both the camera location and a wanda tracking device, which prevents me from actually 'knowing' where the item is at any time.

Here is my code. You'll notice it sets up a primitive tracker. What we want to do it use the 'intersect' function with the two points that make up the line and determine if it intersects and object.



import viz
viz.go()

#Trial Object

view = viz.get(viz.MAIN_VIEWPOINT)

#This will specify the shared memory key for retrieving trackd data
PORT_TRACKD = 4126

#Create a trackd tracker (This will be attached to sensor 1 on key 4126)
tracker = viz.add('trackd.dls')

viz.startlayer(viz.LINES)
viz.vertex(0,0,0)
viz.vertex(10,0,0)

object = viz.endlayer()
object.dynamic()



def mytimer(num):

t_data = tracker.get()
head = view.get(viz.HEAD_POS)
object.translate(view.get(viz.HEAD_POS))
object.rotate(view.get(viz.HEAD_AXISANGLE))
object.translate(0,-2,15,viz.RELATIVE_LOCAL)
object.rotatequat(t_data[3],t_data[4],t_data[5],t_data[6])



viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.01,viz.FOREVER)



Thank You

George Lecakes
Rowan University

Gladsomebeast
10-30-2006, 02:28 PM
Check this thread for a way to do this in Vizard 3.0

http://www.worldviz.com/forum/showthread.php?t=772&highlight=vertex

shivanangel
10-30-2006, 03:04 PM
Is there a way to do it in vizard 2.XX, cause that is what we are using at this University.
We have not yet moved to 3 since it still is the beta version and the work we are doing requires a fully released product version.

George Lecakes
Rowan University

Gladsomebeast
10-30-2006, 05:29 PM
There is no way to do this directly in 2.5. You can save the transformation of the Vertex every time you change it and mulitiply it by the transform of the On-the-fly object. This is simlar to the second example in the post I linked to above.

While Vizard 3.0 is still in develpment, it is actualy more stable than Vizard 2.5.

shivanangel
10-30-2006, 08:28 PM
I'll have to tell that to my professors and maybe see if I can get this
problem fixed.

Thanks,
George