Table of Contents

NAME

QccRegularMeshInitialize, QccRegularMeshAlloc, QccRegularMeshFree, QccRegularMeshGenerate, QccRegularMeshNumTriangles, QccRegularMeshToTriangles - miscellaneous 2D regular-mesh routines

SYNOPSIS

#include "libQccPack.h"

void QccRegularMeshInitialize(QccRegularMesh *mesh);

int QccRegularMeshAlloc(QccRegularMesh *mesh);

void QccRegularMeshFree(QccRegularMesh *mesh);

int QccRegularMeshGenerate(QccRegularMesh *mesh, const QccPoint *range_upper, const QccPoint *range_lower);

int QccRegularMeshNumTriangles(const QccRegularMesh *mesh);

int QccRegularMeshToTriangles(const QccRegularMesh *mesh, QccTriangle *triangles);

DESCRIPTION

QccPack provides the QccRegularMesh data structure to represent a regular mesh in the 2D plane. In two dimensions, a regular mesh is simply a rectangular array of points.

DATA STRUCTURE

QccRegularMesh data structure is defined as:

typedef struct
{
int num_rows;
int num_cols;
QccPoint **vertices;
} QccRegularMesh;

The fields of QccRegularMesh are as follows:

num_rows
The number of rows of points in the regular mesh.
num_cols
The number of columns of points in the regular mesh.
vertices
The rectangular array of mesh vertices.

ROUTINES

QccRegularMeshInitialize() should be called before any use of a QccRegularMesh structure. QccRegularMeshInitialize() initializes the fields of mesh to the following values:

num_rows: 0
num_cols: 0
vertices: NULL

QccRegularMeshAlloc() allocates mesh. The num_rows and num_cols fields of mesh must be defined prior to calling QccRegularMeshAlloc().

QccRegularMeshFree() frees the vertices array previously allocated by QccRegularMeshAlloc().

QccRegularMeshGenerate() fills in the vertices array of mesh with equally spaced points in the rectangular box specified by range_upper and range_lower. range_upper gives the upper-left corner of the box, while range_lower gives the lower-right corner of the box. The points have a horizontal spacing of delta_x and a vertical spacing of delta_y, where delta_x = (range_upper->x - range_lower->x) / (mesh->num_cols - 1) and delta_y = (range_upper->y - range_lower->y) / (mesh->num_rows - 1). The mesh must be allocated via a call to QccRegularMeshAllocate() prior to calling QccRegularMeshGenerate(), and both the num_rows and num_cols fields of mesh must be greater than 1.

QccRegularMeshNumTriangles() calculates the number of triangles that will be produced from mesh by QccRegularMeshToTriangles().

QccRegularMeshToTriangles() creates a list of triangles from mesh by dividing each rectangle between four adjacent vertices in mesh along the diagonal to produce two triangles. The resulting triangles are returned in the array triangles which must be allocated prior to calling QccRegularMeshToTriangles().

SEE ALSO

QccPoint(3) , QccTriangle(3) , QccPack(3)

Y. Altunbasak, A. M. Tekalp, and G. Bozdagi, "Two-Dimensional Object-based Coding Using a Content-based Mesh and Affine Motion Parameterization," in Proceedings of the International Conference on Image Processing, Washington, DC, October 1995, vol. 2, pp. 394-397.

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads