Facet Mesh Generation   

<<< Rendering Option Settings Chapters Faceting Output Via GO >>>

Contents

[back to top]


54.1 Introduction

This chapter describes how the fields of the PK_TOPOL_facet_mesh_o_t option structure control the generation of the facet mesh. This option structure is used by:

[back to top]

54.1.1 Default values

Values used by the PK_TOPOL_facet_mesh_o_m macro to initialize the PK_TOPOL_facet_mesh_o_t structure are described here as default settings. These settings demonstrate how to have basic topological and geometric data returned to the application.

Applications should initialize the PK_TOPOL_facet_mesh_o_t structure using the macro, rather than trying to set all of the fields individually. The value of the o_t_version field which is initialized by the PK_TOPOL_facet_mesh_o_m macro must not be modified.

[back to top]

54.1.2 Viewing transformation

Some of the facet mesh options require a viewing matrix to be specified. Parasolid has a number of requirements on such matrices, as explained in the sections on the "Density" and "Cull" options below.

View matrices are explained in Chapter 49, "Parasolid View Matrices".

[back to top]

54.1.3 Setting tolerance values

A number of the facet mesh options can take a tolerance value. It is assumed that if no explicit tolerance value is provided, Parasolid is free to calculate its own internal tolerance values. These are generally case specific, rather than using specific fixed values.

[back to top]


54.2 Mesh generation options

The following sections describe the fields in the PK_TOPOL_facet_mesh_o_t option structure.

[back to top]

54.2.1 Shape

The shape field constrains what shape of facets are allowed in the facet mesh. The options are:

 

Option Description

PK_facet_shape_convex_c (default)

facets are generated so that all interior angles are convex and none of the facets contain interior holes

PK_facet_shape_cut_c

the application permits concave interior facet angles, and none of the facets contain interior holes

PK_facet_shape_any_c

the application permits concave interior facet angles, and the application permits facets to contain interior holes

The convexity test is made by projecting the facet fins onto the mid-plane of the facet and testing its interior angles. The "mid-plane" is defined under "Facet planarity tolerance".

The PK_facet_shape_cut_c and PK_facet_shape_any_c settings are only relevant where facets can contain more than three sides as specified by the "Maximum number of sides on facets" option.

If PK_TOPOL_facet is being used to return tabular facet data with the shape field set to PK_facet_shape_any_c, any facets containing holes are defined in the facet_fin table using the null_index marker to separate the exterior fin boundary from the interior fin boundaries. This format is described in the "Facet topology" section of Chapter 56, "Tabular Output of Faceting".

[back to top]

54.2.2 Match

When solid or sheet parts are faceted, the match option allows faces to be faceted independently or faceted together as a complete mesh. The options are:

 

Match type Option Description

geometry matching

PK_facet_match_geom_c

clip facet boundaries to a common edge

topology matching (default)

PK_facet_match_topol_c

match facet vertices across a common edge

trimmed facets

PK_facet_match_trimmed_c

clip facet boundaries to model edge curve

 

Figure 54-1 Geometry matching - clipping facet boundaries to a common edge

 

Figure 54-2 Topology matching - matching facet vertices across a common edge

 

Figure 54-3 Trimmed matching - clipping facet boundaries to model edge curves

Geometry matching

The geometry matching option (PK_facet_match_geom_c) can be used when generating faceted output for a simple rendering application.

The boundaries of neighboring facet meshes (generally) meet exactly but are topologically disjoint. If PK_TOPOL_facet is being used to return tabular facet data, the fin_fin table only matches fins which belong to the same face (the co-fin values of fins on the face mesh boundary are set to a null index value).

When facet meshes may not match

Facet meshes may not match in the following situations:

 

Figure 54-4 Geometry matching

 

Note: When general bodies are faceted, this must be done using the geometry matching option, so that faces are faceted independently of each other.

Topology matching

The topology matching option facets all of the faces of a solid or sheet part as a single mesh.

If PK_TOPOL_facet is being used to return tabular facet data, the fin_fin table describes matching between fins which belong to the same face and between boundary fins which belong to the neighboring faces.

The topology matching option checks that the boundary vertices on a facet mesh always match with vertices on the boundaries of neighboring meshes (possibly splitting facets in the neighboring facet mesh in order to meet this condition).

The topology matching option corrects the problem of slight gaps described in the "Geometry matching" section.

 

Figure 54-5 Topology matching

 

Note: Topology matching has no effect when faces are faceted individually (where face entities are supplied explicitly as arguments to the PK faceting functions).

However, when your application has input a list of faces, Parasolid recognizes faces from that list that all belong to the same body, and these faces are clipped to common edges.

Trimmed facets

The trimmed facets option clip facet boundaries to model edge curves.

It gives no matching between facets on the two faces of an edge, but ensures that the gaps or overlaps between such facets are no bigger than the supplied tolerances. Figure 54-3 shows the gaps occurring along a model edge.

[back to top]

54.2.3 Density

The density field allows the facet density to be increased over regions of the part which become silhouettes when viewed with a parallel view in the direction specified by the view matrix.

 

Option Description

PK_facet_density_no_view_c (default)

facet density is independent of view (it is ignored)

PK_facet_density_view_c

increase facet density at view silhouettes

This option is used when generating view specific facet meshes which contain enhanced detail where the facet surfaces form silhouettes against the specified view. This option requires a view and local tolerance values to be specified.

View

The view is defined by the view_transf parameter given in the call to PK_TOPOL_render_facet or PK_TOPOL_facet:

You can also define multiple views, using the view_directions option. If you use view_directions , it overrides view_transf for local density values. See Section 54.2.4, "Multiple view directions", for details.

There is further information on view matrices in Chapter 49, "Parasolid View Matrices".

Local density tolerance values

See Section 54.2.5, "Local density", for descriptions of the local_density_tol and local_density_ang fields.

[back to top]

54.2.4 Multiple view directions

You can increase the facet density in multiple view directions using the view_directions option. This takes as its value an array of unit vectors, each unit vector defining a different view direction. A corresponding n_view_directions option contains the number of view directions, and should correspond with the size of the view_directions array.

This option overrides any view direction specified using view_transf (as described in Section 54.2.3). By default, n_view_directions is set to 0 to ensure that view_transf is not overriden unless explicitly requested.

 

Note: When culling back facing facets, the direction defined by view_transf is used, rather than any directions defined by view_directions . See Section 54.2.6, "Cull" for more information about culling facets.

[back to top]

54.2.5 Local density

The local density tolerance values are required when density is set to PK_facet_density_view_c option (to specify that facet density is increased in regions where a silhouette is formed with a given view).

 

Switch field Value field Description

is_local_density_tol

local_density_tol

a local value for the surface distance tolerance when faceting in the region of silhouettes (replacing the surface_plane_tol value temporarily)

is_local_density_ang

local_density_ang

a local value for the surface angular tolerance when faceting in the region of silhouettes (replacing the surface_plane_ang value temporarily)

The default setting of is_local_density_tol and is_local_density_ang is PK_LOGICAL_false.

One or both of these fields must be set to PK_LOGICAL_true and one or both of local_density_tol and local_density_tol , must be set to a non-zero, positive value when using the PK_facet_density_view_c option.

[back to top]

54.2.6 Cull

The cull field allows the total size of the facet mesh to be reduced by removing some backward facing facets from the net.

 

Option Description

PK_facet_cull_none_c (default)

do not cull any facets; output them all

PK_facet_cull_back_c

this option requires that a view is specified

The view is defined by the view_transf parameter given in the call to PK_TOPOL_render_facet or PK_TOPOL_facet (see Section 54.2.3):

There is further information on view matrices in Chapter 49, "Parasolid View Matrices".

When this option is chosen it is not possible to have topology matching on. Therefore, since topology matching is the default, you must select a matching option other than PK_facet_match_topol_c. See Section 54.2.2, "Match" for more details.

[back to top]

54.2.7 Loops

The n_loops and loops options allow specific PK_LOOP_t entities to be ignored when a sheet body or a face of a sheet body is faceted. This has the effect that specified holes can be capped when sheet entities are faceted.

Each entity is a loop which is owned by one of the sheet bodies (or faces of a sheet body) which are being faceted.

The default setting is not to ignore any loops.

[back to top]

54.2.8 Maximum number of sides on facets

The max_facet_sides field constrains the maximum number of sides on facets. The default value is 3.

 

Figure 54-6 Maximum number of sides on facets

[back to top]

54.2.9 Minimum facet width

The is_min_facet_width and min_facet_width options constrain the minimum width of any side of a facet.

 

is_min_facet_width min_facet_width Description

PK_LOGICAL_false (default)

no value

Parasolid calculates an appropriate value based on the size of the face box

PK_LOGICAL_true

set to the required minimum facet width (a positive, non-zero value)

This requires that the field min_facet_width is set

The value specifies a width below which Parasolid may disregard supplied curve, surface and planarity tolerance values. Facets may be produced with dimensions smaller than this width.

 

Figure 54-7 Minimum width of any side of a facet

[back to top]

54.2.10 Maximum facet width

The is_max_facet_width and max_facet_width options constrain the maximum width of any side of a facet.

 

is_max_facet_width max_facet_width Description

PK_LOGICAL_false (default)

no value

Parasolid calculates an appropriate value internally

PK_LOGICAL_true

set to the required maximum facet width (a positive, non-zero value)

This requires that the field max_facet_width is set

[back to top]

54.2.11 Curve tolerance

The following sets of fields control how closely the fins on the boundaries of a face mesh match the originating edge geometry.

 

Switch field Value field Description

is_curve_chord_tol

curve_chord_tol

the maximum permitted distance from a chord (i.e. facet fin) to the curve (i.e. edge entity) which it approximates

is_curve_chord_max

curve_chord_max

the maximum length of chord which can be used to approximate a curve

is_curve_chord_ang

curve_chord_ang

the maximum angle (in radians) which is allowed between a chord and its originating curve; this is calculated as the sum of the two angles between a chord and the curve tangents, measured at the chord ends

The default setting of each of is_curve_chord_tol , is_curve_chord_max and is_curve_chord_ang is PK_LOGICAL_false. This implies that no explicit curve tolerance values are supplied (Parasolid calculates appropriate tolerance values internally).

One or more of these fields can be set to the value PK_LOGICAL_true with one or more of the corresponding fields - curve_chord_tol , curve_chord_max , curve_chord_ang - set to a non zero, positive value.

[back to top]

54.2.12 Surface tolerance

The following sets of fields control how closely each face mesh matches the surface geometry of the originating face.

 

Switch field Value field Description

is_surface_plane_tol

surface_plane_tol

an upper bound on the distance from a facet to the surface which it approximates

is_surface_plane_ang

surface_plane_ang

the maximum angle (in radians) which is allowed between a facet plane and its originating surface; this is calculated as the sum of the angular deviation between the surface normal and facet planar normal at any two positions within the facet boundary

The default setting of is_surface_plane_tol and is_surface_plane_ang is PK_LOGICAL_false. These imply that no explicit surface tolerance values are supplied. (Parasolid calculates appropriate tolerance values internally).

One or more of these fields can be set to the value PK_LOGICAL_true with one or both of the corresponding fields, surface_plane_tol or surface_plane_ang set to a non zero, positive value.

 

Figure 54-8 Examples of different surface tolerance settings

[back to top]

54.2.13 Local tolerances

You can attach local tolerance to individual or groups of topological entities (either faces or bodies) which then override the faceting tolerances already defined for the face or body using the various curve and surface tolerance options available (see Section 54.2.11 and Section 54.2.12 respectively).

Local tolerances are specified using the following options:

 

Option Description

local_tols

A set of tolerances to be attached to entities. This is an array of PK_facet_local_tolerances_t. Default: 0 (empty).

topols_with_local_tols

An array of unique topological entities (faces or bodies) to which you want to attach local tolerances.

  • Local tolerances are not used if this is empty.
  • If this is not empty, the parallel array local_tols_for_topols must be completed.

Default: 0 (empty).

local_tols_for_topols

A list of indexes into the local_tols array for each of the entities in topols_with_local_tols . This field specifies which of the specified local tolerances is to be used for each of the specified entities.

The field must be of length n_topols_with_local_tols .

[back to top]

54.2.14 Vertices at degeneracies

There are a number of ways that you can manage facet output at degenerate vertices. Parasolid lets you control:

You use the degen (PK_facet_degen_t) option in PK_TOPOL_facet_mesh_o_t to specify which one you want to use. The values it can take are as follows:

 

Value Description

PK_facet_degen_multiple_vxs_c

Each facet adjacent to a degeneracy has a unique vertex at the degeneracy. The value for the degenerate parameter at each vertex is the value of the degenerate parameter found for the previous vertex in the facet. Normals and derivatives for each facet are calculated using the appropriate parameter, and so are guaranteed to be accurate for each facet. However, the topology of the original part is not preserved. This is the default setting.

PK_facet_degen_single_vx_c

Parasolid creates a single vertex which is used by all the facets adjacent to the vertex. The value for the degenerate parameter at this vertex is taken from the lowest value at the other end of one of the facets. This preserves the topology of the original, but the parameters, normals and derivatives of all other facets are incorrect.

This option only has an effect if using tabular faceting via PK_TOPOL_facet. See Chapter 56, "Tabular Output of Faceting" for more information.

PK_facet_degen_average_parms_c

Like the default method, each facet adjacent to a degeneracy has a unique vertex at the degeneracy, with a unique parameter. The normals and derivatives are therefore correct for each facet adjacent to the degeneracy, but topology is not preserved.

Unlike the default setting, the value for the degenerate parameter at each vertex is taken from the average value of the degenerate parameters found for the vertices on either side.

The differences between these three options are illustrated in Figure 54-9.

 

Figure 54-9 Creating facet vertices at degeneracies

[back to top]

54.2.15 Order of constraints

This is managed first by the initial division of a face into a small number of facets. Each facet is then tested to see if it meets the tolerance criteria, i.e. surface tolerance, maximum size, etc. If the facet does not meet the criteria it is then split into two and each resulting facet is again tested as before. This process continues until the criteria are satisfied. However, if the process comes to a point where a facet has been produced which is smaller than the minimum width, then the recursion stops, regardless of the other criteria.

[back to top]

54.2.16 Facet planarity tolerance

The following sets of fields control how closely the coordinates of a facet are matched to a common mid_plane. This is defined as passing through the center of gravity of the facet vertices, in a direction given by averaged value of the vertex normals.

 

Switch field Value field Description

is_facet_plane_tol

facet_plane_tol

an upper bound on the distance from a facet to its mid-plane

is_facet_plane_ang

facet_plane_ang

the maximum permitted ratio between facet_plane_tol and max_facet_width

The facet planarity tolerance values are are only relevant where facets can contain more than three sides.

 

Figure 54-10 Examples of different planarity tolerance settings

[back to top]

54.2.17 Wire edges in faces

You can control how facets are created for faces that contain wire edges using the wire_edges option. This takes the following values:

 

Value Description

PK_facet_wire_edges_no_c (default)

Faceting ignores wire edges in faces, and they are faceted over

PK_facet_wire_edges_yes_c

Faceting takes wire edges in faces into account and facets the face in such a way that no facet is intersected by a wire edge.

The behavior of this option is illustrated in Figure 54-11.

 

Figure 54-11 Faceting faces that contain wire edges

[back to top]

54.2.18 Ignoring small features

Small features in a body or model may be ignored during faceting operations. A small feature is a set of connected faces whose box size is smaller than a user-specified value. Doing this can speed up faceting, and reduce the number of facets created. It is useful if you are generating a "draft view" of a model, in order to get a rough idea of what it looks like. You use the ignore , ignore_value , and ignore_scope options in PK_TOPOL_facet_mesh_o_t to control whether, and how, small features are ignored.

 

Option Description

ignore

Control whether to ignore small features. This can take the following values:

  • PK_facet_ignore_no_c (default) - all features are faceted, regardless of size.
  • PK_facet_ignore_absolute_c - a feature whose box size is smaller than the value specified in ignore_value may be ignored.
  • PK_facet_ignore_ratio_c - a feature may be ignored if the ratio of its box size to the overall box size is smaller than the ratio specified in ignore_value .
  • PK_facet_ignore_body_ ratio_c - a feature may be ignored if the ratio of the its box size to the box size of its owning body is smaller than the ratio specified in ignore_value .

For a description of the difference between these last two values, see "Defining small features using a ratio value".

ignore_value

Define which features are classed as small. This option takes either:

The default is 0.0. See "Defining small features using a ratio value" for more information.

ignore_scope

This option lets you specify the scope within which loops in a face may be ignored. It only applies when faceting a list of faces. The option can take two values:

  • PK_facet_ignore_scope_global_c (default) - loops are only ignored if they would have been ignored had the whole of the owning body (rather than just the face) been faceted.
  • PK_facet_ignore_scope_local_c - the face is faceted as a separate entity. If it contains holes that can be classed as small according to the settings in ignore and ignore_value , then they are ignored.

The value of local_scope also has implications for the ratio values of ignore . See "Defining small features using a ratio value" for more information.

 

Note: If the loops option is used, faceting ignores the specified loops regardless of the value of ignore . See Section 54.2.7, "Loops", for information.

Defining small features using a ratio value

The PK_facet_ignore_ratio_c and PK_facet_ignore_body_ratio_c values for ignore let you define the size of a small feature in terms of a ratio, rather than an absolute value. This is useful, because you can ignore small features without having to know anything about the overall size of the model. For example, specifying an ignore_value of 0.01 when using one of the ratio values means that any feature whose box size is less than 1% of the size of the entire model or owning body is ignored, regardless of its absolute size.

Two ratio values are available so that you can choose whether to define small features in terms of either the owning body or the entire assembly.

 

Value for ignore Ratio defined relative to

PK_facet_ignore_ratio_c

The overall box.

PK_facet_ignore_body_ratio_c

The owning body.

If faceting bodies, the overall box is the union of all the topols boxes (with topol_transfs applied) in the call to PK_TOPOL_facet or PK_TOPOL_render_facet.

If faceting a list of faces, the overall box depends on the value of local_scope :

Value for local_scope Definition of overall box

PK_facet_ignore_scope_global_c

The union of all the topols owning bodies' boxes (with topol_transfs applied)

PK_facet_ignore_scope_local_c

The union of all the topols boxes (with topol_transfs applied)

[back to top]

<<< Rendering Option Settings Chapters Faceting Output Via GO >>>