SUBSYSTEM OVERVIEW
IGES Geometry (IGEO) Subsystem
The IGES geometry subsystem provides functions to evaluate, approximate, and convert IGES data. Much of this functionality also exists at the GDX level. In some instances (primarily linear approximation), the GDX implementation is considerably easier to use than the corresponding igeo functions.
GENERAL ENTITY UTILITIES
The general IGES geometry utilities are used for managing the IGES geometry data.
Determine planarity information for an IGES curve entity
Determine the plane to XY plane IGES rotation matrix given the plane normal
Reverse an IGES curve entities parametrization
Reparameterize an IGES 126
Reparameterize an IGES 128
Test the continuity of two curve derivatives
Determine the continuity of an IGES curve entity
Get IGES 126 entity continuous segment bounds
Get IGES 126 entity as all continuous IGES 126 entities
Text the continuity of two surface derivatives
Determine the continuity of an IGES surface entity
Get IGES 128 entity continuous patch bounds
Get IGES 128 entity as all continuous IGES 128 entities
Get the GDX entity associated with an IGES entity for the IGES->GDX model
Get the GDX entity associated with an IGES entity for a specific GDX model
Get the IGES entity associated with a GDX entity for the current IGES model
Get the IGES entity associated with a GDX entity for the specific IGES model
Get the IGES 128 iso-parametric curve as an IGES 126 entity.
Get the IGES surface iso-parametric curve as an IGES curve entity.
Get the IGES 128 surface boundary curve as an IGES 126 entity.
Get the IGES surface boundary curve as an IGES curve entity.
Get the IGES sub curve interval from an IGES curve entity.
Get the parametric bounds for an IGES curve entity.
Get the degree of an IGES curve entity.
Get the closure of an IGES curve entity.
Get the approximate extents of an IGES curve entity.
Get the U and V degree of an IGES surface entity.
Get the U and V closure of an IGES surface entity.
Project a 3D point to an IGES surface entity.
Project a 3D point to an IGES surface entity using a GDX rectangular surface grid.
Project a 3D point to an IGES curve entity.
Delete an IGES 144 entity and its subordinate entities
Get the sense of an closed IGES 142 entity
Delete an IGES 143 entity and its subordinate entities
ENTITY EVALUATION
IGES geometric entities can be evaluated at a normalized parameter value (0.0 to 1.0 inclusive) to get geometric information about the IGES geometric entity. The following functions evaluate IGES entities:
Evaluate a point on an IGES curve entity
Evaluate a point on an IGES surface entity
Get the normalized parameter value for an IGES entity parameter value
Get the parameter bounds for an IGES curve
Get the parameter bounds for an IGES surface
Evaluate derivatives on an IGES curve
Evaluate derivatives on an IGES surface
Evaluate properties on an IGES curve. The IGEO curve property data structure is:
| Data Type | Field | Description |
| – | ||
| MTH_3DPNT | point | Model space 3D point coordinate |
| double | tangent[3] | The tangent vector |
| double | curvature | The curvature |
Evaluate properties on an IGES surface. The IGEO surface property data structure is:
| Data Type | Field | Description |
| – | ||
| MTH_3DPNT | point | Model space 3D point coordinate |
| double | u_tangent[3] | The U tangent vector |
| double | v_tangent[3] | The V tangent vector |
| double | normal[3] | The normal vector |
| double | direct_curv | The directional curvature |
| double | gaussian_curv | The gaussian curvature |
| double | mean_curv | The mean curvature |
| double | min_curv | The minimium curvature |
| double | max_curv | The maximium curvature |
ENTITY CONVERSION
IGES geometric curve entities can be converted to IGES NURB curve entities with the original curve entities attributes applied to the IGES NURBS curve. The following functions convert IGES entities:
Convert a discontinuous IGES 112 to a continuous IGES 112
Convert a discontinuous IGES 126 to a continuous IGES 126
Convert an IGES Curve to an IGES 126
Convert a relimited IGES 126 to an unrelimited IGES 126
Convert a discontinuous IGES 114 to a continuous IGES 114
Convert a discontinuous IGES 128 to a continuous IGES 128
Convert an IGES Surface to an IGES 128
Convert an IGES 141 to an all IGES NURBS 141
Convert an IGES 141 to an all IGES Parametric spline 141
Convert an IGES 142 to an all IGES NURBS 142
Convert an IGES 142 to an all IGES Parametric spline 142
Convert an IGES 143 to an all IGES NURBS 143
Convert an IGES 143 to an all IGES Parametric spline 143
Convert an IGES 143 to one or more all IGES NURBS 144s
Convert an IGES 144 to an all IGES NURBS 144
Convert an IGES 144 to an all IGES Parametric spline 144
Convert an IGES 144 to a G1 continuous all IGES NURBS 144
Convert a relimited IGES 128 to an unrelimited IGES 128
Convert an IGES 126 to an IGES 112
Convert an IGES 128 to an IGES 114
Approximate an IGES 126 as an IGES 112
Approximate an IGES 128 as an IGES 114
ENTITY APPROXIMATION
IGES geometric entities can be approximated as points, polylines and/or facets in several manners. The IGES geometry approximation working area provides a mechanism for performing multiple approximation without excessive memory allocation and reallocation. This working area must be allocated before any approximation is performed. igeo_AllocateApprox allocates an initial workspace area and provides a mechanism for resizing this workspace throughout the approximation process. As a result, the amount an IGES entity can be approximated is only limited to the availability of memory. Once the approximation workspace has been allocated, functions can be called to affect the manner by which an IGES entity is approximated. By default, IGES entities are approximated to be within a tolerance of 0.01 and IGES surface are approximated with a 5X5 UV surface mesh. The application can use the following functions to modifiy how an IGES entity is approximated:
Set the method used to approximate the IGES entity.
Get the method used to approximate the IGES entity.
Set the tolerance for the within tolerance approximation method and the points per segment approximation method.
Get the tolerance use to approximate the IGES entity.
Set the number of points for the number of points approximation method.
Set the number of points per segment for the points per segment approximation method.
Set the option for approximating with facets.
Set the surface mesh values for the non-facet approximation option.
Set the option for approximating text.
Set the option for processing the DE attributes.
Get the current processing option for processing the DE attributes.
Set the type of point approximation data used to approximate the IGES entity
Get the type of point approximation data used to approximate the IGES entity
Set the option for using the preference flag for approximating trimmed and bounded IGES entities.
Set the option for issuing warnings during linear approximation of entities.
The function igeo_ApproxEntity provides generic access to approximating any supported IGES entity. In addition the following functions provide a lower level approximation capability:
Reset the approximation workspac"
Approximate an IGES entity
Approximate an IGES annotation entity
Approximate an IGES curve entity
Approximate other IGES entities
Approximate an IGES surface entity
Approximate an IGES text entity
The following functions are used to manage the approximation workspace data:
Allocate an approximation workspace
Free all the approximation workspaces
Free the current approximation workspace
Get the approximation data from the current approximation workspace
For the low level approximation functions, the approximation data is APPENDED to any previous approximation data unless the function igeo_ResetApprox is called to reset the next approximation to the start.
Once the IGES entity has been approximated, the function igeo_ApproxGetData provides the mechanism for accessing the READ ONLY approximated data. The data can be accessed in total, per IGES attribute(color, line font, level, etc.), or per segement where a segment is either a polyline without any breaks or a series of facet edges without any breaks. Once all approximation has been performed, the function igeo_FreeApprox frees the current approximation workspace.
An example where multiple IGES attributes may result and the data for each attribute needs to be accessed might be in the approximation of an IGES 230 entity where the boundary has a color of red but the 230 cross hatching is blue and the segments defining the red boundaries are accessed and then the segments defining the blue hatching are accessed.
The data access provided by igeo_ApproxGetData returns a pointer to a READ ONLY data structure and pointer to a flag that indicates the type of data structure returned. Currently there are two types of data structures returned from igeo_ApproxGetData.
The point approximation data structure IGEO_POINT_APPROX_DATA is returned when the approximation type flag is IGEO_POINT_APPROX. The format of the data structure is:
| Data Type | Field | Description |
| – | ||
| long | point_count; | Count of points |
| MTH_3DPNT | (*point_list); | List of 3D points |
| long | seg_count; | Count of segments |
| long | *points_in_seg; | Count of points per segment |
| int | attr_count; | Count of IGES_ATTR attributes |
| long | *seg_per_attr; | Segments per IGES_ATTR attribute |
| GDX_ATTRIBUTE_TYPE | *attr_types; | IGES_ATTR attribute apply type list |
| void | **attributes; | IGES_ATTR attribute struct list |
The points_in_seg list indicates how many of the points in point_list form a segment. By default, the first segment starts at point index 0 and ends at point index points_in_seg[0] - 1. The next segment starts at 0 + points_in_seg[0] and ends at 0 + points_in_seg[0] + points_in_seg[1] - 1, etc. for seg_per_attr[0]. The attr_count indicates the count of different IGES attributes that can be applied to the segments. In the case where the option has been set to not apply IGES attributes, the seg_per_attr list is NULL and the seg_count value indicates the total number of segments. The attribute list contains the list of IGES attribute structures(IGES_ATTR) (See iges_intro for a description of the IGES_ATTR structure definition) which contain information about attributes that can be applied to the approximation data. The attr_types list is list of types that indicate HOW the IGES attribute data should be applied to the data. The only IGES attribute type of application for point approximation data is:
The IGES_ATTR structure data applied to a points if the points_in_seg[seg] count is 1, lines if the points_in_seg[seg] count is 2 or polyline data if the points_in_seg[seg] is greater than 2.
An example of how an IGES entity would be approximated and accessed as a set of point approximation data:
#include "igeo_Interface.h"
#include "iges_Interface.h"
#include "eam_Interface.h"
#include "mda_Interface.h"
void *approx_data = NULL; /* The approximation return data structure */
int approx_type; /* The type of approximation data returned */
int end_attr_pt, attr_pt; /* The IGES attribute data indexs */
long start_seg_pt, end_seg_pt, seg_pt; /* The polyline segment data indexs */
long start_pnt, end_pnt; /* The point data indexs */
int num_of_points; /* The point count */
IGEO_POINT_APPROX_DATA *point_approx_data;/* The polyline point approximation
data structure */
IGES_ATTR iges_attr; /* The IGES attribute data */
EAM_STACK *stack; /* The entity attribute stack */
EAM_INFO iges_attr_info; /* The default IGES attribute information */
MDA_PTR db_ptr; /* The entity database pointer */
.
.
.
/* Allocate the approximate with an initial size of 500 and a resize
increment of 100 */
igeo_AllocateApprox(IGEO_NOOPT, 500, 100);
.
.
.
/* Initialize the default IGES attribute information */
iges_InitAttrInfo(IGES_NOOPT, &iges_attr_info);
/* Allocate the entity attribute stack with the default IGES attributes */
eam_AllocateAttrStack(EAM_NOOPT, &iges_attr_info);
/* Approximate the IGES entity with the default method */
igeo_ApproxEntity(IGEO_NOOPT, db_ptr, stack);
/* Get all the approximation data for this entity */
while( igeo_ApproxGetData(IGEO_ALLDATA, &approx_data, &approx_type )
== IGEO_NOTDONE ) {
/* Check for the type of approximation data(by default this will always be
polyline point approximation data */
if( approx_type == IGEO_POINT_APPROX ) {
/* Set the polyline point approximation data structure */
point_approx_data = (IGEO_POINT_APPROX_DATA *)approx_data;
/* Initialize the polyline segment index and the point indes */
start_seg_pt = start_pnt = 0;
/* Check for attributes (by default attributes are processed so will be
present */
if( point_approx_data->attr_count > 0 )
/* Set the ending IGES attribute index. */
end_attr_pt = point_approx_data->attr_count;
else end_attr_pt = 1;
/* Loop for all the IGES attributes */
for( attr_pt = 0; attr_pt < end_attr_pt; attr_pt++ ) {
/* Check for attributes */
if(point_approx_data->attr_count > 0) {
/* Set the ending polyline segment index for this IGES attribute */
end_seg_pt = start_seg_pt +
point_approx_data->seg_per_attr[attr_pt];
/* Get the IGES attribute data that can be applied to the polyline segment
data */
iges_attr =
*(IGES_ATTR *)point_approx_data->attributes[attr_pt];
}
/* If there were no attributes process, set the ending polyline segment
index to the total number of polyline segements and get the default
IGES attribute data */
else {
end_seg_pt = point_approx_data->seg_count;
iges_attr = iges_GetDefaultAttr();
}
/* Loop for all the polyline segments */
for( seg_pt = start_seg_pt; seg_pt < end_seg_pt; seg_pt++ ) {
/* Set the polyline segment endpoint index */
end_pnt = start_pnt + point_approx_data->points_in_seg[seg_pt];
/* Get the count of points in this polyline segment */
num_of_points = end_pnt - start_pnt;
/* Determine if the polyline segment is a point, line or polyline */
if( num_of_points == 1 ) { /* Point approximation */
.
.
.
}
else if( num_of_point == 2 ) { /* Line approximation */
.
.
.
}
else { /* Polyline approximation */
. /* Create the polyline from points starting at
. point_approx_data->point_list[start_pnt] for
. num_of_points */
}
/* Update the point index start index for the next polyline segment */
start_pnt = end_pnt;
}
/* Update the polyline segment start index for the next IGES attribute */
start_seg_pt = end_seg_pt;
}
}
}
/* Free the entity attribute stack */
eam_FreeAttrStack(EAM_NOOPT, stack);
/* Free the linear approximation workspace data */
igeo_FreeApprox();
.
.
.
The facet approximation data structure IGEO_FACET_APPROX_DATA is returned when the approximation type flag is IGEO_FACET_APPROX. The format of the data structure is:
| Data Type | Field | Description |
| – | ||
| long | point_count; | Count of points |
| MTH_3DPNT | (*point_list); | List of points |
| long | edge_count; | Count of edges |
| long | (*facet_edges)[2]; | Facet edge list |
| long | seg_count; | Count of segments |
| long | *facet_edges_in_seg; | Count of facet edges |
| int | attr_count; | Count of IGES_ATTR attributes |
| long | *seg_per_attr; | Segments per IGES_ATTR attribute |
| GDX_ATTRIBUTE_TYPE | *attr_types; | IGES_ATTR attr. apply types list |
| void | **attributes; | IGES_ATTR attribute struct list |
The facet_edges_in_seg list indicates how many of the facet_edges form a continuous segment. The first segement starts at edge index 0 and ends at edge index facet_edges_in_seg[0] - 1. A facet is formed by traversing the facet_edges data in pairs. Each value in the face_edges is an index to the facet coordinate data in the point_list. Two facet_edges form the four edges of a facet. The first facet would be created by accessing the point coordinates in the point_list from the facet_edges indexs: facet_edges[0][0], facet_edges[0][1], facet_edges[1][1], facet_edges[1][0]. which creates a facet with the correct normal orientation relative to the surface. The second facet would be created by accessing the point coordinates in the point_list from the facet_edges index: facet_edges[1][0], facet_edges[1][1], facet_edges[2][1], facet_edges[2][0]. and so on for edge_count - 1 facets. The number of facets in a segment is equivalent to facet_edges_in_seg - 1 since there is always one more edge than there are facets. An exception is made when an IGES planar closed area entity is approximated as a polygon. In this case the edge_count is one, and the point_list for point_count form the polygon edges. The attr_count indicates the count of different IGES attributes that can be applied to the facet segments. In the case where the option has been set to not apply IGES attributes, the seg_per_attr list is NULL and the seg_count value indicates the total number of segments. The attributes list contains the list of IGES_ATTR structures (See iges_intro for a description of the IGES_ATTR definition) which contain IGES attribute information that can be applied to the approximation data. The attr_types list indicates HOW the IGES attributes might be applied to the facets. The attributes can be applied based on the following attr_types values for facet approximation data are:
The IGES_ATTR structure data attributes applied to closed planar area polygon data where the polygon is formed by the point_count points. In this case, the facet_edges_in_seg list is NULL since there is only 1 facet edge and edge_count is equal to 1.
The IGES_ATTR structure data attributes applied to a rectangular shell of facets. The facet_edges_in_seg count is the same for all facet segments. (ie seg_count = the number of U facets and facet_edges_in_seg[0] - 1 = the number of V facets).
The IGES_ATTR strucutre data attributes applied to a non-rectangular shell of facets. The facet_edges_in_seg count may vary from one facet segment to the next.
An example of how an IGES entity would be approximated and accessed as a set of facet approximation data:
#include "igeo_Interface.h"
#include "iges_Interface.h"
#include "eam_Interface.h"
#include "mda_Interface.h"
#include "mth_Interface.h"
#include "pdx_Interface.h"
#include "ugn_Interface.h"
void *approx_data = NULL; /* The approximation return data structure */
int approx_type; /* The type of approximation data returned */
int end_attr_pt, attr_pt; /* The IGES attribute data indexs */
long start_seg_pt, end_seg_pt, seg_pt; /* The polyline segment data indexs */
long start_pnt, end_pnt; /* The point data indexs */
long start_edge, end_edge, edge; /* The facet edge indexs */
int num_of_points; /* The point count */
int point; /* The point index */
PDX_BOOL closed_area; /* The planar closed area polygon flag */
MTH_3DPNT facet_points[4]; /* The facet point data */
long facet_vtx_ndx[4]; /* The facet point index data */
IGEO_FACET_APPROX_DATA *poly_approx_data; /* The facet data structure */
IGES_ATTR iges_attr; /* The IGES attribute data */
MDA_PTR db_ptr; /* The entity database pointer */
EAM_STACK *stack; /* The entity attriubute stack */
EAM_INFO iges_attr_info; /* The default IGES attribute information */
.
.
.
/* Allocate the approximate with an initial size of 500 and a resize
increment of 100 */
igeo_AllocateApprox(IGEO_NOOPT, 500, 100);
.
.
.
/* Initialize the default IGES attribute information */
iges_InitAttrInfo(IGES_NOOPT, &iges_attr_info);
/* Allocate the entity attribute stack with the default IGES attributes */
eam_AllocateAttrStack(EAM_NOOPT, &igeo__AttrInfo);
/* Set the approximation of surfaces to be with facets */
igeo_ApproxSetFacets(PDX_TRUE);
/* Approximate the entity */
igeo_ApproxEntity(IGEO_NOOPT, db_ptr, stack);
/* Get all the data for this entity */
while( igeo_ApproxGetData(IGEO_ALLDATA, &approx_data, &approx_type )
== IGEO_NOTDONE ) {
/* Check for this entity approximated with facets */
if( approx_type == IGEO_FACET_APPROX ) {
/* Set the facet approximation data structure */
poly_approx_data = (IGEO_FACET_APPROX_DATA *)approx_data;
/* Initialize the facet segment, edge and point indexs */
start_seg_pt = start_edge = start_pnt = 0;
/* Check for attributes exist (by default attributes are applied so will
exist */
if( poly_approx_data->attr_count > 0 )
/* Set the ending attribute index */
end_attr_pt = poly_approx_data->attr_count;
else end_attr_pt = 1;
/* Loop for all the attributes */
for( attr_pt = 0; attr_pt < end_attr_pt; attr_pt++ ) {
if(poly_approx_data->attr_count > 0) {
/* Check for a closed area polygon */
if( poly_approx_data->attr_type[attr_pt] == IGEO_IGES_ATTR ) {
closed_area = PDX_TRUE;
/* Set the ending facet segment index */
end_seg_pt = start_seg_pt + poly_approx_data->seg_count;
}
else {
closed_area = PDX_FALSE;
end_seg_pt = start_seg_pt +
poly_approx_data->seg_per_attr[attr_pt];
}
/* Get the current IGES attribute data that can be applied to the facets */
iges_attr =
*(IGES_ATTR *)poly_approx_data->attributes[attr_pt];
}
/* If no attributes had been processed then set the ending facet segment index
to all the facet segments and get the default IGES attribute data */
else {
if( poly_approx_data->edge_count == 1 ) {
closed_area = PDX_TRUE;
end_seg_pt = start_seg_pt + poly_approx_data->seg_count;
}
else {
closed_area = PDX_FALSE;
end_seg_pt = poly_approx_data->seg_count;
}
iges_attr = iges_GetDefaultAttr();
}
/* Loop for all the facet segments */
for( seg_pt = start_seg_pt; seg_pt < end_seg_pt; seg_pt++ ) {
if( closed_area ) { /* Closed area polygon */
end_pnt = poly_approx_data->point_count;
num_of_points = end_pnt - start_pnt;
.
.
.
}
else { /* Standard Quad facets */
/* Set the ending edge index for this facet segment */
end_edge = poly_approx_data->facet_edges_in_seg[seg_pt] +
start_edge;
/* Loop for all the facet edges in this facet segment */
for( edge = start_edge; edge < end_edge - 1; edge++ ) {
/* Get the facet point indexs for this facet */
facet_vtx_ndx[0] =
poly_approx_data->facet_edges[edge][0];
facet_vtx_ndx[1] =
poly_approx_data->facet_edges[edge][1];
facet_vtx_ndx[2] =
poly_approx_data->facet_edges[edge + 1][1];
facet_vtx_ndx[3] =
poly_approx_data->facet_edges[edge + 1][0];
/* Get the facet coordinates */
for( point = 0; point < 4; point++ )
ugn_MoveDouble(3,
poly_approx_data->point_list[facet_vtx_ndx[point]],
facet_points[point]);
.
.
.
}
/* Update the starting facet edge index for the next facet segment */
start_edge = end_edge;
}
}
/* Update the starging facet segment index for the next IGES attribute */
start_seg_pt = end_seg_pt;
}
}
}
/* Free the entity attribute stack */
eam_FreeAttrStack(EAM_NOOPT, stack);
/ Free the linear approximation workspace data */
igeo_FreeApprox();
.
.
.
See the manual pages for the full bindings.