Color points by proximity/density?
7796 6 0-
- stu
- Member
- 244 posts
- Joined: July 2005
- Offline
I'm having a “senior moment” and I'm stuck on something that I'm sure is relatively simple - what's the best way to color points or particles based on their density or proximity to each other? I want to increase point color where the area density of the points is higher. Density *$CR, in a nutshell. And as a supplemental question, how best to bake that point cloud information into a texture lookup?
-
- zdimaria
- Member
- 386 posts
- Joined: Jan. 2012
- Offline
-
- VisualCortexLab
- Member
- 508 posts
- Joined: July 2005
- Offline
point clouds and a while loop.
I use this all the time.
I use this all the time.
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
VisualCortexLab Ltd :: www.visualcortexlab.com
-
- cabegesoop
- Member
- 2 posts
- Joined: Oct. 2016
- Offline
for any one looking at this post in 2019 just put this piece of vex code in a point wrangle its much more efficient.
int pc = pcfind(0,'P',@P,ch('maxdist'),ch('maxpt'));
@Cd = float(len(pc))/ch('maxpt');
explanation on how the code works:
pcfind generates an array with the maximum size of maxpt
len counts how many items there are in the array and divides it by maxpt to get a 0-1 value the float conversion is there as len returns an int and if its not converted the division would return an int giving us a binary 0 or 1 value.
To visualCortexLab if you ever read this thankyou for the inspiration on how to do this.
i dont know if its only for me but the website isent showing the square brakets that are after int pc“square brakets here”
int pc = pcfind(0,'P',@P,ch('maxdist'),ch('maxpt'));
@Cd = float(len(pc))/ch('maxpt');
explanation on how the code works:
pcfind generates an array with the maximum size of maxpt
len counts how many items there are in the array and divides it by maxpt to get a 0-1 value the float conversion is there as len returns an int and if its not converted the division would return an int giving us a binary 0 or 1 value.
To visualCortexLab if you ever read this thankyou for the inspiration on how to do this.
i dont know if its only for me but the website isent showing the square brakets that are after int pc“square brakets here”
Edited by cabegesoop - March 11, 2019 19:05:33
-
- ouroboros1221
- Member
- 79 posts
- Joined: Feb. 2016
- Offline
-
- luidox
- Member
- 31 posts
- Joined: Oct. 2018
- Offline
-
- mestela
- Member
- 897 posts
- Joined: May 2006
- Offline
-
- Quick Links