#include <stdio.h>
Include dependency graph for prm.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Compounds | |
struct | _Coord |
Primitive vertex coordinate structure. More... | |
Primitive data structure module | |
For specification see class notes of course CIV-2801 "Fundamentos de Computacao Grafica Aplicada", period 2005.2. Revisions:
| |
#define | ABS(x) (((x) < 0.0)? -(x): (x)) |
#define | COORD_TOL 0.001 |
coordinate tolerance value | |
#define | PRM_WHITE 0xFFFFFFL |
#define | PRM_GRAY 0xC0C0C0L |
#define | PRM_DARK_GRAY 0x808080L |
#define | PRM_BLACK 0x000000L |
#define | PRM_RED 0xFF0000L |
#define | PRM_DARK_RED 0x800000L |
#define | PRM_GREEN 0x00FF00L |
#define | PRM_DARK_GREEN 0x008000L |
#define | PRM_BLUE 0x0000FFL |
#define | PRM_DARK_BLUE 0x000080L |
#define | PRM_YELLOW 0xFFFF00L |
#define | PRM_DARK_YELLOW 0x808000L |
#define | PRM_MAGENTA 0xFF00FFL |
#define | PRM_DARK_MAGENTA 0x800080L |
#define | PRM_CYAN 0x00FFFFL |
#define | PRM_DARK_CYAN 0x008080L |
typedef enum _prmtype | PrmType |
Primitive types. | |
typedef _Coord | Coord |
Primitive vertex coordinate structure. | |
typedef _prm | Prm |
Primitive structure type definition. | |
enum | _prmtype { PRM_UNDEF, PRM_QUAD, PRM_CIRC, NumPrmTypes } |
Primitive types. More... | |
Prm * | prmCreateFront (PrmType type) |
This function creates a new primitive, puts it at the beginning of the list of primitives. | |
Prm * | prmCreateBack (PrmType type) |
This function creates a new primitive, puts it at the end of the list of primitives. | |
void | prmDelete (Prm *prm) |
This function removes a primitive, which is specified by the given pointer, from the current list of primitives and releases memory that is used by it. | |
void | prmDeleteSelected (void) |
This function removes all the primitives in the list that are selected, i.e., that have their selection flag set. | |
void | prmDeleteList (void) |
This function realeases the memory that is used by the current list of primitives and resets the list. | |
Prm * | prmFirst (void) |
This function returns a pointer to the first primitive of the current list. | |
Prm * | prmLast (void) |
This function returns a pointer to the last primitive of the current list. | |
Prm * | prmNext (Prm *prm) |
This function returns a pointer to the next primitive in relation to the given primitive (given by its pointer). | |
Prm * | prmPrevious (Prm *prm) |
This function returns a pointer to the previous primitive in relation to the given primitive (given by its pointer). | |
void | prmMoveFront (Prm *prm) |
This function moves the given primitive (given by its pointer) to the first position in the list of primitives. | |
void | prmMoveBack (Prm *prm) |
This function moves the given primitive (given by its pointer) to the last position in the list of primitives. | |
int | prmGetType (Prm *prm) |
This function returns (as its value) a code indicating the type of the given primitive (given by its pointer). | |
void | prmRead (Prm *prm, FILE *fd) |
This function reads geometry data of a given primitive (given by its pointer) from a file (given by its pointer) and loads the data into the primitive attributes. | |
void | prmWrite (Prm *prm, FILE *fd) |
This function writes the geometry attribute data of a given primitive (given by its pointer) to a file (given by its pointer). | |
int | prmGetNPts (Prm *prm) |
This function returns (as its value) the number of vertices of the given primitive (given by its pointer). | |
void | prmSetCoords (Prm *prm, int id, double x, double y) |
This function replaces the x and y coordinates of a vertex of the given primitive (given by its pointer) by the given pair of coordinates. | |
void | prmGetCoords (Prm *prm, int id, double *x, double *y) |
This function returns the x and y coordinates of a vertex of the given primitive (given by its pointer). | |
void | prmSet1stPt (Prm *prm, double x, double y) |
This function is used during interactive construction of a primitive. | |
void | prmSet2ndPt (Prm *prm, double x, double y) |
This function is used during interactive construction of a primitive. | |
void | prmSelectAll (void) |
This function selects all the primitives in the current list of primitives, i.e., it sets the selection flag of all the primitives. | |
void | prmSelect (Prm *prm) |
This function selects the given primitive (given by its pointer), i.e., it sets the selection flag of the primitive. | |
void | prmUnselect (Prm *prm) |
This function unselects the given primitive (given by its pointer), i.e., it resets (sets to null) the selection flag of the primitive. | |
void | prmUnselectAll (void) |
This function unselects all the primitives in the current list of primitives, i.e., it resets (sets to null) the selection flag of all the primitives. | |
int | prmCheckSelected (Prm *prm) |
This function returns the selection status (false = 0; true = 1) of the given primitive (given by its pointer). | |
void | prmSetColor (Prm *prm, long int color) |
This function sets the color of the given primitive (given by its pointers). | |
long int | prmGetColor (Prm *prm) |
This function returns the color of the given primitive (given by its pointers). | |
void | prmSetHeight (Prm *prm, double height) |
This function sets the height of the given primitive (given by its pointers). | |
double | prmGetHeight (Prm *prm) |
This function returns the height of the given primitive (given by its pointers). | |
int | prmPickArea (Prm *prm, double x, double y) |
This function checks whether a given point is in the interior of a given primitive (given by its pointer). | |
int | prmPickVertex (Prm *prm, double x, double y, double tol, int *id) |
This function selects a vertex on the boundary of a given primitive based on the given point position. | |
int | prmPickSide (Prm *prm, double x, double y, double tol, int *id) |
This function selects a side on the boundary of a given primitive based on the given point position. | |
void | prmTranslate (Prm *prm, double dx, double dy) |
This function translates the given primitive (given by its pointer). | |
void | prmTranslateVertex (Prm *prm, int id, double dx, double dy) |
This function translates a vertex of a given primitive (given by its pointer) using the given translation factors. | |
void | prmTranslateSide (Prm *prm, int id, double dx, double dy) |
This function translates the two vertices of a side of a given primitive (given by its pointer) using the given translation factors. | |
void | prmGetBox (Prm *prm, double *xmin, double *xmax, double *ymin, double *ymax) |
This function returns the limiting rectangle that involves the given primitive (given by its pointer). | |
int | prmGetGlobalBox (double *xmin, double *xmax, double *ymin, double *ymax) |
This function returns the limiting rectangle that involves all the primitives in the current list. | |
void | prmDisplayBoundary (Prm *prm) |
This function displays the boundary of the given primitive (given by its pointer). | |
void | prmDisplayInterior (Prm *prm) |
This function displays the interior of the given primitive (given by its pointer). | |
void | prmDisplaySolid (Prm *prm) |
Function to display a solid version of a given primitive. | |
void | prmHighltSolid (Prm *prm) |
Function to highlight a solid version of a given primitive. | |
void | prmDisplayZbuffer (Prm *prm) |
Function to send a solid version of a given primitive to the zbuffer module to be projected and displayed. |
|
Definition at line 46 of file prm.h. Referenced by dspShadeColor(). |
|
coordinate tolerance value
|
|
Definition at line 84 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 89 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 95 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 90 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 96 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 83 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 88 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 94 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 86 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 92 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 82 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 87 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 93 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 85 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 81 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Definition at line 91 of file prm.h. Referenced by prmioGetColorCode(), and prmioGetColorLabel(). |
|
Primitive vertex coordinate structure.
|
|
Primitive structure type definition.
|
|
Primitive types.
Referenced by prmCreateBack(), prmCreateFront(), and prmioInterpret(). |
|
Primitive types.
|
|
This function returns the selection status (false = 0; true = 1) of the given primitive (given by its pointer).
Definition at line 562 of file prm.c. Referenced by dspModel(). |
|
This function creates a new primitive, puts it at the end of the list of primitives. An empty primitive of the given type is created. The special case of a current empty list is also treated. The head pointer to the list is modified in this case.
Definition at line 266 of file prm.c. References circCreate(), _prm::geom, PRM_CIRC, PRM_QUAD, prmCreateEmpty(), prmInsertBack(), PrmType, quadCreate(), and _prm::type. Referenced by prmioInterpret(). |
|
This function creates a new primitive, puts it at the beginning of the list of primitives. An empty primitive of the given type is created. The head pointer to the list is modified accordingly. The special case of a current empty list is also treated.
Definition at line 238 of file prm.c. References circCreate(), _prm::geom, PRM_CIRC, PRM_QUAD, prmCreateEmpty(), prmInsertFront(), PrmType, quadCreate(), and _prm::type. Referenced by prmioInterpret(). |
|
This function removes a primitive, which is specified by the given pointer, from the current list of primitives and releases memory that is used by it. It is assumed that the given pointer is really a valid pointer to an existing primitive. The head pointer to the list of primitives may be modified accordingly. The special case of a resulting empty list is also treated.
Definition at line 294 of file prm.c. References circDelete(), _prm::geom, PRM_CIRC, PRM_QUAD, prmRemoveFromList(), quadDelete(), and _prm::type. Referenced by prmDeleteSelected(). |
|
This function realeases the memory that is used by the current list of primitives and resets the list. The function sets a null value for its head pointer. Definition at line 327 of file prm.c. Referenced by prjOpenModel(), and prjQuit(). |
|
This function removes all the primitives in the list that are selected, i.e., that have their selection flag set. The head pointer to the list of primitives may be modified accordingly. The special case of a resulting empty list is also treated. Definition at line 316 of file prm.c. References prmDelete(), and prmGetFirstSelected(). |
|
This function displays the boundary of the given primitive (given by its pointer). The function only deals with the geometric attributes of the primitive. This means that other attributes such as foreground color, line style, or mark type are specified outside this function. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 742 of file prm.c. References circDisplayBoundary(), _prm::geom, PRM_CIRC, PRM_QUAD, quadDisplayBoundary(), and _prm::type. |
|
This function displays the interior of the given primitive (given by its pointer). The interior area is filled with the currently specified background color. The function only deals with the geometric attributes of the primitive. This means that other attributes such as background color or interior style are specified outside this function. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 759 of file prm.c. References circDisplayInterior(), _prm::geom, PRM_CIRC, PRM_QUAD, quadDisplayInterior(), and _prm::type. |
|
Function to display a solid version of a given primitive. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height. This function fills the solid prism faces with the current color. It uses OpenGL display functions.
Definition at line 776 of file prm.c. References circDisplaySolid(), _prm::geom, PRM_CIRC, PRM_QUAD, prmGetHeight(), quadDisplaySolid(), and _prm::type. |
|
Function to send a solid version of a given primitive to the zbuffer module to be projected and displayed. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height.
Definition at line 810 of file prm.c. References circDisplayZbuffer(), _prm::geom, PRM_CIRC, PRM_QUAD, prmGetColor(), prmGetHeight(), quadDisplayZbuffer(), and _prm::type. |
|
This function returns a pointer to the first primitive of the current list.
Definition at line 334 of file prm.c. Referenced by drvRedisplay(), dspModel(), prjBuildDisplayList(), prjGetHeightFac(), prjPckPrm(), prjSetHeightFac(), prjZbufferSnapShot(), and prmioWriteList(). |
|
This function returns the limiting rectangle that involves the given primitive (given by its pointer). This rectangle is the primitive bounding box, which is parallel to the x and y axes, with the minimum and maximum x and y coordinates of the primitive's vertices. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 714 of file prm.c. References circGetBox(), _prm::geom, PRM_CIRC, PRM_QUAD, quadGetBox(), and _prm::type. |
|
This function returns the color of the given primitive (given by its pointers). The color is returned in a long integer with a coded RGB color (adopted in the CD graphics system). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 577 of file prm.c. References _prm::color. Referenced by dspPrm(), prmDisplayZbuffer(), and prmioWriteList(). |
|
This function returns the x and y coordinates of a vertex of the given primitive (given by its pointer). The vertex is indicated by an index to the local array of vertices of the primitive. Nothing will happen if the given index is outside the range of valid indices of vertices. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 483 of file prm.c. References circGetCoords(), _prm::geom, PRM_CIRC, PRM_QUAD, quadGetCoords(), and _prm::type. |
|
This function returns the limiting rectangle that involves all the primitives in the current list. This rectangle is the bounding box of the current set of primitives, which is parallel to the x and y axes, with the minimum and maximum x and y coordinates of all primitive's vertices.
Definition at line 732 of file prm.c. Referenced by prjOpenModel(). |
|
This function returns the height of the given primitive (given by its pointers). The height is used only in 3D applications. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 591 of file prm.c. References _prm::height. Referenced by prjGetHeightFac(), prmDisplaySolid(), prmDisplayZbuffer(), prmHighltSolid(), and prmioWriteList(). |
|
This function returns (as its value) the number of vertices of the given primitive (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 445 of file prm.c. References circGetNPts(), _prm::geom, PRM_CIRC, PRM_QUAD, quadGetNPts(), and _prm::type. |
|
This function returns (as its value) a code indicating the type of the given primitive (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 404 of file prm.c. References _prm::type. Referenced by prmioWriteList(). |
|
Function to highlight a solid version of a given primitive. The solid version is a prism that has the 2D primitive as its base and height equal to the primitive height. This function displays the edges of the prism and draws marks at its vertices, all with the current color. It uses OpenGL display functions.
Definition at line 793 of file prm.c. References circHighltSolid(), _prm::geom, PRM_CIRC, PRM_QUAD, prmGetHeight(), quadHighltSolid(), and _prm::type. |
|
This function returns a pointer to the last primitive of the current list.
|
|
This function moves the given primitive (given by its pointer) to the last position in the list of primitives. It is assumed that the given pointer is really a valid pointer to an existing primitive. Nothing will happen if the given primitive is already the last of the list.
Definition at line 383 of file prm.c. References _prm::prev, prmInsertBack(), and prmRemoveFromList(). Referenced by prmioInterpret(). |
|
This function moves the given primitive (given by its pointer) to the first position in the list of primitives. It is assumed that the given pointer is really a valid pointer to an existing primitive. The head pointer to the list is modified accordingly. Nothing will happen if the given primitive is already the first of the list.
Definition at line 362 of file prm.c. References prmInsertFront(), and prmRemoveFromList(). Referenced by prmioInterpret(). |
|
This function returns a pointer to the next primitive in relation to the given primitive (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 348 of file prm.c. Referenced by dspModel(), prjPckPrm(), and prmioWriteList(). |
|
This function checks whether a given point is in the interior of a given primitive (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 598 of file prm.c. References circPickArea(), _prm::geom, PRM_CIRC, PRM_QUAD, quadPickArea(), and _prm::type. Referenced by prjPckPrm(). |
|
This function selects a side on the boundary of a given primitive based on the given point position.
Definition at line 641 of file prm.c. References circPickSide(), _prm::geom, PRM_CIRC, PRM_QUAD, quadPickSide(), and _prm::type. |
|
This function selects a vertex on the boundary of a given primitive based on the given point position.
Definition at line 619 of file prm.c. References circPickVertex(), _prm::geom, PRM_CIRC, PRM_QUAD, quadPickVertex(), and _prm::type. |
|
This function returns a pointer to the previous primitive in relation to the given primitive (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing primitive.
|
|
This function reads geometry data of a given primitive (given by its pointer) from a file (given by its pointer) and loads the data into the primitive attributes. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 411 of file prm.c. References circRead(), _prm::geom, PRM_CIRC, PRM_QUAD, quadRead(), and _prm::type. Referenced by prmioInterpret(). |
|
This function selects the given primitive (given by its pointer), i.e., it sets the selection flag of the primitive. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 541 of file prm.c. Referenced by prjSelectPrm(). |
|
This function selects all the primitives in the current list of primitives, i.e., it sets the selection flag of all the primitives.
|
|
This function is used during interactive construction of a primitive. It sets the x and y coordinates of the first construction point of the given primitive (given by its pointer) by the given pair of coordinates. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 500 of file prm.c. References circSet1stPt(), _prm::geom, PRM_CIRC, PRM_QUAD, quadSet1stPt(), and _prm::type. |
|
This function is used during interactive construction of a primitive. It sets the x and y coordinates of the second construction point of the given primitive (given by its pointer) by the given pair of coordinates. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 517 of file prm.c. References circSet2ndPt(), _prm::geom, PRM_CIRC, PRM_QUAD, quadSet2ndPt(), and _prm::type. |
|
This function sets the color of the given primitive (given by its pointers). The color is given by a long integer with a coded RGB color (adopted in the CD graphics system). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 570 of file prm.c. References _prm::color. Referenced by prmioInterpret(). |
|
This function replaces the x and y coordinates of a vertex of the given primitive (given by its pointer) by the given pair of coordinates. The vertex is indicated by an index to the local array of vertices of the primitive. Nothing will happen if the given index is outside the range of valid indices of vertices. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 466 of file prm.c. References circSetCoords(), _prm::geom, PRM_CIRC, PRM_QUAD, quadSetCoords(), and _prm::type. |
|
This function sets the height of the given primitive (given by its pointers). The height is used only in 3D applications. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 584 of file prm.c. References _prm::height. Referenced by prjSetHeightFac(), and prmioInterpret(). |
|
This function translates the given primitive (given by its pointer). All the vertices of the primitive are translated by the given translation factors. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 663 of file prm.c. References circTranslate(), _prm::geom, PRM_CIRC, PRM_QUAD, quadTranslate(), and _prm::type. Referenced by prmioInterpret(). |
|
This function translates the two vertices of a side of a given primitive (given by its pointer) using the given translation factors. The target side is indicated by an index, which should have a value between 0 and the number of primitive vertices minus one. Nothing will happen if the given index is outside this range. The index of a side corresponds to the index of its first vertex. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 697 of file prm.c. References circTranslateSide(), _prm::geom, PRM_CIRC, PRM_QUAD, quadTranslateSide(), and _prm::type. Referenced by prmioInterpret(). |
|
This function translates a vertex of a given primitive (given by its pointer) using the given translation factors. The target vertex is indicated by its index to the primitive coordinate vector, which should have a value between 0 and the number of vertices minus one. Nothing will happen if the given index is outside this range. It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 680 of file prm.c. References circTranslateVertex(), _prm::geom, PRM_CIRC, PRM_QUAD, quadTranslateVertex(), and _prm::type. Referenced by prmioInterpret(). |
|
This function unselects the given primitive (given by its pointer), i.e., it resets (sets to null) the selection flag of the primitive. It is assumed that the given pointer is really a valid pointer to an existing primitive.
|
|
This function unselects all the primitives in the current list of primitives, i.e., it resets (sets to null) the selection flag of all the primitives.
Definition at line 555 of file prm.c. Referenced by prjSelectPrm(). |
|
This function writes the geometry attribute data of a given primitive (given by its pointer) to a file (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing primitive.
Definition at line 428 of file prm.c. References circWrite(), _prm::geom, PRM_CIRC, PRM_QUAD, quadWrite(), and _prm::type. Referenced by prmioWriteList(). |