Re: [cgkit-user] Bezier Curves
Brought to you by:
mbaas
|
From: Matthias B. <mat...@gm...> - 2010-02-06 11:34:41
|
Hi Paul, >>> Should work. Tried it, but the visualisation is not how I expected it, >>> but this may be due to my data. >> Hm, can you send an example? > > Yes, of course I can. I am trying to visualize a bezier curve with > following control points: > > from cgkit.all import * > > ap = [[4226765.0, -8321830.0, 15489144.0], > [4226764.0, -8321840.0, 15497220.0], > [4226762.0, -8321840.0, 15504724.0], > [4226761.0, -8321859.0, 15511768.0]] Look at the ranges of your coordinates. This curve is pretty much a straight line which is what you get in the viewer tool. As you have already noticed yourself, in matplotlib you only see some variation because it uses different scales for the three axes, so what you see is kind of a "distorted" view of the curve. In the viewer tool, the scale of all 3 axes is always the same, so the variation in x and y is not noticeable (unless you zoom in very closely in which case you might get all sorts of other problems). By the way, if at all possible, I would also recommend shifting the curve so that the values are somewhat centered around the origin. I'd say with such large magnitudes and small variations you might run into numerical problems sooner or later. > I can not increase the subdivisions, 8 is the maximum. If I use more, it > hangs with 100% cpu load and never finishes. What values did you use? It will finish eventually, but it's just that the more subdivision steps you ask for, the more time it takes to compute the curve (and the Bezier curve is still pure Python, so it's not particularly fast). The total number of subdivision steps will be (2**subdiv)-1. > It just came to my mind that may be this is due to the axis scaling. I > will try further to adjust this in matplotlib or/and with cgkit. Is > there a way to include a coordinate system/grid in the cgkit 3d scene? Not yet, unfortunately. As a workaround, you could use drawLine() or drawMarker() to add some guides to your scene. Cheers, - Matthias - |