Maybe I have being on this too long that I cannot see the forest for the tree anyway
say you have this array {-6,0,1,3,-5,0,-2,7,0,-10,2}
You want to be able to find all the negative numbers in this array and return the index value. The answer in this case {0, 4, 6, 9}
I tried the "find in array" node but it can only take a value, nor "if" or "lower than" node as input.
I would like to avoid the repeat node if possible. Thanks for the help!
Selecting values in array
- Daniel Brassard
- Posts: 878
- Joined: 18 Mar 2010, 23:38
- Location: St. Thomas, Ontario
- Contact:
Selecting values in array
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif
Re: Selecting values in array
Last edited by iamVFX on 13 Oct 2012, 23:08, edited 1 time in total.
Re: Selecting values in array
Hahaha, I love it. Such a simple yet awesome solution.
- Daniel Brassard
- Posts: 878
- Joined: 18 Mar 2010, 23:38
- Location: St. Thomas, Ontario
- Contact:
Re: Selecting values in array
Thank you IamVFX,
Like Chris_TC said, simple but elegant. It never occured to me to feed the second port.
Cheers!
Dan
Like Chris_TC said, simple but elegant. It never occured to me to feed the second port.
Cheers!
Dan
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif
- Daniel Brassard
- Posts: 878
- Joined: 18 Mar 2010, 23:38
- Location: St. Thomas, Ontario
- Contact:
Re: Selecting values in array
With this simple trick, I was able to do this:
Test if a point is inside, on the surface or outside. The first step toward the marching cube or marching tetra!
Test if a point is inside, on the surface or outside. The first step toward the marching cube or marching tetra!
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif
Re: Selecting values in array
Now that sounds promising! Keep goingDaniel Brassard wrote:The first step toward the marching cube or marching tetra!
Re: Selecting values in array
Nice one, so usefull... I was stuck on my problem untill I found this topic.
Here how I used your trick:
I was making some tracks on the ground on the path of a snake.
Let's say the ground is hit by the snake at each frame. Each points receive a boolean data "touch" when they are touched for the first time. At each frame I also create a scalar data called "DisplacementY", which is the current Y distance to the initial Y position. Afterwards I create a "get nearby points".
Here was my problem: get the average "DisplacementY" of the nearby points using the already touched points only.
I use the index array in "find in array" to remove this array from the other array...
Many thanks again!
Here how I used your trick:
I was making some tracks on the ground on the path of a snake.
Let's say the ground is hit by the snake at each frame. Each points receive a boolean data "touch" when they are touched for the first time. At each frame I also create a scalar data called "DisplacementY", which is the current Y distance to the initial Y position. Afterwards I create a "get nearby points".
Here was my problem: get the average "DisplacementY" of the nearby points using the already touched points only.
I use the index array in "find in array" to remove this array from the other array...
Many thanks again!
Re: Selecting values in array
Now, with recent Reinhard's found, you can do it without Find in Array node
[rimg=1100]http://i.imgur.com/WpRrDy9.png[/rimg]
[rimg=1100]http://i.imgur.com/WpRrDy9.png[/rimg]
Who is online
Users browsing this forum: trendiction [Bot] and 31 guests