Rigbox
Rigbox copied to clipboard
circLayer should work with signals inputs
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?
It seems the preference of @dendritic is to implement functions like round
, so that's what we'll do here.
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?