# Synopsis

PDX_MSGT gdx_CBSImproveInnerOuterCECDir(long option, double parm_tol, long maxits, int fitdeg, MDA_PTR *gdx_cbs_ptr, PDX_BOOL *parm_closed)

# Purpose

Improve CEC directions in the given CBS

# Description

Given a CBS, Corrects CEC directions by determining if CEC is forming a continuous and closed Inner/Outer loop.

The parameter space curves will be used to figure out the inner/outer information. They will be generated in this routine if not available. Program tries to close parm space CEC loops by changing curve order/direction. If loops are not closed then sets the parm_closed flag to PDX_FALSE and exit the program. It Improves CEC directions by sorting Outer and inner CECs and sets the outer CEC direction to counter clockwise and inner CEC direction to clockwise. Program exit with an error message, if it finds two outer loops.

Input CBS along with CECs will be deleted and CBS with new improved CECs would be created if @parm_closed flag is PDX_TRUE. However, the database pointers of the edge curves would be kept unchanged. CECs should not overlap and the area of the loop formed by a CEC should not be zero. If so, would be treated as outer loops.

# Input

## option

Options (not used)

## parm_tol

Tolerance used

## maxits

Maximum number of iterations. Iteration will be stopped if this number is exceeded.

## fitdeg

Degree used for fitting.

## gdx_cbs_ptr

CBS Pointer

# Output

## gdx_cbs_ptr

CBS Pointer

## parm_closed

### PDX_TRUE

= CECs are not closed in parm space

# Return

          PDX_NOERR
          GDX_BADDATA
          GDX_NUMBER_OUTER_LOOPS
          .fi