1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Bezier - insufficient precision

Posted by Anastasia on Oct 08, 2010

First of all, thank you for NodeBox, it is such a wonderful toy.
I needed a drawing tool that could draw a 1cm line and then print it exactly 1 cm. I used Pyhton + Latex before, but I found that Nodebox is much better. Bezier tools are wonderful.
But it seems I still have to write bezier tools myself, because those from "bezier" library have insufficient precision when calculationg length. Here is an example.

bezier = ximport("bezier")
nofill()
stroke(0)
p1 = Point(100, 0)
p2 = Point(100, 200)
p3 = Point(100, 2010)

for p in [p1, p2, p3]:
oval(p.x-2, p.y-2, 4, 4)

autoclosepath(False)
path = bezier.findpath([p1, p2, p3])
drawpath(path)
L = bezier.length(path)
print(L/cm, 2010/cm)


Results in : (77.134743266364453, 70.908225001322919)


 
Posted by Lucas on Oct 10, 2010

Hello Anastasia,
If you can help making NodeBox better, your help is more than appreciated by making this open source application better,

thanks in advance,

Lucas



Posted by Tom De Smedt on Oct 11, 2010

Why would you use findpath() to draw a straight line?



Posted by Anastasia on Nov 07, 2010

Tom De Smedt,

I use it for this example. The length of this line is obviously 2010/cm, but bezier.length shows different result.