[Fluxus] pdata-op "closest"

Dave Griffiths dave at pawfal.org
Mon Aug 25 08:34:44 PDT 2008


On Mon, 2008-08-25 at 09:12 +0200, gabor papp wrote:
> i am playing with particles. i can read the position of the closest 
> particle to each particle by using (pdata-op "closest" "p" i), where 'i' 
> is the particle index.
> 
> i am also trying to read the colour value of the closest pdata, but it 
> didn't work. (pdata-op "closest" "c" i) :
> 
> ClosestOperator has no operator for types: 
> PN6Fluxus10TypedPDataINS_7dColourEEE and f expected vector (size 3) 
> value in pdata-set
> 
> because "closest" can be used with either a vector or an index, i was 
> thinking that maybe if i submit a vector i get back and index that could 
> be used to retrieve the colour value, like:
> (let* ((v (pdata-op "closest" "p" i))
>         (c (pdata-ref "c" (pdata-op "closest" "p" v)))))
>       ...)
> 
> but it returned a vector in both cases. or wouldn't it make sense to use 
> "closest" with any kind of pdata? i suppose other pdata-op's can be used 
> with any kinds of pdata as long as their type matches to the operator.
> 
> could you suggest a method how i could do this? thanks in advance.

I don't think there is a good solution to this yet (other than do the
search in scheme, which would be too slow). The situation with pdata-op
and pfunc is confusing. 

They both attempt to do the same thing at different scales - pdata-op
was really meant for simple SIMD operations, adding pdata arrays
together etc. pfunc was where I had to put the skinning and similar
operations, which need to take more complicated parameters.

Now we also have some evaluation functionality for polygons (although
the interface allows it to work on any primitive), I was going to add a
get-closest-point which would evaluate the closest point on the closest
face - we should get particles honouring the same interface - and
returning evaluated pdata in exactly the same way ...

So maybe we use...

pdata-op : for + - * / between arrays or arrays and constants

pfunc : for complicated deformations (skinning, blending ...)

primitive evaluators : (line-intersect) (ray-intersect) 
	(closest-point) ... for speedy complex evaluations of geometry

I'll try and think up some better names for these things.

cheers,

dave




More information about the Fluxus mailing list