Poor quality parametric curve rendered in Processing display window

Using Processing 2.0b6 on a Windows 7 PC, I've grocked some GeoGebra code to write a sketch that plots a parametric curve (the example I've been playing with is a cardioid). It does this by generating a point distribution that is 'curvature aware'.

A horrendously messy - but working - version of the sketch is here, and a stripped down version that includes an array of points belonging to the cardioid but not the curve-plotting algorithm that generated it is here.

The problem is the way in which the curve is rendered as a polyline in the Processing display window when each of the points in the point distribution is connected. This image shows how hairy and lumpy the rendering is, but... and this is the nub of the issue... check out this beautifully smooth pdf rendering.

What's going on here? The (almost) flawless vector graphic makes me confident that the problem isn't the point distribution but rather something to do with the to-pixel rendering for the display window (I know my terminology is imprecise here). Is the shifting and scaling affecting things? Is the to-pdf converter doing something fancy with the point distribution?

I'm puzzled. Any help / insights would be massively appreciated.

By the way, if anyone's interested, I've also coded up the cardioid in Java (again, the code is messy but functional):

cardioid.java

and openframeworks:

main.cpp

testApp.h

testApp.cpp

with resulting pdf:

cardioid_cpp.pdf.

Sign In or Register to comment.