Sun Microsystems Documentation
Begin Tab Sub LinksActive Sub LinkView this Book Download this Book

SunPHIGS 3.0 >> SunPHIGS 3.0 Extensions Reference Manual >> COMPUTE FILL AREA SET GEOMETRIC NORMAL(3PP)

PreviousPrevious: CELL ARRAY 3 PLUS(3PP)

NAME

COMPUTE FILL AREA SET GEOMETRIC NORMAL - compute geometric normal of the fill area set

SYNOPSIS

C Syntax

void
pcomp_fill_area_set_gnorm ( vflag, nfa, vdata, error_ind, normal )
Pint                 vflag;         what vertex data is available
Pint                 nfa;          number of fill areas
Pfacet_vdata_list3   * vdata;      fill area data
Pint                 * error_ind;  OUT error indicator
Pvec3                * normal;     OUT geometric normal

FORTRAN Syntax

SUBROUTINE pcfasn ( NFA, FARR, NV, COORDS, ERRIND, GNORM )
INTEGER      NFA                number of fill areas
INTEGER      FARR(NFA)          array of end indices per facet
INTEGER      NV                 number of vertices
REAL         COORDS(3,NV)       array of vertex coordinates
INTEGER      ERRIND             OUT error indicator
REAL         GNORM(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 PLUS and is not part of the PHIGS standard.

C Input Parameters

All of the following data types are predefined in phigs.h.
vflag
The data per vertex flag specifies the available data for each vertex of the primitive.
                0   PVERT_COORD                       Coordinates Specified
                1   PVERT_COORD_COLOUR                Coordinates and Vertex Colour
                                                      Specified
                2   PVERT_COORD_NORMAL                Coordinates and Vertex
                                                      Normal Specified
                3   PVERT_COORD_COLOUR_NORMAL         Coordinates, Vertex Colour,
                                                      and Vertex Normal Specified

nfa
The number of fill areas in the set.
vdata
A pointer, to a list of nfa Pfacet_vdata_list3 structures, that specifies the fill area set and optionally associated colour information. Pfacet_vdata_list3 is defined as
follows:
typedef struct {
Pint               num_vertices; /* number of vertices * /
Pfacet_vdata_arr3  vertex_data;     /* array of facet vertex data * /

} Pfacet_vdata_list3;
Pfacet_vdata_arr3 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 * /

} Pfacet_vdata_arr3;
Ppoint3 is defined as follows:
typedef struct {
Pfloat   x;   /* x coordinate * /
Pfloat   y;   /* y coordinate * /
Pfloat   z;   /* z coordinate * /

} Ppoint3;
Pptco3 is defined as follows:
typedef struct {
Ppoint3   point;  /* point coordinates * /
Pcoval    colr;   /* colour * /

} Pptco3;
Ppoint3 is defined above. Pcoval is defined as follows:
typedef union {
Pint
ind;
/* index in workstation colour
bundle table * /
Pcolr_rep
direct;
/* direct colour components * /
} Pcoval;
Pcolr_rep is defined as follows:
typedef union {
Prgb        rgb;        /* Red, Green, Blue colour specification * /
Pcieluv     cieluv;     /* CIE L* U* V* colour specification * /
Phls        hls;        /* Hue, Lightness, Saturation colour
                          specification * /
Phsv        hsv;        /* Hue, Saturation, Value colour
                          specification * /
Pdata       unsupp;     /* Colour in unsupported colour model * /

} Pcolr_rep;
Prgb is defined in phigs.h as follows:
typedef struct {
Pfloat       red;        /* red, hue, and so on * /
Pfloat       green;      /* green, saturation, lightness, and so on * /
Pfloat       blue;       /* blue, value, saturation, and so on * /

} Prgb;
Pcieluv is defined in phigs.h as follows:
typedef struct {
Pfloat           cieluv_x;       /* x coefficient * /
Pfloat           cieluv_y;       /* y coefficient * /
Pfloat           cieluv_y_lum; /* y luminance * /

} Pcieluv;
Phsv is defined in phigs.h as follows:
typedef struct {
Pfloat           hue;            /* hue * /
Pfloat           satur;          /* saturation * /
Pfloat           value;          /* value * /

} Phsv;
Phls is defined in phigs.h as follows:
typedef struct {
Pfloat           hue;            /* hue * /
Pfloat           lightness;      /* lightness * /
Pfloat           satur;          /* saturation * /

} Phls;
Pdata is defined in phigs.h as follows:
typedef struct {
size_t          size;           /* size of data * /
char            * data          /* pointer to data * /

} Pdata;
Pptnorm3 is defined as follows:
typedef struct {
Ppoint3 point;
/* point coordinates * /
Pvec3
normal;
/* normal * /
} Pptnorm3;
Ppoint3 is defined above. Pvec3 is defined as follows:
typedef struct {
Pfloat           delta_x;        /* x magnitude * /
Pfloat           delta_y;        /* y magnitude * /

Pfloat
delta_z;
/* z magnitude * /
} Pvec3;
Pptconorm3 is defined as follows:
typedef struct {
Ppoint3         point;          /* point coordinates * /
Pcoval          colr;           /* colour * /
Pvec3           norm;           /* normal * /

} Pptconorm3;
Ppoint3, Pcoval, and Pvec3 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. (Pvec3 is
defined above.)

FORTRAN Input Parameters

All of the following data types are predefined in phigs77.h.
NFA
The 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.
NV
The 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 non-colinear 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

002
Ignoring function, function requires state (PHOP, * ,* ,* )
612
Warning, the fill area is degenerate

SEE ALSO

FILL AREA SET 3 WITH DATA (3PP)
INTRO (3PP)

NextNext: COPY ELEMENT RANGE(3PP)
ContactAbout SunNewsEmploymentSite MapPrivacyTerms of UseTrademarksCopyright Sun Microsystems, Inc.