Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unifying float creation #164

Closed
ly29 opened this issue May 13, 2014 · 10 comments
Closed

Unifying float creation #164

ly29 opened this issue May 13, 2014 · 10 comments

Comments

@ly29
Copy link
Collaborator

ly29 commented May 13, 2014

One Sverchok strategy is configurable multimode nodes grouped logically.
We have Range and Series that makes float series, I think they should be group into one node.

They use:

  • Start, Stop, Step
  • Start, Stop, Count (called divisions)

I propose a third mode.

  • Start, Step, Count

And that we unify them like the new Int Range node.

What should the call the three modes be called, one hand we have the old nodes and their names.
Series and Range which are logical but don't really match up.

@zeffii
Copy link
Collaborator

zeffii commented May 13, 2014

maybe a menu heading sequence generators, where nodes go that generate iterables.

@ly29
Copy link
Collaborator Author

ly29 commented May 13, 2014

We should take look at the menu and try organize is a bit more in general.
Also had an idea for them to accept a list of steps. Tricky to manage right now though.
Start=1
Stop=10
Step=[1 2]
Would become [1 2 4 5 7 8]

@zeffii
Copy link
Collaborator

zeffii commented May 13, 2014

man.. if nodes had multiline text input...( i suppose not too hard to add really ) this would be excellent ground for a formula3 node

@ly29
Copy link
Collaborator Author

ly29 commented May 13, 2014

xfrange from node series

    def xfrange(self, start, stop, step):
        while start < stop:
            yield start
            start += step

xfrange from node range, modified version. note that it ensures that start and stop is exactly first and last. divisions must equal or larger than 2.

    def xfrange(self, start, stop, divisions):       
        step = (stop - start) / (divisions - 1 )
        count = start 
        yield start
        for i in range( divisions - 2 ):
            count += step
            yield count
        yield stop

And last could be like this.

def last_range(start,step,count)
    for i in range(count):
        yield start
        start += step

@ly29
Copy link
Collaborator Author

ly29 commented May 13, 2014

Line and Plane accepts lists for step, which is cool but makes it harder make them parametric in clean way with other options.

@zeffii
Copy link
Collaborator

zeffii commented May 13, 2014

i need to make that primitives node.. soon!

@ly29
Copy link
Collaborator Author

ly29 commented May 13, 2014

Now it just needs to be tested and verify the inputs so it is terminating.
https://gist.github.com/ly29/e1238e02671e5f96df1c

@ly29
Copy link
Collaborator Author

ly29 commented May 19, 2014

floatseries
Now the different modes just need better names. Any suggestions?
There are two different ideas in my head.
1 Too keep current slightly confusing naming with series and range and make up third name for the last mode
2 To map the name more towards python.

Otherwise it works as one would except now, allowing negative series etc, some sanity checking for small step value, using 1e-5, to big?

https://gist.github.com/ly29/4662a75f7791a9d173ac

@ly29 ly29 mentioned this issue May 19, 2014
18 tasks
@nortikin
Copy link
Owner

range is ok

@ly29
Copy link
Collaborator Author

ly29 commented May 20, 2014

So modes:

  • Range = Start, Stop, Step
  • Count = Start, Stop, Count
  • Step = Start, Step, Count

Anyway will commit like this. The naming can be adjusted.

@ly29 ly29 closed this as completed May 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants