Grasshopper

algorithmic modeling for Rhino

Hi,

I have a list as follows:

{0} (N=144)

 

I made a mapping as follows:

{A}(i) -> {i/4}

 

This divides the original list in a list with 37 paths:

{0} (N=3)

{1} (N=3)

{2} (N=5)

{3} (N=3)

{4} (N=5)

... etc...

 

I need 36 paths and so I tried the following mapping:

{A}(i) -> {i/(144/35)}

 

that works in that I get my 36 paths but again the number of elements in each path is not constant.

I need 4 elements in each.

 

Any clues?

thanks,

wim

 

 

 

 

Views: 1141

Replies to This Discussion

Cull, graft and weave...

I imagine you can remap the way you want, but I can't help you that way, sorry...
Your problem is a division/rounding one, not anything that has to do with the path mapper. The path mapper needs integers, so when you have 7/4 (which equals 1.75) the path mapper has to decide whether that's 1 or 2. Right now its doing this by rounding, which is not what you want. This is subtle, but what you need to do is whole number division, which will only return the integer result of the division, not the whole value. To do this just use a backslash(\) instead of a forward one, so your output path will be {i\4}
magic.
That works. Awesome.
Thanks Damien!

cheers,
wim
is there documentation somewhere that describes the backslash vs. forward slash?

Or is that just common knowledge?
There's different kinds of division operators. It's a standard part of VBScript and VB.NET language.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
There are 3 flavors of division that's supported. Regular division, whole number division, and modulus division. I am going to make the assumption that you know what regular division is, and I just described above what whole number division does. Modulus division does exactly the opposite of whole number division; the fractional/decimal value would be returned instead of the normal result. Modulus division is a little weird in that its considered an operator (like +, -, or *), but within VB and the expression editor you'd actually use the keyword Mod. So 7 Mod 4 would be .75. Within C# and other c style languages you'll generally see the percent symbol (%) to signify modulus division.
wow... then the backslash what does exactly...?

thanks

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service