next up previous contents index
Next: Control Structures Up: Operator Overloading Previous: Handle Overloads   Contents   Index

Zoidlist Overloads

The math and logical operators are overloaded for zoidlists as follows:

+ , | union
- and-not
* , & intersection
^ exclusive or
! inverse

The result of the operation is a new zoidlist, with neither of the operands affected.

To test for an empty zoidlist, the == and != comparisons to the value 0 can be applied. Note that ``if (!zlist)'' is an incorrect test for an empty zoidlist; it will invert the list and return true if the inverted list is not empty.

There is a current ``reference'' zoidlist which represents the ``background''. If not explicitly set (with the SetZref function), this is taken as the boundary of the current cell. The reference is used in operations such as inversion and exclusive-or where the size of the background must be assumed. Note that this background can be an arbitrary shape. In binary operators with zoidlists, if one of the operands is a scalar, 0 represents an empty list, and nonzero represents the reference list.


next up previous contents index
Next: Control Structures Up: Operator Overloading Previous: Handle Overloads   Contents   Index
Stephen R. Whiteley 2024-09-29