# Useful Geometry

## Recommended Posts

Here are a couple wrappers that output sine and cosine waves. I thought the math enthusiasts might find these useful.

Edited by sbarrett

Sarah: thanks for sharing this.

Coincidentally, last week I thought I'd start with something 'simple' and try to make a sine wave in Marionette. (I had seen several Grasshopper tutorials on it, and it didn't seem overly complicated). Now that I see your Marionette example — wow — was I wrong.

I wish I could create something with this sine wave object, but lacking even a basic understanding of Marionette I wouldn't even know where to begin.

@sbarrett - before I saw your post, I was attempting to try and create a cosine wave in Marionette, having been inspired by this Grasshopper tutorial on making a parametric brick wall.

Does it seem like something like this would be possible in Marionette, using your file as a starting point? Thanks.

Yes I definitely think it would be possible, although you would go about it differently in Marionette than you would in Grasshopper. In Marionette, I would suggest you create the bricks first and distribute them (Move) to points along a sine wave line at each brick z level. You might need to do a little clever maneuvering to get the tangent vectors for each point (because there isn't a tangent node that I am aware of), but once you do, all you need is to translate those vectors into a rotation and use the rotation node along with the move node.

There are several nodes that work similarly to Grasshopper's Dispatch component, and they are in the Data Flow menu. For example, Filter, If, and Unzip are all nodes that parse lists.

I hope that helps - If you get stuck, I will be happy to offer suggestions!

Sarah - thanks for the advice and direction. It sounds like I would get lost pretty quickly, but I'll still give it a shot.

It sounds like a 'Tangent Vector' node is something that should be added to Marionette?

Tim - I would start with one of the aspect of the wall - a definition can get complex and overwhelming very quickly - but if you break down the problem into smaller projects you can combine them later. With the wall for example, don't try to build a parametric brick wall, try creating a series of locus points in 3D. Then try distributing rectangles along a line, etc. If you think of a project in much smaller, simpler steps it will be easier to build in Marionette. Also, those individual parts can be used over again in different definitions.

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```

Edited by Ilay

I have reattached the file in the original post.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×