View Single Post
  #1  
Old 10-30-2006, 01:10 PM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
Locating the Coordinates of Vertices for on the fly objects

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.

Code:
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
Reply With Quote