Rigbox icon indicating copy to clipboard operation
Rigbox copied to clipboard

circLayer should work with signals inputs

Open k1o0 opened this issue 5 years ago • 2 comments

I added a layer function for producing a circle texture in Signals, however this function currently throws an error if the element parameters are signals (rather than constant values). @dendritic I notice you were careful to add all the necessary methods into Signals so that your visual functions would work with Signals. How did you envisage future texture functions that use other, uncommon functions. Take for example the below code in circLayer:

y = round(dims(2) * (0.9^(dims(2)-23)+1));

This code should at some point change anyway, however do you think this is something where it's better to overload round() in Signals, or have some kind of if statement that uses map if dims is a Signal?

fcn = @(dims) round(dims(2) * (0.9^(dims(2)-23)+1));
y = iff(isa(dims, 'sig.node.Signal'), @()dims.map(fcn), fcn);

Do you think it's important for visual element parameters to allow both Signals and otherwise?

k1o0 avatar Mar 01 '19 15:03 k1o0

It seems the preference of @dendritic is to implement functions like round, so that's what we'll do here.

k1o0 avatar Mar 18 '19 12:03 k1o0

It seems the preference of @dendritic is to implement functions like round

this was done in this merge: https://github.com/cortex-lab/signals/commit/d6f816b57d7c899d63825ba8d8226dcff4cffd84

but 'circLayer' still can't take 'dims' as a signal due to the 'meshgrid' function call in the file. https://github.com/cortex-lab/signals/blob/dev/%2Bvis/circLayer.m#L36-L40

I think in this case this have some kind of if statement that uses map if dims is a Signal? may be better?

jkbhagatio avatar May 08 '19 14:05 jkbhagatio