Check for electrodes that overlap or coincide or are too close to each other.

Electrodes and segments must not be allowed to coincide, either wholly or partly, even if they have the same potential, because the results would then be meaningless.

Tests are carried out automatically to check that the electrodes or segments do not cross, overlap or coincide with each other and are not too close.

There are 3 separate tests:

(1) to check that segments do not coincide or overlap or are too close.

(2) to check that small segments are not close to much larger segments.

(3) to check that if the free end of a 2D electrode is close to the free end of another electrode that the end segments are not too wide.

These tests can be disabled or modified, but this is USUALLY VERY UNWISE, see below.

If these test are disabled at any time, they should be re-enabled again later.

The tests carried out by the program are not completely exhaustive, so the user must carefully inspect the simulated system to check for overlaps.

IF 2 ELECTRODES OR SEGMENTS TOUCH THEY MUST BE AT THE SAME POTENTIAL.

If this is not done, and 2 touching electrodes have different potentials, then the charges near the touching point will be very large and the results will be inaccurate. Remember this instruction if the voltages are changed at run time.

For similar reasons, try to avoid putting 2 electrodes of different potential close together. Also, if possible, bridge the gap between 2 electrodes of different potential with an extra electrode whose potential changes linearly in the z direction (potential changes in other directions are not possible in this program).

This problem can occur when an electrode has an end at a reflection plane of negative voltage symmetry.

Do not let electrodes cross each other.

Technical information:

Criterion for overlapping:

CPO2D: The perpendicular of length s/4 from the centre of one segment of length s crosses the other segment.

CPO3D: The program calculates for each segment the distance:

dist_min = 0.2*area/(max distance between middle and a corner)

which is a distance less than the minimum distance from the middle of the segment to any part of the circumference. The program then takes 3 steps from the centre of the segment, each of length dist_min, and having the directions of the 3 unit vectors of the segment. If any of these steps crosses another segment, this is registered as the two segments crossing or being too close.