> Does NSBezierPath do decimation as well as interpolation? I didn't find it in 
> the Class Reference.

It does whatever it needs to do in order to achieve "great" results, where 
"great" is in practical terms something like "an order of magnitude finer than 
pixel resolution".

Last I checked, it did not do any filtering - if you feed it a billion points 
that happen to represent a single line, it will perform as if for a billion 
points, not two.

> In my application, the math generates  hundreds of points for accuracy, for 
> every one that needs to be plotted to make a decent looking plot. Signal 
> processing theory says that you can't just throw away points, or you can 
> generate errors.

Indeed.  The question is how large those errors are compared to the pixel 
resolution.

> For example, I might generate 25,000 points and be happy to look at a 200 
> point plot. Throwing 25,000 points at NSBezierPath might swamp it, or at 
> least run very slowly.

NSBezierPath can handle millions of points in certain circumstances.  Where by 
"handle" I mean draw the path in a time on the order of hundreds of 
milliseconds.  That said, if you can pre-filter your path so that you don't 
provide unnecessary points (considering the output resolution) you might save 
yourself and your users a lot of waiting.

FWIW a trivial "is this point greater than 0.1 pixels away, in Cartesian 
distance" drop filter has worked well for me in the past, producing results 
that are essentially visually indistinguishable.  It has it's weakness, 
obviously, but tends to work well on "real world" data (i.e. data that isn't 
extremely high frequency and amplitude relative to the view size).  And when it 
doesn't work so effectively, users tend to prefer the visual accuracy over 
performance, since the difference in those cases can be so significant.  But 
your users may vary.

FYI if your line width is one pixel or lower NSBezierPath uses a much faster 
algorithm (as in, several orders of magnitude faster, in some circumstances).  
So keep that in mind.  Also keep in mind that the vast majority of its time, 
for many-point paths, is spent determining intersections.  If you can render 
your overall path in segments via multiple NSBezierPaths, that'll be much 
faster.

Also, NSBezierPath caches a lot of key info, so hold on to your references if 
you can reuse them.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to