Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

Quadmeshes
[Geometrical Objects in BICPL]


Data Structures

struct  quadmesh_struct
 In-memory structure for a quadrilateral mesh. More...


Functions

public void initialize_quadmesh (quadmesh_struct *quadmesh, Colour col, Surfprop *spr, int m, int n)
 Initialize a quadmesh to given size.

public void delete_quadmesh (quadmesh_struct *quadmesh)
 Delete quadmesh structure.

public void set_quadmesh_point (quadmesh_struct *quadmesh, int i, int j, Point *point, Vector *normal)
 Set one point and normal in quadmesh.

public BOOLEAN get_quadmesh_point (const quadmesh_struct *quadmesh, int i, int j, Point *point)
 Get coordinates of one point in quadmesh.

public void get_quadmesh_n_objects (const quadmesh_struct *quadmesh, int *mp, int *np)
public void compute_quadmesh_normals (quadmesh_struct *quadmesh)
public void get_quadmesh_patch_indices (const quadmesh_struct *quadmesh, int i, int j, int indices[])
 Compute the indices of points for patch.

public void get_quadmesh_patch (const quadmesh_struct *quadmesh, int i, int j, Point points[])
 Get coordinates of patch corners.

public void reverse_quadmesh_vertices (quadmesh_struct *quadmesh)
 Flip columns around centre.


Detailed Description

A quadmesh consists of m rows and n columns of points. Neighbouring points along a row and along a column are joined with an edge, as on a piece of graph paper. The first and last points of each row (or of each column) may optionally have an edge between them; picture rolling the graph paper into a cylinder. If both the rows and the columns are closed in this manner, you end up with a toroidal topology.

Point locations in a quadmesh are addressed using integer pairs (i,j) with 0 <= i < m, and 0 <= j < n.

Each quadrilateral of the mesh, or patch, is defined by the four points at its corners. The set of points comprising the interior of the patch is undefined. Four points are not planar, in general.

Patches are addressed using integer pairs (i,j) with 0 <= i < mp, and 0 <= j < np. Use get_quadmesh_n_objects() to compute mp and np.

Routines dealing with quadmeshes generally take a pointer to a quadmesh_struct as their first argument.


Function Documentation

public void compute_quadmesh_normals quadmesh_struct quadmesh  ) 
 

Compute all normal vectors in quadmesh.

Use find_polygon_normal() to set normal from location of the point's 4-neighbours.

Bug:
Does not take into account the closed flags when computing the 4-neighbourhood.

Definition at line 299 of file quadmesh.c.

References FALSE, find_polygon_normal(), get_quadmesh_point(), quadmesh_struct::m, quadmesh_struct::n, quadmesh_struct::normals, and quadmesh_struct::points.

Referenced by create_lsq_hypersurface_float().

public void delete_quadmesh quadmesh_struct quadmesh  ) 
 

Delete quadmesh structure.

Definition at line 130 of file quadmesh.c.

References quadmesh_struct::bintree, quadmesh_struct::colour_flag, quadmesh_struct::colours, delete_bintree_if_any(), free_colours(), quadmesh_struct::m, quadmesh_struct::n, quadmesh_struct::normals, and quadmesh_struct::points.

Referenced by delete_quadmesh_object().

public void get_quadmesh_n_objects const quadmesh_struct quadmesh,
int *  mp,
int *  np
 

Compute the number of patches in the quadmesh.

If the quadmesh has m rows and n columns of points, there will be np rows and np columns of patches in the quadmesh. The value of mp will be m or m-1, depending upon whether the mesh is open or closed in the row direction.

The mesh has mp*np patches, in total.

Parameters:
mp location in which to store mp
np location in which to store np

Definition at line 262 of file quadmesh.c.

References quadmesh_struct::m, quadmesh_struct::m_closed, quadmesh_struct::n, and quadmesh_struct::n_closed.

Referenced by create_quadmesh_bintree(), find_closest_point_on_object(), get_point_quadmesh_distance_sq(), intersect_planes_with_quadmesh(), intersect_ray_quadmesh_patch(), intersect_ray_with_object(), and scan_quadmesh_to_voxels().

public void get_quadmesh_patch const quadmesh_struct quadmesh,
int  i,
int  j,
Point  points[]
 

Get coordinates of patch corners.

A patch is addressed by a pair of integers (i,j) for 0 <= i < mp, and 0 <= j < np, where mp and np are the numbers of patches in each row and column, respectively. Use get_quadmesh_n_objects() to compute mp and np.

Parameters:
i row number of the patch
j column number of the patch location in which to write coordinates for the 4 points

Definition at line 422 of file quadmesh.c.

References get_quadmesh_patch_indices(), and quadmesh_struct::points.

Referenced by create_quadmesh_bintree(), get_point_quadmesh_distance_sq(), intersect_ray_quadmesh_patch(), and scan_quadmesh_to_voxels().

public void get_quadmesh_patch_indices const quadmesh_struct quadmesh,
int  i,
int  j,
int  indices[]
 

Compute the indices of points for patch.

A patch is addressed by a pair of integers (i,j) for 0 <= i < mp, and 0 <= j < np, where mp and np are the numbers of patches in each row and column, respectively. Use get_quadmesh_n_objects() to compute mp and np.

Parameters:
i row number of the patch
j column number of the patch location in which to write the 4 point indices
The four indices returned are in cyclic order around the patch. The point indices are returned in the following order: (i,j), (i+1,j), (i+1,j+1), (i,j+1).

Definition at line 384 of file quadmesh.c.

References quadmesh_struct::m, and quadmesh_struct::n.

Referenced by get_quadmesh_patch().

public BOOLEAN get_quadmesh_point const quadmesh_struct quadmesh,
int  i,
int  j,
Point *  point
 

Get coordinates of one point in quadmesh.

Parameters:
i row number
j column number
point to which coordinates are copied
Returns:
TRUE if (i,j) is a valid location
Note:
The coordinates are written into point only if (i,j) is a valid location.

Definition at line 220 of file quadmesh.c.

References FALSE, quadmesh_struct::m, quadmesh_struct::n, quadmesh_struct::points, and TRUE.

Referenced by compute_quadmesh_normals().

public void initialize_quadmesh quadmesh_struct quadmesh,
Colour  col,
Surfprop *  spr,
int  m,
int  n
 

Initialize a quadmesh to given size.

The resulting quadmesh uses a single colour, and is open along the row and column directions. Space is allocated for points and normals, but not initialized.

Parameters:
quadmesh pointer to structure to fill in
col colour for mesh
spr surface properties of mesh; set to NULL for default properties
m number of rows in mesh
n number of columns in mesh

Definition at line 84 of file quadmesh.c.

References quadmesh_struct::bintree, quadmesh_struct::colour_flag, quadmesh_struct::colours, FALSE, get_default_surfprop(), quadmesh_struct::m, quadmesh_struct::m_closed, quadmesh_struct::n, quadmesh_struct::n_closed, quadmesh_struct::normals, ONE_COLOUR, quadmesh_struct::points, and quadmesh_struct::surfprop.

Referenced by create_lsq_hypersurface_float(), create_slice_quadmesh(), create_tube(), and io_quadmesh().

public void reverse_quadmesh_vertices quadmesh_struct quadmesh  ) 
 

Flip columns around centre.

Flip the quadmesh about its middle column, swapping point and normal information in column 0 with column n-1, etc.

Definition at line 442 of file quadmesh.c.

References quadmesh_struct::m, quadmesh_struct::n, quadmesh_struct::normals, and quadmesh_struct::points.

public void set_quadmesh_point quadmesh_struct quadmesh,
int  i,
int  j,
Point *  point,
Vector *  normal
 

Set one point and normal in quadmesh.

Parameters:
i row number
j column number
point the point assigned to location (i,j)
normal the normal assigned to location (i,j) use NULL to avoid setting the normal
Note:
The normal is ignored if the quadmesh does not already have normals for each point.

Definition at line 176 of file quadmesh.c.

References quadmesh_struct::n, quadmesh_struct::normals, and quadmesh_struct::points.

Referenced by create_lsq_hypersurface_float(), and create_slice_quadmesh().


Generated on Wed Jul 28 09:11:25 2004 for BICPL by doxygen 1.3.7