# Synopsis

PDX_MSGT gdx_LinearApproxEntity(long option, GDX_APPROX_PARAMS *approx_params, MDA_PTR gdx_db_ptr, int model, MDA_COUNT *num_gdx_approx, void *gdx_approx)

# Purpose

Linear approximate a GDX entity

# Description

Perform linear approximation on a GDX entity. The result is a GDX linear approximation entity created in a specified model. The GDX linear approximation entity can be a GDX_POLYLINE, GDX_CURVE_MESH, GDX_RECT_MESH, GDX_FACET_SHELL, or a GDX_POLY_SHELL entity.

The GDX entities supported for approximation are:

.nf Curve GDX_ARC GDX_COMPOSITE GDX_CONIC GDX_POLYLINE GDX_SPLINE_CURVE GDX_NURB_CURVE GDX_OFFSET_CURVE GDX_TRIM_CURVE

Surface GDX_NURB_SURF GDX_SPLINE_SURF GDX_RULED_SURF GDX_REV_SURF GDX_EXT_SURF GDX_OFFSET_SURF GDX_PLANE GDX_CONE GDX_SPHERE GDX_CYLINDER GDX_TORUS GDX_RECT_TRIM_SURF

Topology GDX_FACE GDX_SHELL GDX_SOLID .fi

In general, if the approximation method is GDX_TOLERANCE, then the approximation involves iterative procedures that work until the requested tolerance is realized. For the GDX_ARC, however, the minimum number of points are generated that guarantee the approximation to the requested tolerance. However a minimum of 3 points are generated if a GDX_ARC is open and a minimum of 4 points if it is closed.

# Input

## option

### GDX_COMMIT

Commit the approximation data to the database

### GDX_MAKEPLANAR

Make all non-planar facets planar to within COPLANAR_TOL tolerance (See gdx_SetTolerances). The resultant GDX approximation entity will be a GDX_POLY_SHELL

### GDX_UNNORM

Unnormalize the requested surface UV parameter values. By default, the parameter values are normalized, but adjusted for seam crossing such that the parametric range of the normalized values is -1.0 < parm < 3.0. For values < 1.0 1.0 must be added to the value to get the correct normalized value and for values > 1.0 1.0 must be subtracted from the value until the value is <= 1.0. When the paramter values are unnormalized the values are adjusted appropriately.

### GDX_FORCE_CC_TO_POLYLINES

A composite curve will be approximated as polyline(s). When this option is chosen, all new polylines are committed to the database. By default, a gdx_curve_mesh might be returned.

## approx_params

The linear approximation parameters or NULL. If NULL is used, then the default linear approximation parameters are used. See the gdx_InitApproxParams manual page for information on how to set these values.

## gdx_db_ptr

Database pointer of GDX entity

## model

The model to create the approximation entity in

# Output

## num_gdx_approx

The count of GDX linear approximation entities

## gdx_approx

The linear approximation entity structures (default) or the linear approximation entity structure database pointers (if GDX_COMMIT specified). The memory space for the entity(s) is allocated and must be freed by the application, using gdx_Free if the calling application is not part of libgdx.

# Tolerances

          MODEL_SPACE_PNT_TOL
          PARM_SPACE_PNT_TOL
          ANGLE_TOL
          ZERO_TOL
          CONVERGE_TOL
          KNOT_TOL
          PNT_PROJ_TOL
          PARALLEL_LINES_TOL
          COLLINEAR_TOL
          COPLANAR_TOL
          .fi

# Return

          GDX_NOERR
          GDX_LINAPPROXNODATA
          GDX_INVALIDMODEL
          GDX_INVALIDENTITYTYPE
          Low level error return
          .fi