Fri 19 Jun 2015 06:40:49 PM UTC, comment #2:
1) Indeed. That is the intention of the method.
2) npre=100 is indeed per part. The default value is aimed at the beginner, who probably only has a few curves, with a few parts, so using 100 subdivisions does not hurt performance, and has the advantage of creating nearly equidistant points, which is what the user would expect when using equidistant=True.
The well-trained power user on the other hand will read the documentation and understand that he can improve performance at the cost of some accuracy by specifying a smaller value for npre ;)
|
Fri 19 Jun 2015 02:49:44 PM UTC, original submission:
Hi,
equidistant does not work in curve.approx(). Please run example below.
One comment: it seems that pre-approximation is pre-approximating each curve part and not on the full curve (as it was some time ago). I think before it was better because if you want N equally spaced segments it would be better to pre-approximate the full curve with 10*N parts, and not each single part in 10 sub-parts.
Please run following example to check the lenghts after equidistant approximation.
clear()
b = Coords([
[0., 0., 0.],
[1., 0., 0.],
[5., 2., 1.],
[6, -1.0, 0.],
[8, 1, 0.],
])
from pyformex.plugins.curve import BezierSpline
B = BezierSpline(b)
draw(B)
A = B.approx(nseg=5,equidistant=True,npre=100)
draw(A, color='red')
print (A.lengths().min(), A.lengths().max())
# even increasing npre the lengths of the parts are wrong!
|