This paper describes a new region shape and conversion, together with some more high level routines.
This setting of CNV specifies that no conversion is to take place in this region. The last four arguments of RGPLIM are ignored, and the next region in the chain selected. This setting is likely to be used when a region is defined only to clip lines.
This setting of BSC indicates that the region shape is defined by coordinates in a NULL file, whose name is the second argument of RGLIM and whose number is the third argument. The remaining two arguments are ignored for the purpose of scissoring. Pairs of arguments in the NULL file are taken to be the coordinates of the boundary, which must be a simple closed curve but need not be convex. The current limitations are:
(a) No more than 50 points on the boundary
(b) No line to be split into more than 23 segments by the region.
Example: FRED = ANAME('FRED') STDF (FRED) NULL 1.0) NULL 2.0) NULL 3.0) NULL (4.0) NULL (5.0) NULL (6.0) FIDF (1.0) RGLIM (1.0,FRED,1.0,0.0,0.0) RGPRM (1.0,3.0,3.0,1.0,0.0,0.0)
defines region 1 as a triangular area, with no conversion.
BNDRY (F,P)
F is the name of a NULL file which contains pairs of coordinates. BNDRY draws lines between these points. If P = 0.0, the last point is joined to the first.
UNLOAD (XIND)
The value of this function is the value contained in the index variable called XIND.
NULVAL (F,FN,XP,VAL)
This function sets VAL to the XP-th argument contained in the NULL file whose name is F and whose number is FN. The function value is -1 if there is no XP-th argument, or the specified file does not exist.
Suppose the closed curve is defined by:
(a1,b1),(a2,b2)...(am,bm) and the line by (X1,Y1,X2,Y2). This line can be represented by; X = X1 + t cos Q Y = Y1 + t sin Q with tan Q = (Y2-Y1)/(X2-X1) Consider the intersection of this line with the boundary segment: (ai,bi,aj,bj), j = i+1 for i < m j = 1 for i=m If these lines are not parallel, the intersection, at point T, is given by: (bj-bi) (X1-ai+T cosQ)=(aj-a.i) (Y1-bi + T sinQ)
If this point is outside the segment (ai,bi,aj,bj), the point is ignored. It is also ignored if it coincides with (aj,bj), so that boundary intersection points are counted only once. If it coincides with (ai,bi), a further test is made to see whether the two neighbouring boundary points are on opposite sides of the line. If they are not, the line does not cross the boundary and the point is ignored.
If the point is acceptable so far, a further test is· applied to see if the point T lies within the original line 0 < T < SQRT((X2-X1)2 + (Y2-Y1)2). If it does, the point is a true intersection.
If the original line and segment are parallel, they may coincide. If they do, point T is taken as (ai,bi), and the remaining tests applied.
When all the boundary segments have been dealt with, the set of points T, together with the original start and end points, define the required cutting.
To determine which cuts are inside, a count is kept of all intersection points which lie within the boundary segment and for which T > 0 (ie all points satisfying the previous conditions, with the exception that T < SQRT((X2-X1)2 + (Y2-Y1)2) is relaxed). If this count is odd, the initial cut is inside the region.