
NAO Interface Class NARegion
A region is a piece of a flat space, such as the line, plane or three
space. They are determined by providing (at minimum) a dimension (the
member function getBaseSpaceDimension(), and a
routine which test a point to determine whether it is inside the region
or not (the member function isitinChart(NAPointOnManifold*).
A set of three other member functions must be provided, which together
provide a bounding box and some idea of the scale of the region within
the box. These are
- getBoundingBoxMin(int,int)
- getBoundingBoxMax(int,int)
- getBoundingBoxScale(int,int)
The first argument to these is used for manifolds, and should be zero for
regions. The second argument is the direction in which to return the
size of the bounding box. E.g. x is 0, y is 1.
Regions are a simple form of the more general Manifold.
They are manifolds with a single chart, and the mapping for the only chart is
the identity. Except for the member functions above, the NARegion
class implements all of the member functions of the manifold. A region may be
discrete (it is always differential, and the implementor of
subclasses should feel free to override the member functions of the
NAManifold base class which are associated with meshes. The other
member function may be changed, but it is not recommended. If they
need to be changed, it would be better to derive from the slightly more
general NAMappedRegion, or the completely
general NAManifold.
For a complete introduction to the NARegion, please refer to the
Primer on NARegions.
To use this class, include the header file
NAO/NARegion.h
and link against library
libNAOBase.a
The following member functions are available when classes are derived from this
interface class, in addition to those provided by the parent class
NAManifold.
Pure Virtual Member Functions, which must be provided by derived classes:
-
-
| NABoolean isitinChart(pt
) const; |
| Returns TRUE if the given point is in the domain of the chart mapping.
|
|
-
| float getBoundingBoxMin(chart
,direction
) const; |
| Returns the minimum value of the bounding box for a chart, in the given direction.
|
| const int | chart
; | The chart number. (Specified by user).
|
| const int | direction
; | The coordinate direction. (Specified by user).
|
|
-
| float getBoundingBoxMax(chart
,direction
) const; |
| Returns the maximum value of the bounding box for a chart, in the given direction.
|
| const int | chart
; | The chart number. (Specified by user).
|
| const int | direction
; | The coordinate direction. (Specified by user).
|
|
-
| float getBoundingBoxScale(chart
,direction
) const; |
| Returns a typical scale of the chart within the bounding box, in the given direction.
|
| const int | chart
; | The chart number. (Specified by user).
|
| const int | direction
; | The coordinate direction. (Specified by user).
|
|
Virtual Member Functions, which may or may not be provided by derived classes:
-
| NABoolean isitOpen() const; |
| Returns TRUE if there are no (zero) boundaries.
|
-
| NAManifold* getBoundary(i
) const; |
| Returns the specified boundary.
|
| const int | i
; | Number of the boundary to be returned. (Specified by user).
|
|
-
| NABoolean isitDiscrete() const; |
| Returns TRUE if this class implements the member functions associated with meshes.
|
-
-
| void getVertex(i
,pt
) const; |
| Get a vertex.
|
| const long | i
; | Vertex number. (Specified by user).
|
| NAPointOnManifold* | pt
; | NAPointOnManifold in which to return the vertex. User is responsible for allocating storage. (Specified by user).
|
|
-
-
-
| long getCellNumber(pt
,dimension
) const; |
| Given the dimension of the cell, returns the cell in which the given point lies.
|
| const NAPointOnManifold* | pt
; | Point. (Specified by user).
|
| int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| long getNumberOfCells(dimension
) const; |
| Returns the number of cells of a given dimension.
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| int getMaxNumberOfCellFaces(dimension
) const; |
| Returns the largest number of faces of cells of a given dimension.
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| int getMinNumberOfCellFaces(dimension
) const; |
| Returns the smallest number of faces of cells of a given dimension.
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| int getNumberOfCellFaces(dimension
,cell
) const; |
| Returns the number of faces of a cell of a given dimension.
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
| const long | cell
; | Cell number. (Specified by user).
|
|
-
| int getCellFaces(dimension
,cell
,faces
) const; |
| Get a list of all the faces of a cell of a given dimension. Returns the number of faces in the array.
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
| const long | cell
; | Cell number. (Specified by user).
|
| long* | faces
; | Array to receive the list of faces. User is responsible for allocating space. (Specified by user).
|
|
-
| long getCellFace(dimension
,cell
,face
) const; |
| Returns the index of a face of a cell of a given dimension.
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
| const long | cell
; | Cell number. (Specified by user).
|
| const int | face
; | Face number. (Specified by user).
|
|
-
| int getMaxNumberOfFaceCells(dimension
) const; |
| Returns the largest number of cells adjacent to a face of a given dimension.
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
|
-
| int getMinNumberOfFaceCells(dimension
) const; |
| Returns the smallest number of cells adjacent to a face of a given dimension.
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
|
-
| int getNumberOfFaceCells(dimension
,face
) const; |
| Returns the number of cells adjacent to a face of a given dimension.
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
| const long | face
; | index of Face. (Specified by user).
|
|
-
| int getFaceCells(dimension
,face
,cells
) const; |
| Get a list of all the cells adjacent to a face of a given dimension. Returns the number of faces in the array.
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
| const long | face
; | index of Face. (Specified by user).
|
| long* | cells
; | Array to receive the list of cells. User is responsible for allocating space. (Specified by user).
|
|
-
| long getFaceCell(dimension
,face
,cell
) const; |
| Returns the index of a cell adjacent to a face of a given dimension.
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
| const long | face
; | index of Face. (Specified by user).
|
| const int | cell
; | Cell number. (Specified by user).
|
|
-
-
| long getNumberOfVertices(c
) const; |
| Returns the number of vertices in a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
|
-
| void getVertex(c
,i
,pt
) const; |
| Get a vertex from a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const long | i
; | Vertex number. (Specified by user).
|
| NAPointOnManifold* | pt
; | NAPointOnManifold in which to return the vertex. User is responsible for allocating storage. (Specified by user).
|
|
-
| long getVertexNumber(c
,v
) const; |
| Returns the vertex number of a vertex on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const NAPointOnManifold* | v
; | Vertex. (Specified by user).
|
|
-
| long getCellNumber(c
,pt
,dimension
) const; |
| Given the dimension of the cell, returns the cell in which the given point lies.
|
| const int | c
; | Component. (Specified by user).
|
| const NAPointOnManifold* | pt
; | Point. (Specified by user).
|
| int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| long getNumberOfCells(c
,dimension
) const; |
| Returns the number of cells of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| int getMaxNumberOfCellFaces(c
,dimension
) const; |
| Returns the largest number of faces of cells of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| int getMinNumberOfCellFaces(c
,dimension
) const; |
| Returns the smallest number of faces of cells of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
|
-
| int getNumberOfCellFaces(c
,dimension
,cell
) const; |
| Returns the number of faces of a cell of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
| const long | cell
; | Cell number. (Specified by user).
|
|
-
| int getCellFaces(c
,dimension
,cell
,faces
) const; |
| Get a list of all the faces of a cell of a given dimension of a given component. Returns the number of faces in the array.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
| const long | cell
; | Cell number. (Specified by user).
|
| long* | faces
; | Array to receive the list of faces. User is responsible for allocating space. (Specified by user).
|
|
-
| long getCellFace(c
,dimension
,cell
,face
) const; |
| Returns the index of a face of a cell of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of cell. (Specified by user).
|
| const long | cell
; | Cell number. (Specified by user).
|
| const int | face
; | Face number. (Specified by user).
|
|
-
| int getMaxNumberOfFaceCells(c
,dimension
) const; |
| Returns the largest number of cells adjacent to a face of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
|
-
| int getMinNumberOfFaceCells(c
,dimension
) const; |
| Returns the smallest number of cells adjacent to a face of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
|
-
| int getNumberOfFaceCells(c
,dimension
,face
) const; |
| Returns the number of cells adjacent to a face of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
| const long | face
; | index of Face. (Specified by user).
|
|
-
| int getFaceCells(c
,dimension
,face
,cells
) const; |
| Get a list of all the cells adjacent to a face of a given dimension of a given component. Returns the number of faces in the array.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
| const long | face
; | index of Face. (Specified by user).
|
| long* | cells
; | Array to receive the list of cells. User is responsible for allocating space. (Specified by user).
|
|
-
| long getFaceCell(c
,dimension
,face
,cell
) const; |
| Returns the index of a cell adjacent to a face of a given dimension on a component mesh.
|
| const int | c
; | Component. (Specified by user).
|
| const int | dimension
; | Dimension of face. (Specified by user).
|
| const long | face
; | index of Face. (Specified by user).
|
| const int | cell
; | Cell number. (Specified by user).
|
|
-
| NABoolean canBeCastTo(type
) const; |
| returns TRUE if this NARegion can be cast to the type given.
|
| const char* | type
; | The string corresponding to the class. (Specified by user).
|
|
non Virtual Member Functions, which are provided by this base class and may not be replaced by a derived class:
-
-
-
-
| void getPoint(basePt
,targetPt
) const; |
| Returns a point on the manifold.
|
| const NAPointOnManifold* | basePt
; | Point in the base space. (Specified by user).
|
| NAPointOnManifold* | targetPt
; | Place to return the corresponding point in the target space. User is responsible for allocating storage. (Specified by user).
|
|
-
| void mapBetweenCharts(pt
,chart2
,pt2
) const; |
| Takes a pt from one chart to the equivalent point in an overlapping chart.
|
| const NAPointOnManifold* | pt
; | point to map. (Specified by user).
|
| const int | chart2
; | chart to map it to. (Specified by user).
|
| NAPointOnManifold* | pt2
; | Equivalent point in chart 2. (Specified by user).
|
|
-
| int getNumberOfChartsThatOverlap(chart
) const; |
| Returns the number of charts that overlap a given chart.
|
| const int | chart
; | The chart. (Specified by user).
|
|
-
| void getChartsThatOverlap(chart
,list
) const; |
| Returns a list of the charts that overlap a given chart.
|
| const int | chart
; | The chart. (Specified by user).
|
| int* | list
; | An array which is filled with a list of the overlapping chart. The user is responsible for allocating storage. (Specified by user).
|
|
-
| NABoolean isitDifferential() const; |
| Returns TRUE if the member functions for retrieving tangents, metric etc. have been implemented.
|
-
-
| int getNormalSpaceDimension() const; |
| Returns the dimension of the normal space (co-dimension of the tangent space).
|
-
| void getTangentSpace(x
,i
,b
) const; |
| Gets one basis vector for the tangent space at a point
|
| const NAPointOnManifold* | x
; | The point at which the tangent space is computed. (Specified by user).
|
| const int | i
; | The basis vector to retreive. (Specified by user).
|
| NAPointOnManifold* | b
; | The basis vector. User is responsible for allocating storage. (Specified by user).
|
|
-
| void getNormalSpace(x
,i
,b
) const; |
| Gets one basis vector for the normal space at a point
|
| const NAPointOnManifold* | x
; | The point at which the normal space is computed. (Specified by user).
|
| const int | i
; | The basis vector to retreive. (Specified by user).
|
| NAPointOnManifold* | b
; | The basis vector. User is responsible for allocating storage. (Specified by user).
|
|
-
| float getMetric(x
,i
,j
) const; |
| Gets one element of the metric at a point. ( )
|
| const NAPointOnManifold* | x
; | The point at which the matric space is computed. (Specified by user).
|
| const int | i
; | The first index. (Specified by user).
|
| const int | j
; | The second index. (Specified by user).
|
|
-
| float getConnection(x
,i
,j
,k
) const; |
| Gets one element of the connection at a point. ( )
|
| const NAPointOnManifold* | x
; | The point at which the matric space is computed. (Specified by user).
|
| const int | i
; | The first index. (Specified by user).
|
| const int | j
; | The second index. (Specified by user).
|
| const int | k
; | The third index. (Specified by user).
|
|
-
| void getMetric(x
,m
) const; |
| Gets the metric at a point.
|
| const NAPointOnManifold* | x
; | The point at which the matric space is computed. (Specified by user).
|
| float* | m
; | An array in which the metric is returned (column indexing). length targetSpaceDimension^2. User is responsible for allocating storage. (Specified by user).
|
|
-
| void getConnection(x
,m
) const; |
| Gets the metric at a point.
|
| const NAPointOnManifold* | x
; | The point at which the matric space is computed. (Specified by user).
|
| float* | m
; | An array in which the metric is returned (column indexing). length baseSpaceDimension*targetSpaceDimension^2. User is responsible for allocating storage. (Specified by user).
|
|
-
| float getDistance(x
,y
) const; |
| Returns the distance between two points.
|
|
-
| int projectOntoManifold(x
,d
,y
) const; |
| Project a point in the targetSpace onto the Manifold. Returns 1 if successful.
|
| const NAPointOnManifold* | x
; | The point. (Specified by user).
|
| NAPointOnManifold** | d
; | A set of directions (as many as the dimension of the base space). (Specified by user).
|
| NAPointOnManifold* | y
; | The corresponding point on the manifold (base space). User is responsible for storage allocation. (Specified by user).
|
|
-
| int projectOntoManifold(x
,y
) const; |
| Project a point in the targetSpace onto the Manifold. Returns 1 if successful.
|
| const NAPointOnManifold* | x
; | The point. (Specified by user).
|
| NAPointOnManifold* | y
; | The corresponding point on the manifold (base space). User is responsible for storage allocation. (Specified by user).
|
|
The following classes are children of this base class:
The NARegion provides most of the required member functions of the
NAManifold interface. It is intended as a convenience, supplying
default values for the more "manifold-ish" things that simple
geometrical regions simply do not have. With the exception of
the interface for Discrete Regions, the only member functions that
a Region must implement are the dimension (getBaseSpaceDimension),
and the test for a point being in the region (isitinChart).
For a region the base and target spaces are identical, and the
chart mapping (getPoint) is the identity mapping. There is only
one chart, so getNumberOfChartsInAtlas always returns 1. The
routines dealing with the list of overlapping charts do nothing.
A region may or may not have a Boundary. The region inherits the
simple boundary list that the NAManifold provides.
Regions have a differential structure, which is just that of the
Euclidean Base (and Target) space.
It is not easy to give an example of an NARegion. All of it's
interface is contained in that of the NAManifold. Here, however
is a very simple use of a region, creating a point and testing for inclusion:
#include <NAO/NARegion.h>
#include <NAO/NADblPt.h>
#include <NAO/UTPrMtMf.h>
int i,n;
NARegion *Omega;
n=Omega->getBaseSpaceDimension();
NAPointOnManifold *x=new NADoublePointOnManifold(n);
for(i=0;i<n;i++)
{
x->setCoordinate(i,sin(NAPI*i/n));
}
if(Omega->isitinChart(x))
{
cout << "The point ";
NAPrint(x);
cout << is inside Omega." << endl;
}else{
cout << "The point ";
NAPrint(x);
cout << is not inside Omega." << endl;
}
The parent of this Interface class:
Siblings of this Interface class:
Children of this Interface class:
Created: Fri Oct 9 13:16:18 EDT 1998
[Comments |
NAO home page ]
[Research home page]
[ IBM home page |
Order |
Privacy |
ContactIBM |
Legal ]