Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

prm.h File Reference

#include <stdio.h>

Include dependency graph for prm.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct  _Coord
 Primitive vertex coordinate structure. More...


Primitive data structure module

Date:
10-Sep-2005
Author:
Luiz F. Martha
Version:
1.0
This header file contains public definitions for the primitive data structure of the current project, and prototypes of public functions.

For specification see class notes of course CIV-2801 "Fundamentos de Computacao Grafica Aplicada", period 2005.2.

Revisions:

  • On 08-nov-05 by Luiz F. Martha Added description and prototypes of functions prmDisplaySolid, prmHighltSolid, and prmDisplayZbuffer.


#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...

PrmprmCreateFront (PrmType type)
 This function creates a new primitive, puts it at the beginning of the list of primitives.

PrmprmCreateBack (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.

PrmprmFirst (void)
 This function returns a pointer to the first primitive of the current list.

PrmprmLast (void)
 This function returns a pointer to the last primitive of the current list.

PrmprmNext (Prm *prm)
 This function returns a pointer to the next primitive in relation to the given primitive (given by its pointer).

PrmprmPrevious (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.


Define Documentation

#define ABS      (((x) < 0.0)? -(x): (x))
 

Definition at line 46 of file prm.h.

Referenced by dspShadeColor().

#define COORD_TOL   0.001
 

coordinate tolerance value

Definition at line 50 of file prm.h.

#define PRM_BLACK   0x000000L
 

Definition at line 84 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_BLUE   0x0000FFL
 

Definition at line 89 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_CYAN   0x00FFFFL
 

Definition at line 95 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_BLUE   0x000080L
 

Definition at line 90 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_CYAN   0x008080L
 

Definition at line 96 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_GRAY   0x808080L
 

Definition at line 83 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_GREEN   0x008000L
 

Definition at line 88 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_MAGENTA   0x800080L
 

Definition at line 94 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_RED   0x800000L
 

Definition at line 86 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_DARK_YELLOW   0x808000L
 

Definition at line 92 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_GRAY   0xC0C0C0L
 

Definition at line 82 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_GREEN   0x00FF00L
 

Definition at line 87 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_MAGENTA   0xFF00FFL
 

Definition at line 93 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_RED   0xFF0000L
 

Definition at line 85 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_WHITE   0xFFFFFFL
 

Definition at line 81 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().

#define PRM_YELLOW   0xFFFF00L
 

Definition at line 91 of file prm.h.

Referenced by prmioGetColorCode(), and prmioGetColorLabel().


Typedef Documentation

typedef struct _Coord Coord
 

Primitive vertex coordinate structure.

typedef struct _prm Prm
 

Primitive structure type definition.

Definition at line 76 of file prm.h.

typedef enum _prmtype PrmType
 

Primitive types.

Referenced by prmCreateBack(), prmCreateFront(), and prmioInterpret().


Enumeration Type Documentation

enum _prmtype
 

Primitive types.

Enumeration values:
PRM_UNDEF  Undefined primitive.
PRM_QUAD  Quadrilateral primitive.
PRM_CIRC  Circle primitive.
NumPrmTypes  Total number of primitives.

Definition at line 54 of file prm.h.


Function Documentation

int prmCheckSelected Prm   prm
 

This function returns the selection status (false = 0; true = 1) of the given primitive (given by its pointer).

Parameters:
prm  - pointer to target primitive (in)
Returns:
Selection flag (false = 0; true = 1) of the given primitive.

Definition at line 562 of file prm.c.

Referenced by dspModel().

Prm* prmCreateBack PrmType    type
 

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.

Parameters:
type  - type of primitive to create (in)
Returns:
The function returns a pointer to the created primitive, or a null pointer if the primitive could not be created.

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().

Prm* prmCreateFront PrmType    type
 

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.

Parameters:
type  - type of primitive to create (in)
Returns:
The function returns a pointer to the created primitive, or a null pointer if the primitive could not be created.

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().

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.

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.

Parameters:
prm  - pointer to primitive to delete (in)

Definition at line 294 of file prm.c.

References circDelete(), _prm::geom, PRM_CIRC, PRM_QUAD, prmRemoveFromList(), quadDelete(), and _prm::type.

Referenced by prmDeleteSelected().

void prmDeleteList void   
 

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().

void prmDeleteSelected void   
 

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().

void prmDisplayBoundary Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 742 of file prm.c.

References circDisplayBoundary(), _prm::geom, PRM_CIRC, PRM_QUAD, quadDisplayBoundary(), and _prm::type.

void prmDisplayInterior Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 759 of file prm.c.

References circDisplayInterior(), _prm::geom, PRM_CIRC, PRM_QUAD, quadDisplayInterior(), and _prm::type.

void prmDisplaySolid Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 776 of file prm.c.

References circDisplaySolid(), _prm::geom, PRM_CIRC, PRM_QUAD, prmGetHeight(), quadDisplaySolid(), and _prm::type.

void prmDisplayZbuffer Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 810 of file prm.c.

References circDisplayZbuffer(), _prm::geom, PRM_CIRC, PRM_QUAD, prmGetColor(), prmGetHeight(), quadDisplayZbuffer(), and _prm::type.

Prm* prmFirst void   
 

This function returns a pointer to the first primitive of the current list.

Returns:
Pointer to first primitive. If the list is empty, it returns a null pointer.

Definition at line 334 of file prm.c.

Referenced by drvRedisplay(), dspModel(), prjBuildDisplayList(), prjGetHeightFac(), prjPckPrm(), prjSetHeightFac(), prjZbufferSnapShot(), and prmioWriteList().

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).

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.

Parameters:
prm  - pointer to target primitive (in)
xmin, xmax  - limiting x coordinates of primitive (out)
ymin, ymax  - limiting y coordinates of primitive (out)

Definition at line 714 of file prm.c.

References circGetBox(), _prm::geom, PRM_CIRC, PRM_QUAD, quadGetBox(), and _prm::type.

long int prmGetColor Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)
Returns:
Coded RGB color of given primitive.

Definition at line 577 of file prm.c.

References _prm::color.

Referenced by dspPrm(), prmDisplayZbuffer(), and prmioWriteList().

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).

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.

Parameters:
prm  - pointer to target primitive (in)
id  - index of target vertex in primitive (in)
x  - vertex x coordinate (out)
y  - vertex y coordinate (out)

Definition at line 483 of file prm.c.

References circGetCoords(), _prm::geom, PRM_CIRC, PRM_QUAD, quadGetCoords(), and _prm::type.

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.

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.

Parameters:
xmin, xmax  - limiting x coordinates of all primitives (out)
ymin, ymax  - limiting y coordinates of all primitives (out)
Returns:
If the list of primitives is empty, a false (0) status is returned. Otherwise, a true (1) status is returned.

Definition at line 732 of file prm.c.

Referenced by prjOpenModel().

double prmGetHeight Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)
Returns:
Height of given primitive (3D only).

Definition at line 591 of file prm.c.

References _prm::height.

Referenced by prjGetHeightFac(), prmDisplaySolid(), prmDisplayZbuffer(), prmHighltSolid(), and prmioWriteList().

int prmGetNPts Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)
Returns:
The number of vertices of the given primitive.

Definition at line 445 of file prm.c.

References circGetNPts(), _prm::geom, PRM_CIRC, PRM_QUAD, quadGetNPts(), and _prm::type.

int prmGetType Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)
Returns:
The type the given primitive (1 indicates a quadrilateral primitive and 2 indicates a circle primitive).

Definition at line 404 of file prm.c.

References _prm::type.

Referenced by prmioWriteList().

void prmHighltSolid Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 793 of file prm.c.

References circHighltSolid(), _prm::geom, PRM_CIRC, PRM_QUAD, prmGetHeight(), quadHighltSolid(), and _prm::type.

Prm* prmLast void   
 

This function returns a pointer to the last primitive of the current list.

Returns:
Pointer to last primitive. If the list is empty, it returns a null pointer.

Definition at line 341 of file prm.c.

void prmMoveBack Prm   prm
 

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.

Parameters:
prm  - pointer to primitive to move (in)

Definition at line 383 of file prm.c.

References _prm::prev, prmInsertBack(), and prmRemoveFromList().

Referenced by prmioInterpret().

void prmMoveFront Prm   prm
 

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.

Parameters:
prm  - pointer to primitive to move (in)

Definition at line 362 of file prm.c.

References prmInsertFront(), and prmRemoveFromList().

Referenced by prmioInterpret().

Prm* prmNext Prm   prm
 

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.

Parameters:
prm  - pointer to a primitive (in)
Returns:
Pointer to next primitive. If the given primitive is the last in the list, a null pointer is returned.

Definition at line 348 of file prm.c.

Referenced by dspModel(), prjPckPrm(), and prmioWriteList().

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).

It is assumed that the given pointer is really a valid pointer to an existing primitive.

Parameters:
prm  - pointer to target primitive (in)
x  - x coordinate of given point (in)
y  - y coordinate of given point (in)
Returns:
In case the given point is inside the given primitive, a true (1) status is returned. Otherwise, a false (0) status is returned.

Definition at line 598 of file prm.c.

References circPickArea(), _prm::geom, PRM_CIRC, PRM_QUAD, quadPickArea(), and _prm::type.

Referenced by prjPckPrm().

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.

Parameters:
prm  - pointer to target primitive (in)
x  - x coordinate of given point (in)
y  - y coordinate of given point (in)
tol  - tolerance value to check proximity (in)
id  - returned primitive side index (out)
Returns:
In case the given point is close to a side of the target primitive, the function returns a true (1) status and the index of the selected side is returned as a parameter. In case no side if found close to the given point, the function returns a false (0) status.

Definition at line 641 of file prm.c.

References circPickSide(), _prm::geom, PRM_CIRC, PRM_QUAD, quadPickSide(), and _prm::type.

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.

Parameters:
prm  - pointer to target primitive (in)
x  - x coordinate of given point (in)
y  - y coordinate of given point (in)
tol  - tolerance value to check proximity (in)
id  - returned primitive vertex index (out)
Returns:
In case the given point is close to a vertex on the boundary of the primitive, the function returns a true (1) status and returns the index of the found vertex. Otherwise, the function returns a false (0) status.

Definition at line 619 of file prm.c.

References circPickVertex(), _prm::geom, PRM_CIRC, PRM_QUAD, quadPickVertex(), and _prm::type.

Prm* prmPrevious Prm   prm
 

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.

Parameters:
prm  - pointer to a primitive (in)
Returns:
Pointer to previous primitive. If the given primitive is the first in the list, a null pointer is returned.

Definition at line 355 of file prm.c.

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.

It is assumed that the given pointer is really a valid pointer to an existing primitive.

Parameters:
prm  - pointer to target primitive (in)
fd  - ponter to file descriptor (in)

Definition at line 411 of file prm.c.

References circRead(), _prm::geom, PRM_CIRC, PRM_QUAD, quadRead(), and _prm::type.

Referenced by prmioInterpret().

void prmSelect Prm   prm
 

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.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 541 of file prm.c.

Referenced by prjSelectPrm().

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.

Definition at line 534 of file prm.c.

void prmSet1stPt Prm   prm,
double    x,
double    y
 

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.

Parameters:
prm  - pointer to target primitive (in)
x  - first point x coordinate (in)
y  - first point y coordinate (in)

Definition at line 500 of file prm.c.

References circSet1stPt(), _prm::geom, PRM_CIRC, PRM_QUAD, quadSet1stPt(), and _prm::type.

void prmSet2ndPt Prm   prm,
double    x,
double    y
 

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.

Parameters:
prm  - pointer to target primitive (in)
x  - second point x coordinate (in)
y  - second point y coordinate (in)

Definition at line 517 of file prm.c.

References circSet2ndPt(), _prm::geom, PRM_CIRC, PRM_QUAD, quadSet2ndPt(), and _prm::type.

void prmSetColor Prm   prm,
long int    color
 

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.

Parameters:
prm  - pointer to target primitive (in)
color  - coded RGB color (in)

Definition at line 570 of file prm.c.

References _prm::color.

Referenced by prmioInterpret().

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.

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.

Parameters:
prm  - pointer to target primitive (in)
id  - index of target vertex in primitive (in)
x  - new vertex x coordinate (in)
y  - new vertex y coordinate (in)

Definition at line 466 of file prm.c.

References circSetCoords(), _prm::geom, PRM_CIRC, PRM_QUAD, quadSetCoords(), and _prm::type.

void prmSetHeight Prm   prm,
double    height
 

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.

Parameters:
prm  - pointer to target primitive (in)
height  - height of primitive (3D only) (in)

Definition at line 584 of file prm.c.

References _prm::height.

Referenced by prjSetHeightFac(), and prmioInterpret().

void prmTranslate Prm   prm,
double    dx,
double    dy
 

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.

Parameters:
prm  - pointer to target primitive (in)
dx, dy  - translation factors in x & y directions (in)

Definition at line 663 of file prm.c.

References circTranslate(), _prm::geom, PRM_CIRC, PRM_QUAD, quadTranslate(), and _prm::type.

Referenced by prmioInterpret().

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.

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.

Parameters:
prm  - pointer to target primitive (in)
id  - index of side to translate (0..npts-1) (in)
dx, dy  - translation factors in x & y directions (in)

Definition at line 697 of file prm.c.

References circTranslateSide(), _prm::geom, PRM_CIRC, PRM_QUAD, quadTranslateSide(), and _prm::type.

Referenced by prmioInterpret().

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.

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.

Parameters:
prm  - pointer to target primitive (in)
id  - index of vertex to translate (0..npts-1) (in)
dx, dy  - translation factors in x & y directions (in)

Definition at line 680 of file prm.c.

References circTranslateVertex(), _prm::geom, PRM_CIRC, PRM_QUAD, quadTranslateVertex(), and _prm::type.

Referenced by prmioInterpret().

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.

It is assumed that the given pointer is really a valid pointer to an existing primitive.

Parameters:
prm  - pointer to target primitive (in)

Definition at line 548 of file prm.c.

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.

Definition at line 555 of file prm.c.

Referenced by prjSelectPrm().

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).

It is assumed that the given pointer is really a valid pointer to an existing primitive.

Parameters:
prm  - pointer to target primitive (in)
fd  - ponter to file descriptor (in)

Definition at line 428 of file prm.c.

References circWrite(), _prm::geom, PRM_CIRC, PRM_QUAD, quadWrite(), and _prm::type.

Referenced by prmioWriteList().


Generated on Tue Nov 8 10:58:06 2005 for Trab3 by doxygen1.2.18