## surfaces_points

surfaces_points — Define a structure to store a set of triangles defining a surface.

## Synopsis

    #define             SurfacesPoints_normalOffset
    #define             SurfacesPoints_translationOffset
    #define             SurfacesPoints_userOffset
                        SurfacesPoints;
    void                isosurfacesPointsInit               (SurfacesPoints *points,
                                                             int bufferSize);
    void                isosurfacesPointsAllocate           (SurfacesPoints *points,
                                                             int nsurf,
                                                             int npolys,
                                                             int npoints);
    void                isosurfacesPointsFree               (SurfacesPoints *points);
    void                isosurfacesPointsRemove             (SurfacesPoints *points,
                                                             int pos);
    void                isosurfacesPointsTranslate          (SurfacesPoints *points,
                                                             float xyz[3]);
    void                isosurfacesPointsCheck              (SurfacesPoints *points);

## Description

This structure is used to store and draw polyedges as a set of XYZ points and a set of link to them.

## Details

### SurfacesPoints_normalOffset

    #define SurfacesPoints_normalOffset 3

The offset to read the normal values in poly_points.

### SurfacesPoints_translationOffset

    #define SurfacesPoints_translationOffset 6

The offset to read the translation values in poly_points.

### SurfacesPoints_userOffset

    #define SurfacesPoints_userOffset 9

The offset to read the user values in poly_points.

### SurfacesPoints

    typedef struct {
      /* Number of different surfaces. */
      int nsurf;
      /* This is the size of additional data on each points in addition to
         (x,y,z) coordinates, normal and translation. Then poly_points is
         allocated to (num_points * (9 + bufferSize)). */
      int bufferSize;

      /* Number of polygons */
      int num_polys, num_points;

      /* Number of polygons per surface. */
      int *num_polys_surf;

      /* Give the number of the surface when the number of the
         polygon is given. */
      int *poly_surf_index;

      /* Return the number of vertices when the id of
         the polygon is given. */
      int *poly_num_vertices;

      /* Return the id in poly_points_data of the vertice j of polygon i. */
      int **poly_vertices;

      /* Vectors giving points and normal of the vertice i. */
      float **poly_points_data;
    } SurfacesPoints;

This structure stores geometric description of surfaces. Several surfaces are stored in a single structure for improved performances.

int `nsurf`; | number of surfaces encoded in this structure ;
int `bufferSize`; | number of stored float in addition to coordinates and normals ;
int `num_polys`; | number of polygoins stored in this structure ;
int `num_points`; | number of vertices stored in this structure ;
int *`num_polys_surf`; | number of visible polygons stored in this structure per surface ;
int *`poly_surf_index`; | gives the id of the surface for each polygon, this value ranges from - nsurf to + nsurf. abs(id - 1) gives the index of the surface the polygon is attached to. If values are negative, then the polygon is currently not used ;
int *`poly_num_vertices`; | gives the number of vertices used by each polygons ;
int **`poly_vertices`; | returns the id j of the vertices of polygon i ;
float **`poly_points_data`; | vectors giving additional data of vertex i.

### isosurfacesPointsInit ()

    void                isosurfacesPointsInit               (SurfacesPoints *points,
                                                             int bufferSize);

Initialise a SurfacesPoints structure. It must be done before any use.

`points` : | a pointer on a set of points (not initialised) ;
`bufferSize` : | the number of additional data to coordinates and normals.

### isosurfacesPointsAllocate ()

    void                isosurfacesPointsAllocate           (SurfacesPoints *points,
                                                             int nsurf,
                                                             int npolys,
                                                             int npoints);

Allocate the arrays to store a set of points.

`points` : | a pointer on a set of points (not allocated) ;
`nsurf` : | the number of stored surfaces ;
`npolys` : | the number of stored polygons ;
`npoints` : | the corresponding number of points ;

### isosurfacesPointsFree ()

    void                isosurfacesPointsFree               (SurfacesPoints *points);

Free all allocated arrays of the given set of points. The point structure itself is not freed.

`points` : | a set of points.

### isosurfacesPointsRemove ()

    void                isosurfacesPointsRemove             (SurfacesPoints *points,
                                                             int pos);

Remove the points belonging to surface number `pos`.

`points` : | a set of points ;
`pos` : | an integer between 0 and points->nsurf.

### isosurfacesPointsTranslate ()

    void                isosurfacesPointsTranslate          (SurfacesPoints *points,
                                                             float xyz[3]);

In devel...

`points` : | a set of points.
`xyz` : | a given translation in cartesian coordinates.

### isosurfacesPointsCheck ()

    void                isosurfacesPointsCheck              (SurfacesPoints *points);

A debug routines to check that all pointers and size are relevant. It should not be used outside a debug area because it can be slow.

`points` : | a set of points.