Re: tye and container whoes

2019-11-01 Thread ingo
Thanks for pointing out the distinction in use of table and object. That helps. In python I would probably do: spline = { 't': [], 'xy': [], 'v': [], 'a': [], 'length': [] } Run and then instead of seqfd1.add(fd1) in the final loop

Re: tye and container whoes

2019-11-01 Thread ingo
> [https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html](https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html) Haha, you're going to fast for me :) my programming skills are 'minimal' and mostly POV-Ray SDL so I try to go step by step. I'll study! Thanks.

Re: how return false or value?

2019-11-08 Thread ingo
Ah. I'll have a go at it. Thanks.

Re: how return false or value?

2019-11-08 Thread ingo
Actually solved it in a different way, created an enum to pass meaningful information to the next proc. type Intersection = enum intersect, parallel, zerolength, notsegment proc lintersect(p1, .): (Intersection, Vec2) = ...

Re: tye and container whoes

2019-11-07 Thread ingo
In the end I kept it simple: [https://gist.github.com/ingoogni/ed87bc92c5d2a2da5038dd368a238ac5](https://gist.github.com/ingoogni/ed87bc92c5d2a2da5038dd368a238ac5) Thanks.

how return false or value?

2019-11-08 Thread ingo
some of my procs can have no result so I'd like them to return false or a value. For now I have proc lintersect(p1, p2, p3, p4: Vec2, segments=false): (bool, Vec2) = . if parallel return (false, vec2(0,0)) . . return (true, vec2(x,y)) Run

tye and container whoes

2019-11-01 Thread ingo
Being new at this I ran into several problems. First some code: import vmath type Seg = array[4, Vec2] Segs = array[4, Seg] Spline = tuple[t: seq[float32], xy: seq[Vec2], v: seq[Vec2], a: seq[Vec2], lengt: seq[float32]] proc bezier(segment: Seg,