Hello Sarah
It's very useful. Thank you
Can post such example?
I will post code which inside in any dummy node(not wrapper) and somebody can to put it into node code(for example one of points category nodes) + also if you install scipy, numpy(python extesions)
Code based at such code and frensel functions of scipy
'''
Based at http://stackoverflow.com/questions/13308573/scipy-what-are-the-arguments-in-scipy-special-fresnelx-out1-out2
'''
@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
this = Marionette.Node('Frensel Points')
this.SetDescription('Create scipy.frensel Points')
npts = Marionette.OIPControl( 'Number of points', Marionette.WidgetType.Int, 100)
npts.SetDescription('Number of points at curve')
curlsn = Marionette.OIPControl( 'Number of curls', Marionette.WidgetType.Int, 3)
curlsn.SetDescription('Number of curls')
sca = Marionette.OIPControl( 'Scale', Marionette.WidgetType.Bool, False)
sca.SetDescription('Scaled version')
scan = Marionette.OIPControl( 'Scale', Marionette.WidgetType.Int, 1)
scan.SetDescription('Scale of curve')
pt = Marionette.PortOut()
pt.SetDescription('Frensel Points on the xy plane')
def RunNode(self):
import numpy as np
from scipy.special import fresnel
num = self.Params.npts.value
curl = self.Params.curlsn.value
sca = self.Params.sca.value
scalen = self.Params.scan.value
t = np.linspace(-curl, curl, num, endpoint=True)
ss, cc = fresnel(t / np.sqrt(np.pi / 2))
scaled_ss = np.sqrt(np.pi / 2) * ss
scaled_cc = np.sqrt(np.pi / 2) * cc
if sca:
fpts = []
for i in range(num):
fpts.append((scaled_ss[i]*scalen, scaled_cc[i]*scalen, 0.0))
self.Params.pt.value = fpts
else:
fpts = []
for i in range(num):
fpts.append((ss[i], cc[i], 0.0))
self.Params.pt.value = fpts