WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-02-2015, 03:25 AM
seal seal is offline
Member
 
Join Date: Oct 2013
Posts: 8
How to set the color of a group of points depending on their positions very quickly

Hi,

I need to draw around 6000 points that are evenly and randomly distributed in a cubic shape volume. Most of them are white, but those that fall into some randomly located cylinder-shaped volumes (within the cubic volume) should be in other colors (e.g. green or red). I was wondering if there is a way of doing this very quickly rather than using an if-statement for each point as 6000 points may take a very long time to render in such a way?

This is how I draw the points:

Code:
import viz
import numpy as np

viz.go()
number=6000
positions=np.random.uniform(low=-12/2, high=12/2, size=(number,3))

viz.startLayer(viz.POINTS)
viz.pointSize(2)
for i in range(number):	
	viz.vertex(positions[i,:].tolist())
points=viz.endLayer()
In addition, I was wondering if there is a way of drawing all the points together rather than using a for-loop to do it individually?

Any advice would be highly appreciated.
Reply With Quote
  #2  
Old 02-03-2015, 05:16 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,465
Do you only need to check if the points are within the cylinder shapes at the time of object creation? If so, that should be fine.
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 03:50 AM.


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