Weird Function TRIANGULATE in IDL

Time to update my blog again. It’s been more than a year since my last update after all. Today I encountered with a weird error in IDL when trying to improve computation precision of own polar transform image routines. The source was traced back to function TRIANGULATE. So far I really have no idea about why it occurs. The example is as follows:

IDL> theta=dindgen(360L)
IDL> rad=dindgen(500L)
IDL> xpol=rad#cos(theta/1.8d2*!dpi)
IDL> ypol=rad#sin(theta/1.8d2*!dpi)
IDL> triangulate,xpol,ypol,tri
% TRIANGULATE: Points are co-linear, no solution.
% Execution halted at: $MAIN$

However, if I type the following TRIANGULATE works flawlessly:

IDL> xpol=rad#cos(float(theta/1.8d2*!dpi))
IDL> ypol=rad#sin(float(theta/1.8d2*!dpi))
IDL> triangulate,xpol,ypol,tri
IDL> help,tri
TRI             LONG      = Array[3, 358920]

This is really annoying, as I can’t figure out how come co-linearity can be related to float or double precision whatsoever. Not sure if anyone could help this for me, but I just throw this problem here and see if there’s anyone else faced with the same encounter so that we can potentially sigh together…

Weird Function TRIANGULATE in IDL

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s