Re: [cgkit-user] Bezier Curves
Brought to you by:
mbaas
|
From: Paul W. B. <pa...@pu...> - 2010-02-05 15:40:54
|
Hi Matthias,
>> 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]]
outTangent1 = [ap[1][0]-ap[0][0],ap[1][1]-ap[0][1], ap[1][2]-ap[0][2]]
inTangent2 = [ap[2][0]-ap[3][0], ap[2][1]-ap[3][1], ap[2][2]-ap[3][2]]
pnts = [BezierPoint(ap[0], vec3(0), outTangent1),
BezierPoint(ap[3], inTangent2, vec3(0))]
crv = BezierCurve("MyCurve", pnts, False, 0.01, 8, True)
I can not increase the subdivisions, 8 is the maximum. If I use more, it
hangs with 100% cpu load and never finishes.
The visualization I get looks like this:
http://purecodes.org/math/beziers/cgkit_opengl_bezier_ints.png
Where I expected something like:
http://purecodes.org/math/beziers/matplotlib_bezier.png
(Latter graph was produced by matplotlib with a bezier drawing
implementation I did on my own, by calculating equally spaced
subdivisions. Don't consider the scale of the axes, this seems to be
something special by the 3d support of matplotlib)
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?
Regards
Paul.
|