# Synopsis

PDX_MSGT gdx_FaceImproveInOutLoopDir(long option, double devtol, long maxits, int fitdeg, MDA_PTR *gdx_face_ptr, PDX_BOOL *corrected)

# Purpose

Improve the Inner/Outer loops for a face

# Description

This function is to improve the inner/outer loops for a face.

The parameter space curves will be used to figure out the dirctional information. They will be generated in this routine if not available. The function will check if the loops in parameter space are closed or not, yes, it will figure out the loop directional information and return PDX_TRUE as the status flag @corrected; no, it will exit with PDX_FALSE as the status flag, which means the loops might be crossing poles or seams of its surface if they are closed in model space. If @corrected is PDX_FALSE, the first_is_outer flag on the face will be set to FALSE.

The input Face and its loops would be deleted, and a new Face along with its loops and edges would be created if the flag @corrected is PDX_TRUE. However, the data base pointers of the edge curves would be kept unchanged.

An option is required. If GDX_FIX_LOOP_DIRS option is set, then the loop directions will be improved after inner/outer loop order is fixed. If the GDX_NO_FIX_LOOP_DIRS option is set, just the inner/outer loop order will be fixed. The face can only have one outer loop.

The loops must not intersect or touch each other, each loop must not self-intersect, and an inner loop must not enclose another loop.

# Input

## option

### GDX_FIX_LOOP_DIRS

Fix the loop directions after in/out sorting

### GDX_NO_FIX_LOOP_DIRS

Do not Fix the loop directions

## devtol

Sampled points on the model space curve, M(t), should not deviate from the surface or from the image under S(u,v) of P(s) more than this value. This tolerance should be larger than MODEL_SPACE_PNT_TOL, at least by 1 to 2 orders of magnitude. This will be used if parm curves need to be generated.

## maxits

Maximum number of iterations when generating parm curves. Iteration will be stopped if this number is exceeded.

## fitdeg

Degree used for fitting.

## gdx_face_ptr

The valid GDX Face database pointer

# Output

## gdx_face_ptr

The new GDX Face database pointer

## corrected

Flag indicating if the loop directional information can be improved

# Return

          GDX_NOERR
          Low level error return
          .fi