next up previous contents index
Next: Fe2d Up: Triang2d Previous: I/O Methods on Triang2d

Other Methods on Triang2d

 

   

GRAPE(tr2d, "check-send")()
TRIANG2D *tr2d ;

Checks consistency of a triangulation, calls "check-phase" with phase = 6.

   

GRAPE(tr2d, "check-phase")(phase)
TRIANG2D *tr2d;
int phase;

This method invokes the checking of specific data in the geometry. There are the following possibilities at hand (a bigger number includes all the lower ones):

   tex2html_wrap44148    tex2html_wrap44150
TRIANG2D * triang, * tr1, * tr2
double factor, fac1, fac2
Linear interpolation of the two Triang2d instances tr1 and tr2 with factor:
triang = (1 - factor) * tr1 + factor * tr2
or with factors fac1 and fac2:
triang = fac1 * tr1 + fac2 * tr2.
If necessary new vertex lists are allocated for triang.

The two Triang2d instances are interpolated pointwise, therefore they must have the same number_of_points and the same connectivity vertex and neighbour.

   tex2html_wrap44152    tex2html_wrap44154
TRIANG2D * triang
"center-send" moves triang to make the minimum and maximum x/y/z-coordinates identical (apart from the sign), i.e. it centers triang at zero. "normalize-send" additionally scales triang so that it fits into the [-1, +1] cube.

     

GRAPE(triang2d, "reflect")(trfmat, orient)
TRIANG2D *triang2d;
MATRIX44 trfmat;
int orient;
Create a new Triang2d instance from triang2d with triang2d->number_of_points points which are transformed with trfmat. If trfmat is NULL the points are copied without transformation. The orientation flag orient is not needed but supplied so that all reflection methods have identical parameter lists. The reflected Triang2d instance is returned.

     

GRAPE(triang2d, "show-send")()
TRIANG2D *triang2d;
Print the data of a Triang2d instance to stdout.

     

GRAPE(triang2d, "c-show")()
TRIANG2D *triang2d;
Write the data of the triang2d instance in C source format to the standard output.

 

   
GRAPE(triang2d, "get-info")(list)
TRIANG2D *triang2d;
LIST *list;
Create info list entries for a Triang2d instance. Entries are class, name, refcount, number of points, maximum number of points, number of triangles and maximum number of triangles.

     

GRAPE(triang2d, "reset")()
TRIANG2D *triang2d;
Reset triang2d->number_of_points and triang2d->number_of_elements to zero (only needed in ->universal mode).

     

GRAPE(triang2d, "center")()
TRIANG2D *center;
The centerpoint of all points of the whole triangulation is set to 0.0. This helps to manage the object in the interactive environment.

     

GRAPE(triang2d, "refine4-send")()
TRIANG2D *triang2d;
The triangulation is refined once by the standard subdivision into 4 triangles.

         

GRAPE(triang, "find-pick")(v, u, w, obj, dist)
GRAPE(triang, "find-pick-index")(v, index, u, w, obj, dist)
TRIANG2D *triang;
VEC3 v;
int *index;
double u, w, *dist;
TRIANG2D **obj;
Search for a point v in triang for which the distance from the straight line (u, w, .) to PVM * v (the point v transformed by the PVM matrix) is less than sqrt(*dist). If we find such a point, *obj is set to triang, v to the new point transformed by the MODEL matrix and *dist to the new distance. "find-pick-index" additionally sets *index to the index of the point.

For an explanation of the transformation matrices see 9.2.2.1.

     

GRAPE(triang, "find-pick-intersec")(v, u, w, element, bary)
TRIANG2D *triang;
VEC3 v ; /* point, which is searched */
double u, w ; /* obtained values from the */
/* method "get-pick-pos" */
int *element ; /* number of triangles, which */
/* contains the determined point */
VEC3 bary ; /* barycentric coordinates of the determined point */
This methods finds on the current plane from the current clipping method the intersection point of the ray (u, w, .) in screen coordinates where u and w are between -1 and 1. Afterwards the coordinates of the vector, the picked element and the barycentric coordinates are v, element and bary. The method returns the triangulation if an intersection could be found otherwise NULL.

     

GRAPE(Triang2d, "mask-make")(x, y, x_n, y_n, mask, inst-name)
CLASS *Triang2d;
double *x, *y;
int x_n, y_n;
int *mask;
char *inst-name;
This method generates a Triang2d instance containing the triangulation of a planar rectangular domain. This domain consists of those cells which are marked by a YES in the compressed 2D tex2html_wrap_inline44146 array Mask[x][y] == mask[(x - 1)*y_n + y - 1]. If the user wishes to define non standard coordinates he gives them in form of the 1D arrays x[x_n] and y[y_n]. Otherwise (x == NULL) a equal distant subdivision of the line [0, 1] is used.

     

GRAPE(Triang2d, "explicit")(name, x, y, z, ax, ex, ay, ey, dx, dy)
char *name ; /* name of instance */
double *x, *y, *z; /* pointer to functions of coordinates */
double ax, ex; /* minimum and maximum of the first parameter */
double ay, ey; /* minimum and maximum of the second parameter */
int dx, dy; /* number of discretization in the parameter domains */
A Triang2d instance is built up for the parameterized surface, which is given through the coordinate functions x, y and z. Compare project Explicit 8.2.5, which allows to compute time-dependent surfaces reading the functions from a data file.

     

GRAPE(triang, "mollify-send")()
TRIANG2D *triang2d;
A triangulation is mollified, so that the distances of triangulation points are more regular and the surfaces are smoother.

         

(TRIANG3D *)GRAPE(triang, "simple-rot")(name, n, fi)
(TRIANG3D *)GRAPE(triang, "rot")(name, n, fi, t2t, p2p)
TRIANG2D *triang;
char *name ; /* name of produced Triang3d instance */
int n ; /* number of angles */
double fi ; /* angle in radiant */
int **t2t ; /* relation tetrahedron to triangle */
int **p2p ; /* relation 3d-point to 2d-point */
A set of tetrahedron, which are axissymmetric disposed, is constructed from a planar 2D triangulation: rotating each triangle about an angle with fi in radiant in the positive direction around the z-axis starting with the x/y-plane yields a prism-like object, division of this prism into four tetrahedron. This construction can be repeated n times. In case of a closed circle (n * fi = 2 * pi) the connectivity at the ends is generated. For "rot" the user has to provide two pointer to integer arrays which on return contain for each tetrahedron/point the index of the triangle/point it was build from.

Note that the triangles must be positive oriented in order to use these methods.

(TRIANG2D *)GRAPE(tr,"level")(funct,lev)
(TRIANG2D *)GRAPE(tr,"fix-super-level")(funct,lev)
(TRIANG2D *)GRAPE(tr,"fix-sub-level")(funct,lev)
TRIANG2D *tr;
void (*funct)();
double lev ;

'level' calculates the isoline of the given finite element function funct on the level lev. 'fix-super-level' creates the superniveau fixed by the actual value of level as a new triang2d instance. 'fix-sub-level' creates the subniveau.

         

GRAPE(triang2d, "edges")(angle)
GRAPE(triang2d, "show-edges-send")()
TRIANG2D *triang2d;
double angle;

If the triangulation is a surface in 3d it can be a problem since the triangle-normals are interpolated also at the edges, which therefore appear blurred. In using these methods additional fictive points are inserted at the edges, which prevents the interpolation. The minimal edge-angle only just specifying an edge is the parameter angle, which can also be set up with the root-method "choice-edge-angle-send".

   

(SCENE *)GRAPE(s,"split-surfaces-send")()
SCENE *s ; /*of which the object is 2D*/

With this method as well the interpolation of the normals at the edges is avoided by dividing the triangulation at the edges. For each singular surface a new scene appears in the scene tree. The minimal edge-angle can be set up using the root-method "choice-edge-angle-send".

     

(VEC3 *)GRAPE(triang2d, "get-vertex-wnormals")(vnorm)
TRIANG2D *triang2d;
VEC3 *vnorm;
Compute weighted vertex normals for a Triang2d instance. If vnorm == NULL the needed memory is allocated. Normals are weighted with the angle of the triangle the normal belongs to. "get-vertex-wnormals-send" of Geom2d uses this method.

     

(VEC3 *)GRAPE(triang2d, "get-triangle-normals")(tnorm)
TRIANG2D *triang2d;
VEC3 *tnorm;
Compute triangle normals for a Triang2d instance. If vnorm == NULL the needed memory is allocated.

     

(VEC3 *)GRAPE(triang2d, "draw-normals-disp")()
TRIANG2D *triang2d;
Draws triangle normals for every triangle of a Triang2d instance. The length of the normals may be scaled by a ruler.

   

(TRIANG2D *)GRAPE(tr2,"orient-send")()
(TRIANG2D *)GRAPE(tr2,"inverse-orient-send")()
(TRIANG2D *)GRAPE(tr2,"switch-orient-send")()
TRIANG2D *tr2;

These methods concern the local orientation of the triangles. orient-send checks if the orientation of the triangles is always in the same direction. If not, the orientation of the triangle no.0 is taken to all triangles. inverse-orient-send changes the orientation of the whole triangulation (e.g. inner normals get outer normals). This is done by changing the orientation of triangle no.0 and calling orient-send.

   

     

GRAPE(triang2d, "sort-points-send")()
TRIANG2D *triang2d;
"sort-points-send" sorts points such that all used points are at the beginning of the point list.

     

GRAPE(triang2d, "regenerate-send")()
TRIANG2D *triang2d;
"regenerate-send" regenerates a degenerate triang2d structure by removing triangles with very short edges, double triangles or triangles with very short angles in this order, but if necessary in a multiple loop. After this method has been called, there may exist a lot of unused points in the triang2d->x/y/z point list.

     

GRAPE(tr2d, "identify-nbs-send")()
GRAPE(tr2d, make-neighbour-send")()
TRIANG2D *tr2d;
These methods build neighbourhood information for an arbitrary tr2d only out of tr2d->vertex information, using different algorithms. If not existent the memory for tr2d->neighbour is allocated.

     

(LIST_OF_INST *)GRAPE(triang2d, "make-edge-conn")()
TRIANG2D *triang2d;
"make-edge-conn" creates connectivity information for edges: The return list (LIST_OF_INST *)loi will contain for each vertex a List_Of_Int instance with the indices of all its adjacent points. The length of each vector equals the number of adjacent points:
loi->num_of_objects = triang->number_of_points;
loi->objects[i] = (LIST-OF-INT *)vector;
with
vector->num_of_int = number of adjacent points;
vector->vec = (int *)vec[number of adjacent points];

     

(LIST-OF-INST *)GRAPE(triang2d, "make-triangle-conn")()
TRIANG2D *triang2d;
"make-triangle-conn" creates connectivity information for triangles: The return list LIST-OF-INST *loi will contain for each vertex a List-Of-Int instance with the indices of all its adjacent triangles. The length of each vector equals the number of adjacent triangles:
loi->num_of_objects = triang->number_of_points;
loi->objects[i] = (LIST_OF_INT *)vector;
with
vector->num_of_int = number of adjacent triangles;
vecto->vec = (int *)vec[number of adjacent triangles];

   tex2html_wrap44156    tex2html_wrap44158
TRIANG2D * triang
Equiangulate triang by switching diagonals between ajacent triangles if the angles opposite to the diagonal add up to more than pi. This criterion if equivalent to cos(a) + cos(b) < 0, the cosines are calculated by the law of cosines. This is done in a loop over all edges, each switch of a diagonal reduces the radius of the circumcircles of the two triangles, therefore the loop will terminate. To prevent infinite loops -eps is used insted of 0 for comparison. The s3-method does the same but the points are projected to the three-sphere first.

This algorithms can be applied both to planar triangulations and triangulations in three-space. In the second case some switches might have to be skipped to avoid degenerations of the triangulation. The number of loops, switched diagonals and skipped switches are printed to stdout.


next up previous contents index
Next: Fe2d Up: Triang2d Previous: I/O Methods on Triang2d

SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.