bugpyFormex - Bugs: bug #45358, curve.approx is wrong if...

 
 

bug #45358: curve.approx is wrong if equidistant is True

Submitted by:  gianluca de santis <gianlucadesi>
Submitted on:  Fri 19 Jun 2015 02:49:44 PM UTC  
 
Category: PluginsSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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 ;)

Benedict Verhegghe <bverheg>
Project Administrator
Fri 19 Jun 2015 03:32:20 PM UTC, comment #1:

1) I was wrong, the curve is split into equidistant parts, but if you connect the points with a polyline they will not be at the same linear distance.
2) About the pre-approximation: should it be on full curve or on each part? If it is on each part we could reduce the default value (now 100).

gianluca de santis <gianlucadesi>
Project Member
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!

gianluca de santis <gianlucadesi>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bverheg (Posted a comment)
  • -unavailable- added by gianlucadesi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 19 Jun 2015 06:40:49 PM UTCbverhegStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1