Understanding the gp:pointEqual, gp:rtos2, and gp:zeroSmallNum Functions

Visual LISP

 
Understanding the gp:pointEqual, gp:rtos2, and gp:zeroSmallNum Functions
 
 
 

These three functions are required to get around one of the quirks of programming in an AutoCAD system, which, as you are well aware, allows you a great deal of precision. Occasionally, though, numbers are not quite precise enough, due to the rounding up or down of floating point values defining geometric positions. You must be able to compare one set of points with other points, so you must deal with these cases.

Have you ever noticed that occasionally, when you list the information associated with an AutoCAD entity, you see a value such as 1.0e-017? This number is almost zero, but when you are comparing it to zero within a LISP program, almost does not count.

Within the garden path, you need to be able to compare numbers without having to worry about the fact that 1.0e-017 is not quite zero. The gp:pointEqual, gp:rtos2, and gp:zeroSmallNum functions handle any discrepancies in rounding when comparing point lists.

This completes your tour of the functions in gppoly.lsp.