FUNCTION same_side
(plane_pts : LIST [3:3] OF cartesian_point, test_points : LIST [2:?] OF cartesian_point) : BOOLEAN;
LOCAL val1, val2 : REAL; n : INTEGER; END_LOCAL;
IF (plane_pts[1].dim = 2) OR (test_points[1].dim = 2) THEN RETURN(?); END_IF; n := SIZEOF(test_points); val1 := above_plane(plane_pts[1], plane_pts[2], plane_pts[3], test_points[1] ); REPEAT i := 2 TO n; val2 := above_plane(plane_pts[1], plane_pts[2], plane_pts[3], test_points[i] ); IF (val1*val2 <= 0.0) THEN RETURN(FALSE); END_IF; END_REPEAT; RETURN(TRUE); END_FUNCTION; -- same_side
|