Jump to content
Benson Shaw

Create and Rotate a line in polar coordinates. Primes

Recommended Posts

Total Marionette beginner here.

Spiral pattern of dots in polar coordinates looks like a thing that could be done in vwx with marionette:

 

Therefore, trying to make a bunch of lines in polar coordinate that start at Origin and have

Length = R, Angle = θ (radians about the origin)

such that R=θ

eg 2,2 represents a line of length 2 that is rotated 2 radians.

 

This is my attempted network to make any one of the lines:

image.thumb.png.acbd44080b40e744ea28c2cb2a4e0885.png

 

This net returns a line on x axis of Length = value in the Int node (eg 2, or 5, or other integer). But no rotation.

Perhaps because the pEnd needs both x,y?  With only 1 input (x) from the Int node it assumes y =0 and ignores the rotation.

Strange, but the net returns nothing if I name any of the nodes. eg if I name the Point2 node 0_0 to indicate the origin.

 

If I ever get the line part, I would then try to replace the Int node with a network made to step through a range of prime numbers and return a line for each prime, and place a dot at the end point of each line, to produce the fun spiral pattern. Oiy, so much to learn!

 

Or

Maybe a better approach is to forget the lines and directly place dots based on sine & cosine of the polar coords?

Have to think about that one.

 

Also I see no prime number node.

What is technique for accessing external list of primes (eg in a worksheet or text block )?

 

Any suggestions or help or pointers to resources welcome.

 

Thanks

-B

Share this post


Link to post

Hi Benson,

 

I'm not a Marionette expert but I do know various "rotate" nodes do different things. I think I would try either the Transform2 node or the Rotate Line node for rotation -

1741049151_ScreenShot2019-10-16at7_57_42AM.thumb.png.230f630d029fb2287c1f76b3f695c26a.png1851981911_ScreenShot2019-10-16at7_58_01AM.thumb.png.fb566fb21c10e2d2e8c8cd572af60a75.png

 

Kevin

 

 

Share this post


Link to post

Here's a quick network that will rotate a line. The bottom version uses a manually entered list of primes to generate a series of lines.

 

1773092895_ScreenShot2019-10-16at8_56_22AM.thumb.png.e760faa10e2a1d1ec5f8e276e2f5f16e.png

 

@Marissa Farrell may be able to help with a node to generate prime numbers in a certain range. There's lots of info online about using Python code and/or Python libraries with functions to generate prime numbers.

 

Kevin

 

 

Rotate Line.vwx

  • Like 1

Share this post


Link to post

Thanks, Kevin!  These things are impenetrable without some experience.  Maybe I will start getting that experience with little steps like this.  I found several other rotate nodes, but missed the Rotate Line (and probably would have failed to get it working).

 

-B

Share this post


Link to post

OK, continuing my journey.

1st a mystery in the single line test. The 1st part of the network returns a rotated line, but the rotation seems to use negative value of the angle developed by the polar conversion.  Same flip if angle is directly called with an Integer Node or a Real Node instead of the polar.

image.thumb.png.096c8f5b5c36324ac11db6744b256301.png

 

Ignoring that for now, some success!

Veterans may snigger. But baby steps!

Now looking for way to input a few 1000 primes.  Access an external list?

@Kevin McAllister I'm not code experienced since cursory X Basic use about 50 years ago (if 26, then go to line 14, if 27, then go to @#$%), but will try looking through some of the Python resources.

Might also mean customizing a copy of the Ordered List node.

 

-B

 

image.thumb.png.4e03e0462bbf01f6f09344af7313bf1a.png

 

Share this post


Link to post

OK, switched to Integers for now. Makes really nice swirls with about 5K dots.  But another mystery ensues:

 

Set up the network to produce the dots by integer pairs, and at end added nodes to transfer the dots to different layer and class.  This slows the network runtime.  Without the transfer nodes at end, runtime for 5000 dots is a few seconds.  Layer/Class change makes runtime about 30sec.  At 50K dots, the runtime is maybe 30 seconds with no layer/class change and about 15 min with the layer change.  Seems the layer change is acting on individual dots rather than on the group created by network.

 

Do I need a different strategy for layer/class designation? Manually moving the resulting group to different layer and class requires only about 10 seconds.

 

-B

 

image.thumb.png.efa3398e685f940e64d9de2f3c4d42cb.png

 

image.thumb.png.b67dac81e244612523dbc6314b8b5da1.png

Swirls v2019.vwx

Edited by Benson Shaw
v2019 file
  • Like 1

Share this post


Link to post

Perhaps you could try using the group node to group all of your points before changing their layer? In general however, I would recommend simply running the network with the layer that you want the objects to end up on as the active layer. 

 

I also assume that it is the act of setting the layer that eats up the most time and not setting the class. Have you experimented with only changing the class?

Share this post


Link to post

@sbarrett Thanks for looking!  The time lag is indeed mainly with the layer.  But, I want to keep the network out of view and have the result isolated on its own layer, so for now I will just have to put up with the lag.  Will try a group node before the class/layer change.

 

Horsing around this this more in last few days. File attached.

• Added nodes to incrementally increase dot diameter.

• Modified a Series node to produce series of Primes (will add to resources for hive mind improvements).

• New layer with network for prime pairs.  Sort of works, but not quite like the video at start, so needs trouble shooting.

• Saved views for Integer Network 

 

Here's the network made with 5000 integers (about 15 seconds)

image.thumb.png.800606d916985b00ef8eecd964d509ae.png

 

Here's Primes btw 0>10000

Note: There are only 1229 primes in that range, so the dot size count uses manual adjust.

Need to figure out a count from the Prime series and wire that to the count.

image.thumb.png.9cf10c8ec1e35a3028b14a8394e8e9e0.png

 

Swirls v2019.vwx

Share this post


Link to post

Here's the network with dot radius controlled by a Series node.  Radius increases by the step increment and the series count is equal to the number of primes found in the range.

Anyone suggest some efficiencies/improvements?

image.thumb.png.f23a66c7645146c900c09e8a3bdff2b4.png

 

 

 Here's primes btw 0>500000.  Run time is 10 min to 15 min for this vs only a few seconds for range of 100000.

image.thumb.png.4649100ec4d29215cd207c55e2925013.png

  • Like 1

Share this post


Link to post

Is there a reason why you can't substitute the Count, Add List, and Int nodes for a Get List Length node because essentially isn't that what you are doing? Do values in the prime series repeat? 

Share this post


Link to post

Also, this network is super fun to play with! Just to try it, I converted your Integer Swirl to a Marionette object with sliders and also added the ability to fill the objects with a range of colors.

 

Swirls v2019-SB.vwx

  • Like 2

Share this post


Link to post
6 hours ago, sbarrett said:

Is there a reason why you can't substitute . . .

This is why you are in management and I'm a clerk in the mail room.  I'm just starting to explore Marionette. Great to have comment and mods from a master. I tried several ways to find/report the length of list (number of items). I might have tried (possibly incorrectly) the Add List. I think it was returning a value of 1 for each item in the list, but not adding the ones.  Or something.

 

7 hours ago, sbarrett said:

Do values in the prime series repeat? 

No, the prime numbers are uniques in the list.  Any item in the list has a greater value than all of its preceeders and smaller value than all of its followers.  Same behavior in the integer list.

 

If I change parameters, via slider or key, in your cool modified SB Marionette object, an error dialog is generated.  If I choose either Close, or Select Node, the dialog closes and the M Object updates to the new values.  ??? 

 

Note, just started using v2020, so looking at translated file.

 

image.thumb.png.fb41bb800b0457ecb9190f485edb18b6.png

Share this post


Link to post

I realized what was wrong. In your original script in the 2019 version, you had the prime value input into the Line node, instead of converting it to a point first. For some weird reason, this worked in 2019. I have updated the script so it works in 2019 and 2020. The other exciting thing is that in 2020 there is a big improvement in graphics performance.

 

Swirls v2019-SB.vwx

Swirls v2020-SB.vwx

  • Like 2

Share this post


Link to post

OK, just ran the node a couple times in both 2020 and 2019. Lovely, you two. Thanks so much for helping unveil the mysteries of Marionette. It was not so long ago I needed a tool like this.

Share this post


Link to 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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...