Color points by proximity/density?

   6469   6   0
User Avatar
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?
User Avatar
Member
386 posts
Joined: Jan. 2012
Offline
so im not sure if this is the best way, (i dont think its entirely accurate), but i think it works

Attachments:
colorbydensity.hipnc (115.8 KB)

.
User Avatar
Member
506 posts
Joined: July 2005
Offline
point clouds and a while loop.
I use this all the time.

Attachments:
density_vopsop.hip (135.6 KB)

JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
User Avatar
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”
Edited by cabegesoop - March 11, 2019 19:05:33
User Avatar
Member
79 posts
Joined: Feb. 2016
Offline
cabegesoop
int pc = pcfind(0,'P',@P,ch('maxdist'),ch('maxpt'));
@Cd = float(len(pc))/ch('maxpt');


nice tip, the simplest solution is usually a better one
User Avatar
Member
12 posts
Joined: Oct. 2018
Offline
cabegesoop
int pc = pcfind(0,'P',@P,ch('maxdist'),ch('maxpt'));
@Cd = float(len(pc))/ch('maxpt');


how do you do this in VOP?
User Avatar
Member
723 posts
Joined: May 2006
Offline
luidox
how do you do this in VOP?

Attachments:
pcfind_vop.PNG (38.8 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://animallogicacademy.uts.edu.au/ [animallogicacademy.uts.edu.au]
  • Quick Links