WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-10-2010, 01:38 PM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Small doc error & clarification

In the docs for viz.phys.intersectLine(), the last argument is called 'listAll'; 'all' is correct.

On this page and for viz.phys.intersect() it states that the function returns a VizIntersect object; if 'all' is True, it returns a list of VizIntersects.
Reply With Quote
  #2  
Old 02-10-2010, 02:16 PM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Unhappy

viz.phys.intersectLine() doesn't seem to work with all=True, anyway; I never get more than one intersection. viz.intersect() (sorry, mis-typed it in the original post) works fine, though.
Reply With Quote
  #3  
Old 02-11-2010, 07:25 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Doc problems for those who like keyword args...

It seems that the argument names in the docs often don't match those in the code; that is, the docs make it look as though you can pass arguments in keyword form (which I think makes for more readable code), but it often doesn't work that way using the names as given. Of course, I can always look at the source...
Reply With Quote
  #4  
Old 02-12-2010, 10:36 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Thanks for the note the about the incorrect argument name. If you notice something like that again, please mention it and we'll make the correction.

Here's an example that uses all = True with viz.phys.intersectLine() to turn intersected nodes.
Code:
import viz
viz.go()

box = viz.add('box.wrl', pos = [0,1,5])
shape1 = box.collideBox()
box2 = viz.add('box.wrl', pos = [0,1,7])
shape2 = box2.collideBox()

def FireLine():
	line = viz.MainWindow.screenToWorld(viz.mouse.getPosition()+[0])
	dir = viz.Vector(line.dir)
	dir.setLength(200)
	begin = line.begin
	end = line.begin + dir
	info = viz.phys.intersectLine(begin,end, all = True)
	for i in info:
		i.object.color(viz.BLUE)
		
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,FireLine)

viz.mouse(viz.OFF)

Can you post an example where it did notwork for you?
Reply With Quote
  #5  
Old 02-16-2010, 07:42 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Actually, I think it's just me not realizing that viz.phys.intersectLine() and viz.intersect() behave differently when all==True. viz.intersectLine() tells you which objects are intersected (one intersection/object), whereas viz.intersect() gives you every intersection point (e.g, where the line intersects front _and_ back faces of the same object)--which is the behavior I was looking for.

I guess the docs could be a bit more explicit about that.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PPT movement in small area durf Precision Position Tracker (PPT) 1 02-26-2009 12:02 PM
PPT movement in small area using vizard 3.0 durf Vizard 3 02-24-2009 09:34 AM
Small Vizard programming Jobs? realvision Announcements 0 03-17-2008 08:53 AM
Tracking a small space aaThomas Precision Position Tracker (PPT) 3 05-31-2007 10:59 AM
Full screen window changes to small window tacbob Vizard 1 04-04-2007 09:30 AM


All times are GMT -7. The time now is 07:27 AM.


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