#include <stdio.h>
Include dependency graph for quad.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Quadrilateral primitive module | |
For specification see class notes of course CIV-2801 "Fundamentos de Computacao Grafica Aplicada", period 2005.2. Revisions:
| |
typedef _quad | Quad |
Primitive structure type definition. | |
Quad * | quadCreate (void) |
This function creates a new quadrilateral primitive. | |
void | quadDelete (Quad *quad) |
This function releases memory that is used by a quadrilateral primitive. | |
void | quadRead (Quad *quad, FILE *fd) |
This function reads geometry data of a given quadrilateral primitive (given by its pointer) from a file (given by its pointer) and loads the data into the primitive attributes. | |
void | quadWrite (Quad *quad, FILE *fd) |
This function writes the geometry attribute data of a given quadrilateral primitive (given by its pointer) to a file (given by its pointer). | |
int | quadGetNPts (Quad *quad) |
This function returns (as its value) the number of vertices of the given quadrilateral primitive (given by its pointer). | |
void | quadSetCoords (Quad *quad, int id, double x, double y) |
This function replaces the x and y coordinates of a vertex of the given quadrilateral primitive (given by its pointer) by the given pair of coordinates. | |
void | quadGetCoords (Quad *quad, int id, double *x, double *y) |
This function returns the x and y coordinates of a vertex of the given quadrilateral primitive (given by its pointer). | |
void | quadSet1stPt (Quad *quad, double x, double y) |
This function is used during interactive construction of a quadrilateral primitive. | |
void | quadSet2ndPt (Quad *quad, double x, double y) |
This function is used during interactive construction of a quadrilateral primitive. | |
int | quadPickArea (Quad *quad, double x, double y) |
This function checks whether a given point is inside a given quadrilateral primitive (given by its pointer). | |
int | quadPickVertex (Quad *quad, double x, double y, double tol, int *id) |
This function selects a vertex of a given quadrilateral primitive based on the given point position. | |
int | quadPickSide (Quad *quad, double x, double y, double tol, int *id) |
This function selects a side of a given quadrilateral primitive based on the given point position. | |
void | quadTranslate (Quad *quad, double dx, double dy) |
This function translates the given quadrilateral primitive (given by its pointer). | |
void | quadTranslateVertex (Quad *quad, int id, double dx, double dy) |
This function translates a vertex of a given quadrilateral primitive (given by its pointer) using the given translation factors. | |
void | quadTranslateSide (Quad *quad, int id, double dx, double dy) |
This function translates the two vertices of a side of a given quadrilateral primitive (given by its pointer) using the given translation factors. | |
void | quadGetBox (Quad *quad, double *xmin, double *xmax, double *ymin, double *ymax) |
This function returns the limiting rectangle that involves the given quadrilateral primitive (given by its pointer). | |
void | quadDisplayBoundary (Quad *quad) |
This function displays the boundary of the given quadrilateral primitive (given by its pointer). | |
void | quadDisplayInterior (Quad *quad) |
This function displays the interior of the given quadrilateral primitive (given by its pointer). | |
void | quadDisplaySolid (Quad *quad, double height) |
Function to display a solid version of a quadrilateral primitive. | |
void | quadHighltSolid (Quad *quad, double height) |
Function to highlight a solid version of a quadrilateral primitive. | |
void | quadDisplayZbuffer (Quad *quad, double height, long int color) |
Function to send a solid version of a quadrilateral primitive to the zbuffer module to be projected and displayed. |
|
Primitive structure type definition.
|
|
This function creates a new quadrilateral primitive. It only allocates memory for a quadrilateral primitive, sets its default vertex coordinates and returns a pointer to the allocated quadrilateral primitive. The quadrilateral vertices are ordered in the following order: (id = 3) (id = 1) +--------+ | | | | | | | | +--------+ (id = 0) (id = 2) Default vertex coordinates: id = 0 ==> (x0 = 0.0, y0 = 0.0) id = 1 ==> (x1 = 1.0, y1 = 1.0) id = 2 ==> (x2 = 1.0, y2 = 0.0) id = 3 ==> (x3 = 0.0, y3 = 1.0)
Definition at line 309 of file quad.c. References _quad::p, _Coord::x, and _Coord::y. Referenced by prmCreateBack(), and prmCreateFront(). |
|
This function releases memory that is used by a quadrilateral primitive. It is assumed that the given pointer is really a valid pointer to an existing quadrilateral primitive.
Definition at line 335 of file quad.c. Referenced by prmDelete(). |
|
This function displays the boundary of the given quadrilateral primitive (given by its pointer). Straight lines are used used to display the primitive edges and marks are used to display its vertices. The Canvas Draw (CD) graphics library is used to display the boundary of the primitive. Please refer to CD documentation for additional information. 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 quadrilateral primitive.
Definition at line 492 of file quad.c. Referenced by prmDisplayBoundary(). |
|
This function displays the interior of the given quadrilateral primitive (given by its pointer). The interior area is filled with the currently specified background color. The Canvas Draw (CD) graphics library is used to display the boundary of the primitive. Please refer to CD documentation for additional information. 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 quadrilateral primitive.
Definition at line 499 of file quad.c. Referenced by prmDisplayInterior(). |
|
Function to display a solid version of a quadrilateral 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 quadrilateral shape of the solid prism faces with the current color. It uses OpenGL display functions.
Definition at line 506 of file quad.c. Referenced by prmDisplaySolid(). |
|
Function to send a solid version of a quadrilateral 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 523 of file quad.c. References dspZbfBeginPoly(), dspZbfEndPoly(), dspZbfVertex(), _quad::p, quadBuildSolidPrm(), quadFaceNormal(), pnt3d::x, _Coord::x, pnt3d::y, _Coord::y, and pnt3d::z. Referenced by prmDisplayZbuffer(). |
|
This function returns the limiting rectangle that involves the given quadrilateral 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 quadrilateral primitive.
Definition at line 484 of file quad.c. Referenced by prmGetBox(). |
|
This function returns the x and y coordinates of a vertex of the given quadrilateral primitive (given by its pointer). The vertex is indicated by an index between 0 and 3. 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 quadrilateral primitive. The quadrilateral vertices are ordered in counter-clockwise order: (id = 3) (id = 2) +-------------------+ | | | | | | | | +-------------------+ (id = 0) (id = 1)
Definition at line 370 of file quad.c. Referenced by prmGetCoords(), and quadPickArea(). |
|
This function returns (as its value) the number of vertices of the given quadrilateral primitive (given by its pointer). It is assumed that the given pointer is really a valid pointer to an existing quadrilateral primitive.
Definition at line 356 of file quad.c. Referenced by prmGetNPts(). |
|
Function to highlight a solid version of a quadrilateral 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 515 of file quad.c. Referenced by prmHighltSolid(). |
|
This function checks whether a given point is inside a given quadrilateral primitive (given by its pointer). The adopted algorithm is the so called semi-infinite ray algorithm that starts at the given point and goes in the horizontal direction to positive infinity. If the number of intersections of the ray with the polygon boundary is odd, the point is inside the polygon. If the number of intersections is even, the point is outside. Please refer to class notes of course CIV 2801 - Fundamentos de Computacao Grafica Aplicada - PUC-Rio. It is assumed that the given pointer is really a valid pointer to an existing quadrilateral primitive.
Definition at line 391 of file quad.c. References quadGetCoords(). Referenced by prmPickArea(). |
|
This function selects a side of a given quadrilateral primitive based on the given point position. The target side is indicated by an index, which has a value between 0 and 3. The quadrilateral sides are ordered in counter-clockwise order: (id = 2) +-------------------+ | | (id = 3) | | (id = 1) | | | | +-------------------+ (id = 0)
Definition at line 453 of file quad.c. Referenced by prmPickSide(). |
|
This function selects a vertex of a given quadrilateral primitive based on the given point position. In case the given point is close to a vertex of the primitive, the index of the found vertex is returned. The index is a value between 0 and 3. The quadrilateral vertices are ordered in counter-clockwise order: (id = 3) (id = 2) +-------------------+ | | | | | | | | +-------------------+ (id = 0) (id = 1)
Definition at line 443 of file quad.c. Referenced by prmPickVertex(). |
|
This function reads geometry data of a given quadrilateral 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 quadrilateral primitive.
Definition at line 342 of file quad.c. Referenced by prmRead(). |
|
This function is used during interactive construction of a quadrilateral primitive. It sets the x and y coordinates of the first construction point of the given quadrilateral primitive (given by its pointer) by the given pair of coordinates. The first construction point corresponds to the first corner vertex of the quadrilateral primitive (with id = 0). It is assumed that the given pointer is really a valid pointer to an existing quadrilateral primitive. The quadrilateral vertices are ordered in counter-clockwise order: (id = 3) (id = 2) +-------------------+ | | | | | | | | +-------------------+ (id = 0) (id = 1) The coordinates of vertices with id = 1 and id = 3 are set in such a way the quadrilateral will have horizontal and vertical sides. That is, the following is set: x0 = x3 = x and y0 = y1 = y.
Definition at line 377 of file quad.c. Referenced by prmSet1stPt(). |
|
This function is used during interactive construction of a quadrilateral primitive. It sets the x and y coordinates of the second construction point of the given quadrilateral primitive (given by its pointer) by the given pair of coordinates. The second construction point corresponds to the third corner vertex of the quadrilateral primitive (with id = 2). It is assumed that the given pointer is really a valid pointer to an existing quadrilateral primitive. The quadrilateral vertices are ordered in counter-clockwise order: (id = 3) (id = 2) +-------------------+ | | | | | | | | +-------------------+ (id = 0) (id = 1) The coordinates of vertices with id = 1 and id = 3 are set in such a way the quadrilateral will have horizontal and vertical sides. That is, the following is set: x2 = x1 = x and y2 = y3 = y.
Definition at line 384 of file quad.c. Referenced by prmSet2ndPt(). |
|
This function replaces the x and y coordinates of a vertex of the given quadrilateral primitive (given by its pointer) by the given pair of coordinates. The vertex is indicated by an index between 0 and 3. 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 quadrilateral primitive. The quadrilateral vertices are ordered in counter-clockwise order: (id = 3) (id = 2) +-------------------+ | | | | | | | | +-------------------+ (id = 0) (id = 1)
Definition at line 363 of file quad.c. Referenced by prmSetCoords(). |
|
This function translates the given quadrilateral 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 quadrilateral primitive.
Definition at line 463 of file quad.c. Referenced by prmTranslate(). |
|
This function translates the two vertices of a side of a given quadrilateral 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 3. 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 quadrilateral primitive. The quadrilateral sides are ordered in counter-clockwise order: (id = 2) +-------------------+ | | (id = 3) | | (id = 1) | | | | +-------------------+ (id = 0)
Definition at line 477 of file quad.c. Referenced by prmTranslateSide(). |
|
This function translates a vertex of a given quadrilateral primitive (given by its pointer) using the given translation factors. The target vertex is indicated by an index between 0 and 3. 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 quadrilateral primitive. The quadrilateral vertices are ordered in counter-clockwise order: (id = 3) (id = 2) +-------------------+ | | | | | | | | +-------------------+ (id = 0) (id = 1)
Definition at line 470 of file quad.c. Referenced by prmTranslateVertex(). |
|
This function writes the geometry attribute data of a given quadrilateral 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 quadrilateral primitive.
Definition at line 349 of file quad.c. Referenced by prmWrite(). |