Graphical Output   

<<< File Header Structure Chapters Registering the Frustrum >>>

Contents

[back to top]


4.1 Introduction

When a call is made to the PK rendering functions, the graphical data generated is output through a set of functions known as the GO (Graphical Output) Interface

 

Note: You should not call heavyweight functions from the GO. See Section 120.2.1, “State of the code in execution”, of the Parasolid Functional Description for more information on heavyweight functions.

See the Function Exclusivity list in the PK Interface Programming Reference Manual to find out if a function is heavyweight or lightweight.

Warning: This chapter describes the GO interface which you must provide to receive graphical data from Parasolid. The GO Interface consists of a number of functions that must meet the specifications in Appendix B, “Graphical Output Functions”. There are dummy versions of these functions in the Frustrum library which is supplied with Parasolid, so that you can link your programs. They do not do anything, however, so if you want to use any rendering functions you must write your own GO functions, or no graphical data is forthcoming.

[back to top]


4.2 Graphical output functions

Line Data is produced by PK_GEOM_render, PK_TOPOL_render_line and PK_TOPOL_render_facet. It is output through the GO functions GOOPSG, GOSGMT and GOCLSG.

There are two values which GO functions should return in the ifail argument, both defined as tokens in the Parasolid failure codes include file. All GO functions should return one of:

[back to top]


4.3 Structure of line data output

Data output through the GO is organised into segments, which correspond to identifiable portions of the model (not necessarily entities in the Kernel sense).

4.3.1 Segment hierarchy

There are two classes of segment:

Every segment has a type, which governs (among other things) whether it is a hierarchical segment or not.

Single level segments always contain the data for a line to be drawn, as well as information about what kind of line it is.

Hierarchical segments usually contain other segments. Note that graphical data is always output hierarchically: using the hierarch option in PK_TOPOL_render_line affects the level of hierarchy.

For example, after a request by the application for view-dependent topology information by a call to PK_TOPOL_render_line, a hierarchical segment is opened for each body. Data for each silhouette line is then given in a single-level segment, and each is contained wholly within the hierarchical segment of the corresponding body.

A single body segment is not guaranteed to contain data for the whole body - for example, sometimes the kernel can output part of a body, close the body segment, open and close another body segment, and then open a new segment for the first body, and output the rest of it.

4.3.2 Graphical data for assemblies

Assemblies constructed with KI routines must be flattened and their constituent body tags and transformation matrices copied into entity arrays before they can be rendered by the PK functions. For further information see Chapter 1, “Parasolid KI Programming Concepts”, of the Parasolid KI Programming Reference Manual.

All such body segments have a unique occurrence number when they are rendered - this number is the index of the body (in the entity array) plus 1.

The tags associated with each of these body segments are likely to be different. There are two circumstances when you could receive separate body segments with the same tag:

 

Figure 4-1 Hidden line drawing of a single body

4.3.3 Notes

You should note that geometrical data output through the segment output functions is:

The application must transform all of the received GO data by a viewing matrix before projecting the data into two dimensions:

If the viewing matrix specifies a parallel orthographic projection, the 3D GO data can be projected into 2D form simply by replacing the third column of the matrix by a zero vector:

[back to top]


4.4 Segment output functions

See Appendix B, “Graphical Output Functions”, for detailed descriptions of each function. The three functions (GOOPSG, GOSGMT, GOCLSG) all have the same arguments, but interpret them in different ways. The arguments are:

GO....( segtyp, ntags, tags, ngeom, geom, nlntp, lntp, ifail )

The first argument of each function is an integer segtyp . Parasolid always sets this to the token representing the segment type. These tokens are listed in Appendix I, “Go Tokens and Error Codes”, of this manual. The different types of segment are discussed in a later section.

The values of some of the arguments to the segment functions, and therefore how you should interpret them, vary depending on the segment type. The arguments to which this applies are noted as such, below. The remaining arguments are pairs of integers and arrays.

4.4.1 Tags

The integer ntags gives the length of the tags array. The contents of this array depend on the segment type. For example, for a hierarchical body segment, tags contains the tag of the body; for a single level edge segment, tags contains the tag of the edge.

4.4.2 Line type

The integer nlntp gives the length of the lntp array. This is an array of integers, the first of which is always the occurrence number of the segment, and the rest of which are tokens. For hierarchical segments (i.e. in calls to GOOPSG and GOCLSG) the lntp array contains only the occurrence number of the segment.

Occurrence numbers link the segment to the entity which was passed to the rendering function. You can use them to associate the segments with the Parasolid entities (perhaps using identifiers to identify them). You can then identify what a particular line represents, and the entity it belongs to.

 

Note: You should use identifiers rather than tags to identify entities.

Identifiers are saved with the part when you archive it and are therefore always the same, whereas the tags of a part and its entities can be different in every Parasolid session.

See also Section 103.3.2, “Occurrence numbers” in the Parasolid Functional Description.

Silhouettes are produced by the silhouette option in PK_TOPOL_render_line. These automatically have each silhouette on a face labelled with a different integer, i.e. 1, 2, 3, etc.

The remaining array entries, which are given as well as the occurrence number for all single-level segment types, are as follows.

4.4.2.1 Line type

Line type specifies the type of geometry of the curve or lattice element which the segment represents. This is one of:

The different types of line are discussed in detail under Section 4.4.3, “Geometry”, below. They are defined by tokens of the form “L3TP...”

4.4.2.2 Completeness

Completeness codes indicate whether a segment represents a complete item or is part of a larger item. The codes returned may be any of the following:

For more information about viewports, see Section 104.3.23, “Using viewports to render specific entities” in the Parasolid Functional Description.

Completeness codes are only calculated in a hidden line drawing, so segments output from a view independent or view dependent wireframe drawing has code CODUNC (unknown completeness).

4.4.2.3 Visibility

Visibility specifies that the line is visible, invisible or of unknown visibility. This value is only relevant to hidden line pictures, so all segments produced in view independent or view dependent wireframe drawings have unknown visibility (CODUNV).

In hidden line drawing:

The effects of the PK_render_vis_... options are as follows:

 

Option

Description

vis_no_c

no visibility evaluated (topology is output as a view-dependent wireframe drawing)

vis_hid_c

only truly visible lines are output, all tagged CODVIS

vis_inv_c

all lines are output:

  • the truly visible ones tagged CODVIS;
  • the remainder tagged CODINV

vis_inv_draft_c

all lines are output:

  • the truly visible ones tagged CODVIS
  • those obscured by others tagged CODINV
  • the remainder being lines obscured by the body tagged CODDRV

vis_extended_c

lines are output subject to the ‘invisible’, ‘drafting’ and ‘self-hidden’ fields of the PK_TOPOL_render_line option structure

4.4.2.4 Smoothness

Smoothness indicates whether a line is smooth (i.e. the normals of the faces either side of the edge vary smoothly across it). Blend boundaries are smooth by definition. This code is provided because sometimes you may wish to leave smooth edges out of your pictures, to make them look more realistic.

For further information see Section 104.3.24, “Regional data” in the Parasolid Functional Description.

CODSMS is a special code which can be returned only from a hidden line drawing. It indicates that an edge is smooth, but that it is also coincident with a silhouette line which is not output. In this case you need to draw the edge even though it is smooth, because otherwise the silhouette is missing, making the picture look wrong.

CODNSS is a special code which can be returned only from a hidden line drawing when rendering sharp mfins. It indicates that the mfin line (which is sharp) is coincident with a silhouette line which is not output.

4.4.2.5 Regional data

If regional data was requested from a hidden line drawing, edge and silhouette segments are output with start and end point indices. These are output only when the regional data option is specified, and allow the line segment to be linked correctly with other lines. See Section 4.5, “Interpreting regional data”, for more information.

4.4.2.6 Coincidence with sharp mfins

If sharp mfins were requested then edge segments are output with a code describing whether the segment lies on a chain of connected sharp mfins as follows:

These codes are only output for edge segments when the sharp_mfins option in PK_TOPOL_render_line is set to PK_render_sharp_mfin_yes.

See Section 4.4.4.19, “Sharp mfin line: SGTPSF” for more information.

4.4.3 Geometry

For hierarchical body segments the geom array always contains the model space box of the body, and ngeom is 6. See Section 4.4.4, “Segment types” for more details.

For a single level segment the geom array is an array of real numbers specifying the geometry of the line it represents. The length and contents of this array depend on the line type, as specified by the second entry of lntp (see Section 4.4.2, “Line type”). The length of the array is ngeom unless otherwise stated. This concept of a line does not correspond exactly to any type of entity at the PK Interface: it is either a set of data describing an analytic curve with a start-point and an end-point, or a poly-line.

The types of line which can be returned are:

4.4.3.1 Straight line: L3TPSL

 

ngeom = 9

geom[0...2]

start point

geom[3...5]

end point

geom[6...8]

direction

The explicit direction is generally more accurate than that obtained from the start and end points.

4.4.3.2 Complete circle: L3TPCC

 

ngeom = 7

geom[0...2]

center point

geom[3...5]

axis direction

geom[6]

radius

4.4.3.3 Partial circle: L3TPCI

 

ngeom = 13

geom[0...2]

center point

geom[3...5]

axis direction

geom[6]

radius

geom[7...9]

start point

geom[10...12]

end point

4.4.3.4 Complete ellipse: L3TPCE

 

ngeom = 11

geom[0...2]

center point

geom[3...5]

major axis direction

geom[6...8]

minor axis direction

geom[9]

major radius

geom[10]

minor radius

4.4.3.5 Partial ellipse: L3TPEL

 

ngeom = 17

geom[0...2]

center point

geom[3...5]

major axis direction

geom[6...8]

minor axis direction

geom[9]

major radius

geom[10]

minor radius

geom[11...13]

start point

geom[14...16]

end point

4.4.3.6 Poly-line: L3TPPY

 

ngeom = the number of 3D vectors

geom[0...2]

start point

geom[3...5]

second point

geom[i...i+2]

nth point, where i = 3(n-1)

Note that the double type array holding a poly-line is of length 3*ngeom.

The poly-line is a chordal approximation to a line which can not be held explicitly within the Kernel. It defines a series of points, each of which lies on the corresponding Parasolid curve. If you join the points of a poly line with straight line segments, this produces an approximation to the curve which is adequate for most viewing purposes. Splining the points produces a more accurate approximation if one is required.

4.4.3.7 For facet vertices

L3TPFV and facet strip vertices - L3TPTS

 

ngeom = the number of facet vertices

geom[0...2]

first facet vertex

geom[3...5]

second facet vertex

geom[i...i+2]

last facet vertex, where i = 3(ngeom-1)

4.4.3.8 For facet vertices plus surface normals

L3TPFN; and facet strip vertices plus surface normals - L3TPTN

 

ngeom = 2 times the number of facet vertices

geom[0...2]

first facet vertex

geom[3...5]

second facet vertex

geom[i...i+2]

last facet vertex, where i = 3((ngeom/2)-1)

geom[i+3...i+5]

first facet vertex normal

geom[i+6...i+8]

second facet vertex normal

geom[k...k+2]

last facet vertex normal, where k = 3(ngeom-1)

4.4.3.9 For facet vertices plus parameters

L3TPFP; and facet strip vertices plus parameters - L3TPTP

 

ngeom = 2 times the number of facet vertices

geom[0...2]

first facet vertex

geom[i...i+2]

last facet vertex, where i = 3 (ngeom/2-1)

geom[i+3...i+5]

first facet vertex (u,v,t) information

geom[k...k+2]

last facet vertex (u,v,t), where k = 3(ngeom-1)

4.4.3.10 For facet vertices plus normals plus parameters

L3TPFI; and facet strip vertices plus normal plus parameters - L3TPTI

 

ngeom = 3 times the number of facet vertices

geom[0...2]

first facet vertex

geom[i...i+2]

last facet vertex, where i = ngeom-3

geom[i+3...i+5]

first facet vertex normal

geom[k...k+2]

last facet vertex normal, where k = 2(ngeom-3)

geom[k+3...k+5]

first facet vertex (u,v,t) information

geom[l...l+2]

last facet vertex (u,v,t), where l = 3(ngeom-1)

4.4.3.11 Non-rational B-curves: L3TPPC

 

ngeom = the number of Bezier vertices defining the curve

geom[0...2]

first Bezier vertex

geom[3...5]

second Bezier vertex

geom[i...i+2]

last Bezier vertex, where i = 3(ngeom-1)

4.4.3.12 Rational B-curves: L3TPRC

 

ngeom = the number of points

geom[0...2]

first Bezier vertex

geom[3]

first weight

geom[4...6]

second Bezier vertex

geom[7]

second weight

geom[i...i+2]

last Bezier vertex, where i = 4(ngeom-1)

geom[i+3]

last weight, where i = 4(ngeom-1)

4.4.3.13 Non-rational B-curves in NURBs form: L3TPNC

 

ngeom = 3 (number of b-spline vertices) + number of knots

geom[0...2]

first b-spline vertex

geom[3...5]

second b-spline vertex

geom[i...i+2]

last b-spline vertex, where i = 3(nvertices-1)

geom[3(nvertices)]

first knot, (3(nvertices) = i+3)

geom[3(nvertices)+1]

second knot

geom[3(nvertices)+nknots -1]

last knot

The number of b-spline vertices is supplied in the 9th element of the integer array and the number of knots is supplied in the 10th element of the integer array.

4.4.3.14 Rational B-curves in NURBs form: L3TPRN

 

ngeom = 4 (nvertices) + nknots

geom[0...2]

first b-spline vertex

geom[3]

first weight

geom[4...6]

second b-spline vertex

geom[7]

second weight

geom[i...i+2]

last b-spline vertex, where i = 4(nvertices-1)

geom[i+3]

last weight,

geom[4(nvertices)]

first knot, (4(nvertices) = i+4)

geom[4(nvertices)+1]

second knot

geom[4(nvertices)+nknots-1]

last knot

The number of b-spline vertices is supplied in the 9th element of the integer array and the number of knots is supplied in the 10th element of the integer array.

4.4.3.15 For facet vertices + normals + parameters + 1st derivatives

L3TPF1; and facet strip vertices + normals + parameters + 1st derivatives - L3TPT1

 

ngeom = 5 times the number of facet vertices

geom[0...2]

first facet vertex

geom[i...i+2]

last facet vertex, where i = ngeom-3

geom[i+3...i+5]

first facet vertex normal

geom[k...k+2]

last facet vertex normal, where k = 3(2ngeom/5-1)

geom[k+3...k+5]

first facet vertex (u, v, t) information

geom[l...l+2]

last facet vertex (u, v, t), where l = 3(3ngeom/5-1)

geom[l+3...l+5]

first dP/du derivative

geom[m...m+2]

last dP/du derivative where m = 3(4ngeom/5-1)

geom[m+3...m+5]

first dP/dv derivative

geom[n...n+2]

last dP/dv derivative where n = 3(ngeom-3)

4.4.3.16 For facet vertices + normals + parameters + all derivatives

L3TPF2; and facet strip vertices + normals + parameters + all derivatives - L3TPT2

 

ngeom = 8 times the number of facet vertices

geom[0...2]

first facet vertex

geom[i...i+2]

last facet vertex, where i = 3(ngeom/8-1)

geom[i+3...i+5]

first facet vertex normal

geom[k...k+2]

last facet vertex normal, where k = 3(2ngeom/8-1)

geom[k+3...k+5]

first facet vertex (u, v, t) information

geom[l...l+2]

last facet vertex (u, v, t), where l = 3(3ngeom/8-1)

geom[l+3...l+5]

first dP/du derivative

geom[m...m+2]

last dP/du derivative, where m = 3(ngeom/2-1)

geom[m+3...m+5]

first dP/dv derivative

geom[n...n+2]

last dP/dv derivative, where n = 3(5ngeom/8-1)

geom[n+3...n+5]

first d2P/du2 derivative

geom[p...p+2]

last d2P/du2 derivative, where p = 3(6ngeom/8-1)

geom[p+3...p+5]

first d2P/dudv derivative

geom[q...q+2]

last d2P/dudv derivative, where q = 3(7ngeom/8-1)

geom[q+3...q+5]

first d2P/dv2 derivative

geom[r...r+2]

last d2P/dv2 derivative, where r = 3(ngeom/8-1)

4.4.3.17 Complete sphere L3TPCS

 

ngeom = 4

geom[0...2]

center point

geom[3]

radius

4.4.3.18 Complete cylinder L3TPCY

 

ngeom = 7

geom[0...2]

start point

geom[3...5]

end point

geom[6]

radius

4.4.3.19 Complete truncated cone L3TPCN

 

ngeom = 8

geom[0...2]

start point

geom[3...5]

end point

geom[6]

start radius

geom[7]

end radius

4.4.4 Segment types

As stated earlier, the first argument of each segment output function is the segment type. A segment of a particular type is always of the same class:

The segment types with their dependent data are as follows.

4.4.4.1 Body: SGTPBY

This type of hierarchical segment corresponds to an occurrence of a body in the model. If an entity within a body is passed to a rendering function, Parasolid still opens the body segment with GOOPSG before outputting the requested entity, and closes the body segment afterwards. This lets you build a graphical data structure and subsequently update it.

There is no geometric data apart from the body box, as all the lines which make up the body in the picture form separate segments within the body segment.

4.4.4.2 Face: SGTPFA

This type of hierarchical segment corresponds to an occurrence of a face in a model. GOOPSG allows you to build a graphical data structure in the same way as for bodies as explained above.

The following are all single-level segment types which may be output by GOSGMT:

4.4.4.3 Edge: SGTPED

These represent edges or portions of edges. They are produced by PK_TOPOL_render_line if you specified the edge option. An edge segment may be a complete edge (E) of the model or may be only part of an edge, for example:

If regional data is required lntp contains two extra integer values: the indices of the start and end points of the line (see Section 4.5).

4.4.4.4 Silhouette line: SGTPSI

A silhouette is a line on a single face curving away from the eye where its surface changes from visible to hidden. Both view dependent topology and hidden line drawings produce silhouettes. They may be output whole, or cut or shortened in the same way as for edges, see above.

See Section 4.5, “Interpreting regional data”, for information on regional data.

4.4.4.5 Planar hatch-line: SGTPPH

4.4.4.6 Radial hatch-line: SGTPRH

4.4.4.7 Rib line on unfixed blend: SGTPRU

This is a further way of rendering an unfixed blend: adding lines across the blend surface, roughly perpendicular to the original edge. Rib lines can be drawn as well as a blend boundary, but not instead of it. As for blend boundaries, rib lines can only be produced by a view independent drawing.

4.4.4.8 Blend-boundary line on unfixed blend: SGTPBB

If an edge with an unfixed blend is being rendered as view independent topology with unfixed blends, the blend is rendered instead of the edge. The way in which the blend is rendered depends on the option data provided with the unfixed blend option, or if this is absent, on the attribute data associated with the blend. Unfixed blends are ignored by all the other rendering functions.

See the Section 104.3.19, “Unfixed blends”, in the Parasolid Functional Description manual for further information on rendering unfixed blends.

A blend boundary is the line where the blending surface meets the faces or other blends adjacent to the edge.

4.4.4.9 Parametric Hatch line: SGTPPL

tags contains the tag of the face.

4.4.4.10 Facet: SGTPFT

A facet is a planar or near planar polygon. A face rendered by the facet rendering function is approximated by a collection of contiguous facets. The data supplied is dependent on the setting of the rendering options to the faceting function.

See Chapter 106, “Facet Mesh Generation” and Chapter 107, “Faceting Output Via GO” in the Parasolid Functional Description manual for further information on faceting.

If a facet has multiple loops, the outer loop is output first and the inner loops follow. The vertices of the outer loop are ordered counter-clockwise when viewed down the surface normal. The vertices of inner loops are ordered clockwise. Facets are manifold. That is, no vertex coincides with any other in the same facet, nor does it lie in any edge in the same facet.

This type of facet is only produced by the facet drawing function.

4.4.4.11 Error Segment: SGTPER

When rendering a list of entities, Parasolid may encounter a body, face or edge which it is unable to render (e.g. a rubber face). In such a case, Parasolid outputs an error segment giving the tag of the bad entity a code indicating why it was not rendered. When the error segment has been output, Parasolid continues to render the remaining entities.

4.4.4.12 Geometric Segments: SGTPGC, SGTPGS, SGTPGB

Geometric segment types SGTPGC (curves), SGTPGS (surfaces), and SGTPGB (surface boundaries) are used to sketch unchecked parametric curves and surfaces as view independent drawings enabling the relevant curve/surface to be visualised.

4.4.4.13 Mangled Facet: SGTPMF

If during a call to the facet drawing function, user tolerances can't be matched, or facets are created which self intersect or are severely creased, then geometric data is output as a segment type SGTPMF. In this case, the facets are always triangular.

4.4.4.14 Visibility Segment: SGTPVT

If PK_TOPOL_render_line is used to output data hierarchically from a hidden line drawing (that is, if the hierarch option is anything but PK_render_hierarch_no_c), then the single level segments output for each edge, silhouette, or hatch-line are:

If regional data has been requested, tags holds the regional information for the segments between the visibility transition points. This means that ntags is twice the value of nlntp , since nlntp represents the number of visibility code pairs (see below).

If regional data is not requested, then ntags is zero and tags contains no regional information.For more information on regional data, see Section 4.5, “Interpreting regional data”.

geom holds the visibility transition points, i.e. the vectors in model space where the edge changes visibility or smoothness. ngeom holds the number of these visibility transition points.

The lntp array is structured as shown in Figure 4-2 and Figure 4-3. The array consists of five blocks of data, as follows:

 

Figure 4-2 Structure of the lntp array explaining visibility codes, smoothness codes and regional data

 

Figure 4-3 Structure of the lntp array explaining viewport codes and sharp mfin codes

 

4.4.4.15 Facet Strip: SGTPTS

Using the ‘facet strip’ option when outputting data from the facet drawing function results in this data being output in the form of a ‘strip’ or ‘ribbon’ consisting of triangular facets.

The number of facets in each strip must be specified in the option data list when using this option.

Triangular facets share vertices between adjacent facets with the geometry specifying the vertices of the triangles in a particular order. For example, in a strip consisting of eight triangular facets the order of the vertices are specified as follows:

 

Figure 4-4 The ordering of vertices in a facet strip

As can be seen from the above example, triangular strip geometry only stores ‘n + 2’ vertices, whereas an individual-triangle’s geometry stores ‘3n’ vertices.

4.4.4.16 Parametrized Visibility Segment: SGTPVP

If the hierarch option is used to output data hierarchically from a hidden line drawing then the single level segments output for each edge, silhouette, or hatch line is very similar to those output when the other hierarchical options are specified, i.e.

However, when the geometry segment is a polyline, the visibility segment supplied is of type SGTPVP rather than SGTPVT:

The parameterisation of polylines is pseudo arc-length, normalized so that the parameter interval of any polyline is always [0,1]. That is, the parameter of any point on the polyline is equal to the distance between the point and the start measured along the polyline, divided by the total length of the polyline.

The parameters are supplied in order to help the application locate the chord in the polyline on which the associated visibility transition point lies.

Given a polyline P with N chords, defined by the set of 3-D points:

we define the total length of a polyline consisting of N chords as:

and define distance D(t) as the length of the polyline at parameter value t measured from the point .

Given a visibility transition point v with parameter value we can find the chord on which the point v lies by finding a point index n such that

The position v is given by:

4.4.4.17 Interference curve: SGTPIC

If, in PK_TOPOL_render_line, overlapping bodies are detected during the rendering process by setting the overlap option to PK_render_overlap_intersect_c, then this segment type is used for any curves that are generated as a result of intersections between overlapping faces in the bodies. See Section 104.3.20, “Overlapping bodies”, in the Parasolid Functional Description, for more information.

4.4.4.18 Clip line: SGTPCL

If, in PK_TOPOL_render_line, 3D viewports are enabled by setting viewport_type to PK_render_viewport_type_3D_c and viewport clipping is enabled by setting viewport_clipping to PK_render_viewport_clip_yes_c, then any clashes between rendering faces and viewport faces will result in the generation of a clip line. Segments on clip lines are marked with the code SGTPCL. See Section 104.3.23.3, “Clipping entities to viewport boundaries”, in the Functional Description, for more information about viewports.

4.4.4.19 Sharp mfin line: SGTPSF

If, in PK_TOPOL_render_line, sharp mfins are requested by setting sharp_mfins to PK_render_sharp_mfins_yes_c then polylines that run along chains of connected sharp mfins will be rendered for every face that contains facet geometry. See Section 104.3.4, “Sharp mfins”, in the Functional Description, for more information.

4.4.4.20 Lattice geometric segments: SGTPLB, SGTPLR

Lattice segment types SGTPLB (lattice balls), and SGTPLR (lattice rods) are used to render lattice balls as spheres and lattice rods as straight lines between the 2 balls it connects. See Section 104.2.4, “Lattice”, in the Functional Description for more information.

[back to top]


4.5 Interpreting regional data

Regional data is produced in a hidden line drawing when you use the region option in PK_TOPOL_render_line_o_t. It tells you how to split a hidden line picture into separate 2D regions, as shown in the Figure 4-5.

 

Figure 4-5 Interpreting regional data

A single edge may bound several regions on the two-dimensional picture (for instance the edge marked in Figure 4-5, bounds regions A, C, D, E, F and G). When this happens it is divided at the intersections, and output as several segments, with the same basic segment data (and completeness code CODINC), but different regional data. The additional data is of two types: adjacent faces, and point indices.

4.5.1 Adjacent faces

The order of faces returned in regional data is based on the orientation of the faces either side of the boundary line in question, relative to the direction of the curve and viewing direction.

When a bounding line is output with regional data, the tags array is of length 3 (i.e. ntags =3):

PK_ENTITY_null indicates that the region of the picture on that side of the line is either part of a face not tagged for regional data or outside the 2D representation of the model (the “outside” of the picture).

Face tags are returned relative to the direction of the line, which is required to interpret the point indices correctly: tags[1] is the left face, and tags[2] the right.

Figure 4-6 illustrates how regional data is returned when rendering three cubes, with a view direction such that only one face from each cube is visible, two of which are partially obscured. The illustration shows how regional data is returned for a sample of edges in the rendered image, shown in red. For simplicity, PK_ENTITY_null is shown as 0 in the illustration, and tags[0] is not shown.

 

Figure 4-6 Format of regional data for edges

4.5.2 Point indices

The lntp array is of length 7 for a segment with regional data. Elements lntp[5] and lntp[6] are the start index and end index respectively for the line. They are non-zero integer values, and specify which “points” of the two-dimensional picture the segment joins.

Suppose segment A has end index x, and segment B has start index x. Then the end point of A and the start point of B should be regarded as the same point in the two-dimensional picture, even if their geometric projections do not exactly coincide. (This may happen as the result of numerical approximations in rendering.) You will also find that of all the lines sharing a point index, one with it as an end index and one with it as a start index share an adjacent face on the left, and so these two can be linked up as consecutive portions of the boundary of a region; and similarly with faces on the right. The values used for point indices are not in any meaningful order.

[back to top]


4.6 Graphical output of pixel data

Another part of the GO consists of three functions for producing pixel data. These were required to support the KI function RRPIXL. These functions do not need to be implemented to support the PK (they can be supplied in dummy form).

 

Function

Description

GOOPPX

open output of encoded pixel data

GOPIXL

output encoded pixel data

GOCLPX

close output of encoded pixel data

See Appendix J, “Legacy Functions”, for further information on the interface to these functions.

 

 

[back to top]

<<< File Header Structure Chapters Registering the Frustrum >>>