void pcond_exec_struct (
Pint struct_id, /* structure identifier */ Ptest *test /* condition test */
)
typedef struct {
Pint method; /* test method */
PTEST_ALWAYS_FAIL PTEST_ALWAYS_SUCCEED PTEST_DIST3 PTEST_EXTENT3 PTEST_BOUNDS_EXTENT3 PTEST_BOUNDS_SPHERE3 PTEST_BOUNDS3
union _Ptest_data {
/* level of detail */
struct Ptest_dist_3 { /* succeed if point is within [near,far] interval */
Ppoint3 point; /* point within object (MC) */
Pfloat near_dist; /* near distance (VRC) */
Pfloat far_dist; /* far distance (VRC) */
} test_dist_3;
struct Ptest_extent_3 {
Plimit3 paral; /* extent parallelepiped (MC) */
Ptest_comp relation; /* test relation */
Pfloat threshold; /* threshold value (DC) */
} test_extent_3;
/* decluttering */
struct Ptest_bounds_extent_3 {
Plimit3 paral; /* extent rectangle (MC) */
Pclip_cond cond; /* test condition */
} test_bounds_extent_3;
struct Ptest_bounds_sphere_3 {
Ppoint3 centre; /* sphere centre (MC) */
Pfloat radius; /* sphere radius (MC) */
Pclip_cond cond; /* test condition */
} test_bounds_sphere_3;
struct Ptest_bounds_3 {
Ppoint_list_list3 point_lists; /* test object (MC) */
Pclip_cond cond; /* test condition */
} test_bounds_3;
} test_data;
} Ptest;
typedef enum {
PTESTCOMP_IS_EQUAL,
PTESTCOMP_IS_NOT_EQUAL,
PTESTCOMP_IS_GREATER,
PTESTCOMP_IS_LESS,
PTESTCOMP_IS_GREATER_OR_EQUAL,
PTESTCOMP_IS_LESS_OR_EQUAL
} Ptest_comp;
typedef enum {
PCLIPCOND_IS_NOT_CLIPPED,
PCLIPCOND_IS_PARTIALLY_CLIPPED,
PCLIPCOND_IS_FULLY_CLIPPED
} Pclip_cond;
Depending on the edit mode, a Conditional Execute Structure element is inserted into the open structure after the current element or replaces the current element. The newly inserted element becomes the current element.
Depending on the result of the condition test, this element behaves like EXECUTE STRUCTURE if test succeed. Otherwise, the traversal continues with the next element.
Depending on the test method, different kind of tests can be defined. In fact, we can separate them in two categories:
Level of detail
Decluttering
LEVEL OF DETAIL:
method = PTEST_DIST3
The given point in MC space is transformed to VRC space, if the distance of the transformed point from the view point is within near and far distances, the test succeed. This method is useful for defining different descriptions of an object depending on the distance of the view point. At traversal time, GPHIGS will use dynamically one of these descriptions. For example, use three CONDITIONAL EXECUTE STRUCTURE elements defining three different near and far distances in order to define a low, medium an full detailed object according to its distance from the view point.
method = PTEST_EXTENT3
The parallelepiped paral specified in MC space is converted to DC space. Then, the maximum of the differences between x and y is compared against the threshold value using the specified relation. If the relationship is satisfied, the test is considered to have succeeded. This method, like the previous one, is useful in implementing automatic increase of amount of detail. It also useful to provide alternate representation of objects which are too small.
DECLUTTERING:
method = PTEST_BOUNDS_EXTENT3
The parallelepiped paral specified in MC space encloses the volume to be tested. The test determines if the volume is bounded. If the bounds condition, specified with cond, is satisfied, the test is considered to have succeeded. Allowed bounds conditions are PCLIPCOND_IS_NOT_CLIPPED, PCLIPCOND_IS_PARTIALLY_CLIPPED and PCLIPCOND_IS_FULLY_CLIPPED. This method is useful in implementing automatic decluttering.
method = PTEST_BOUNDS_SPHERE3
This method behaves like the previous one. The difference consists in the description of the enclosed volume. It is described using a sphere defined by its centre and its radius both specified in MC space.
method = PTEST_BOUNDS3
point_lists, specified in MC space, is a geometric description of a test object. This description encloses the volume to be tested. The test determines if the test object is bounded. If the bounds condition, specified with cond, is satisfied, the test is considered to have succeeded.
In addition, two special test methods PTEST_ALWAYS_FAIL and PTEST_ALWAYS_SUCCEED are defined for convenience.
Conditional instance structure, see pcond_inst_struct
Conditional return, see pcond_return
Conditional skip elements, see pcond_skip_elements
Conditional skip to label, see pcond_skip_to_label