COMPUTE FILL AREA SET GEOMETRIC NORMAL(3P+) — MISC. REFERENCE MANUAL PAGES
NAME
COMPUTE FILL AREA SET GEOMETRIC NORMAL − compute geometric normal of the fill area set
SYNOPSIS
C Syntax
void
pcompfillareasetgnorm ( vflag, nfa, vdata, error_ind, normal )
Pintvflag;what vertex data is available
Pintnfa;number of fill areas
Pfacetvdatalst3∗vdata; fill area data
Pint∗error_ind;OUT error indicator
Pvector3∗normal;OUT geometric normal
FORTRAN Syntax
SUBROUTINE pcfasn ( NFA, FARR, NV, COORDS, ERRIND, GNORM )
INTEGERNFAnumber of fill areas
INTEGERFARR(NFA)array of end indices per facet
INTEGERNVnumber of vertices
REALCOORDS(3,NV)array of vertex coordinates
INTEGERERRINDOUT error indicator
REALGNORM(3)OUT geometric normal
Required PHIGS Operating States
(PHOP, ∗, ∗, ∗)
DESCRIPTION
Purpose
COMPUTE FILL AREA SET GEOMETRIC NORMAL computes the geometric normal of the fill area set.
This is a SunPHIGS Extension function based on PHIGS+ and is not part of the PHIGS standard.
C Input Parameters
All of the following data types are predefined in phigs.h.
vflagThe data per vertex flag specifies the available data for each vertex of the primitive.
0PVERT_COORDCoordinates Specified
1PVERT_COORD_COLOURCoordinates and Vertex Colour Specified
2PVERT_COORD_NORMALCoordinates and Vertex Normal Specified
3PVERT_COORD_COLOUR_NORMALCoordinates, Vertex Colour, and
Vertex Normal Specified
nfaThe number of fill areas in the set.
vdataA pointer, to a list of nfa Pfacetvdatalst3 structures, that specifies the fill area set and optionally associated colour information. Pfacetvdatalst3 is defined as follows:
typedef struct {
Pintnumber;/∗ number of vertices ∗/
Pfacetvdataarr3vertexdata;/∗ array of facet vertex data ∗/
} Pfacetvdatalst3;
Pfacetvdataarr3 is defined as follows:
typedef union {
Ppoint3∗points;/∗ point ∗/
Pptco3∗ptcolrs;/∗ point and color ∗/
Pptnorm3∗ptnorms;/∗ point and normal ∗/
Pptconorm3∗ptconorms;/∗ point, color, and normal ∗/
/∗ implementation dependent types can go here ∗/
} Pfacetvdataarr3;
Ppoint3 is defined as follows:
typedef struct {
Pfloatx;/∗ x coordinate ∗/
Pfloaty;/∗ y coordinate ∗/
Pfloatz;/∗ z coordinate ∗/
} Ppoint3;
Pptco3 is defined as follows:
typedef struct {
Ppoint3point;/∗ point coordinates ∗/
Pcovalcolour;/∗ colour ∗/
} Pptco3;
Ppoint3 is defined above. Pcoval is defined as follows:
typedef union {
Pintindex;/∗ index in workstation colour bundle table ∗/
Pcobundldirect;/∗ direct colour components ∗/
} Pcoval;
Pcobundl is defined as follows:
typedef struct {
Pfloatx;/∗ red, hue, etc ∗/
Pfloaty;/∗ green, saturation, lightness, etc ∗/
Pfloatz;/∗ blue, value, saturation, etc ∗/
} Pcobundl;
Pptnorm3 is defined as follows:
typedef struct {
Ppoint3point;/∗ point coordinates ∗/
Pvector3normal; /∗ normal ∗/
} Pptnorm3;
Ppoint3 is defined above. Pvector3 is defined as follows:
typedef struct {
Pfloatx;/∗ x magnitude ∗/
Pfloaty;/∗ y magnitude ∗/
Pfloatz;/∗ z magnitude ∗/
} Pvector3;
Pptconorm3 is defined as follows:
typedef struct {
Ppoint3point;/∗ point coordinates ∗/
Pcovalcolour;/∗ colour ∗/
Pvector3normal; /∗ normal ∗/
} Pptconorm3;
Ppoint3, Pcoval, and Pvector3 are defined above.
C Output Parameters
error_ind
A pointer to the location to store the error number.
normal
A pointer to the location to store the computed geometric normal. (Pvector3 is defined above.)
FORTRAN Input Parameters
All of the following data types are predefined in phigs77.h.
NFAThe number of fill areas in the fill area set.
FARR(NFA)
An array of integers containing the end indices in the COORDS array for each point list in the fill area set.
NVThe number of points used to define the fill area set.
COORDS(3,NV)
An array of reals containing the x, y, and z coordinates of the fill area set.
COORDS(1,v) = x Coordinate
COORDS(2,v) = y Coordinate
COORDS(3,v) = z Coordinate
FORTRAN Output Parameters
ERRIND
The error number of any error detected by this function.
GNORM(3)
An array of reals containing the computed geometric normal.
GNORM(1) = x Magnitude
GNORM(2) = y Magnitude
GNORM(3) = z Magnitude
Execution
The geometric normal to the fill area set defined by the vertex coordinates is returned in the unit normal vector. The geometric normal is computed by first selecting three points: A, B, and C. Point A is the first point in the first list of vertices. Point B is the next point in that list that is noncoincident with A. Point C is the next point in that list, after B, that is noncolinear with A and B. The geometric normal is the cross product of the vector extending from A to B with the vector extending from A to C.
If it is not possible to find three such points in the first list of vertices, then the rest of the lists are searched in order to select three appropriate points from a single list. In case the search fails in all lists, then it is determined that the fill area set is degenerate.
ERRORS
002Ignoring function, function requires state (PHOP,∗,∗,∗)
612Warning, the fill area is degenerate
SEE ALSO
FILL AREA SET 3 (3P)
FILL AREA SET 3 WITH DATA (3P+)
INTRO PHIGS+ (3P+)
Sun Release 4.0 — Last change: 2 August 1989