Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

Fiber::TriangularSurface Struct Reference
[Predefined Grid Types]

A triangular surface stored on a Grid. More...

#include <TriangularSurface.hpp>

List of all members.

Public Types

Public Member Functions

Static Public Member Functions

Public Attributes

Static Public Attributes


Detailed Description

A triangular surface stored on a Grid.

The information required in a Grid object are vertices given in cartesian coordinates, and triangles given as indices of three vertices per triangle index. This information defines two arrays, of type CoordsArray_t and of type CellArray_t.

The Grid must carry Vertices in Cartesian coordinates and a (2,1) Skeleton with positions in the Vertices as triangle cells.

A Grid object can be easily tested whether it is ("conforms to the concept of") a TriangularSurface:

   RefPtr<Grid> G;
        if (TriangularSurface T = G)
        {
                ... yes is a triangular surface ...
        }

If the reason for not being a TriangularSurface need to be inspected further, then the members of the TriangularSurface can be investigated.

Todo:
Compute area, curvature, ... http://en.wikipedia.org/wiki/Barycentric_coordinates_%28mathematics%29
Examples:

CrystalSurface.cpp, EvolutionSurface.cpp, MonochromeSurface.cpp, PolychromeSurface.cpp, TransparentColoredSurface.cpp, and TransparentSurface.cpp.


Constructor & Destructor Documentation

Fiber::TriangularSurface::TriangularSurface ( const RefPtr< Grid > &  G = NullPtr()  ) 

Construct a triangular surface from a Grid object, extracting those properties that make a triangular surface.

Note that the Grid pointer (the base class) will not be assigned if the given Grid does not conform to the properties of a Triangular Surface, thus the evaluation will return false. A valid code to check if a Grid is a triangular surface looks like this:

           RefPtr<Grid> G = ...
                if (TriangularSurface T = G )
                {
                        // yes, it's a triangular surface
                }

This is a mere meta-data check for the existence of appropriate Fields. The triangular surface will still be invalid if there are no data associated in those Fields. This meta-data check does not load or create any data.

References CartesianVertices, CellField, CellsAsVertices, CoordField, NormalVectorFieldName, and VertexNormalField.


Member Function Documentation

RefPtr<CellArray_t> Fiber::TriangularSurface::getCells (  )  const [inline]

Get the triangle data array.

The surface must be unfragmented.

RefPtr<CoordsArray_t> Fiber::TriangularSurface::getCoords (  )  const [inline]

Get the coordinate data array.

The surface must be unfragmented.

RefPtr< Field > Fiber::TriangularSurface::getVertexNormalField ( const string &  FieldName = NormalVectorFieldName  ) 

Get normal vectors, possibly computing them if they do not exist yet.

Access VertexNormalField to see if this field already has been defined.

References CartesianVertices, CellField, CoordField, and VertexNormalField.

static SkeletonID Fiber::TriangularSurface::ID (  )  [inline, static]

Return a skeleton ID that is characteristic for this type of Grids.

In this case, for a set of triangles, it will be the (2,1) skeleton, with 2D cells referring to vertices.

Examples:
EvolutionSurface.cpp.

Referenced by getFaceSkeleton().


Member Data Documentation

const char Fiber::TriangularSurface::NormalVectorFieldName = "Normals" [static]

A default name for the field that holds the normal vectors of a grid with a surface.

It will just be "Normals";

Referenced by TriangularSurface().