WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-20-2011, 01:55 PM
starlingstm starlingstm is offline
Member
 
Join Date: May 2011
Posts: 19
Converting floats

I'm working on a project that instruct students on how to connect a 6 Bar Quick Return using ARtoolkit. So far I'm able to track the marker and receive/print the position. My goal: when the students match the assigned location of a marker, their prompted to move to the next connection. I wrote an 'if' statement with assigned location for the x,y,z coordinates, but I need to know how to equate the x,y,z coordinates with a pre-set number. Below is my coding. I don't get an error message, the code skips down to the else statement. Some how I need to convert the float to integers or vise versa.

import viz
import vizact
import vizshape
viz.go()

ar = viz.add('artoolkit.dle')

camera = ar.addWebCamera()
board = camera.addMatrixMarker(0,width=1000)
camera.setGlobalMarker(board)



box = camera.addMatrixMarker(1,width=1000)


def showData():
for number in range(5):
box_pos = box.getPosition(viz.REL_GLOBAL)
for pos in box_pos:
if box_pos [0] == -2.0 and box_pos[1] == -3.0 and box_pos[2] == 14.0:
print box_pos, 'Box is connected properly; Move to the next connection'

else:
print box_pos



vizact.ontimer(2,showData)
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a character to a number jassel41 Vizard 1 02-10-2010 07:37 AM


All times are GMT -7. The time now is 04:22 AM.


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