cpolytope.h File Reference

Detailed Description

Definition of a polytope defined in the tangent space of a chart bounding the area of applicability of the chart.

Tcspolytope is a simplified version of this object where we only store the faces implicitly defining the polytope.

See Also
Tcpolytope,cpolytope.c

Definition in file cpolytope.h.

Data Structures

struct  Tcpolytope
 A polytope associated with chart on a manifold. More...
 

Macros

#define POLYTOPE_R_ENLARGEMENT   1.01
 Factor to expand the polytope w.r.t. the included box. More...
 

Functions

void InitEmptyPolytope (unsigned int k, double r, Tcpolytope *mp)
 Defines an empty chart polytope. More...
 
void DefinePolytope (Tcpolytope *mp)
 Initial definition of the polytope bounding the local chart. More...
 
void SPolytope2Polytope (Tparameters *pr, Tscpolytope *sp, Tcpolytope *p)
 Defines a chart polytope from a simple chart polytope. More...
 
void Polytope2SPolytope (Tparameters *pr, Tcpolytope *p, Tscpolytope *sp)
 Defines a simple chart polytope from a normal/full chart polytope. More...
 
void CopyPolytope (Tcpolytope *mp_dst, Tcpolytope *mp_src)
 Copies the polytope from one chart to another. More...
 
boolean CutPolytope (Tparameters *pr, double *t, double r, unsigned int id, void *wcs, void *c, unsigned int m, unsigned int *tp, Tbox *ambient, Tcpolytope *mp)
 Crops the polytope bounding chart with a plane. More...
 
boolean CutPolytopeWithFace (Tparameters *pr, double *t, double offset, unsigned int id, void *wcs, void *c, unsigned int m, unsigned int *tp, Tbox *ambient, Tcpolytope *mp)
 Cuts a polytope with a given plane. More...
 
void PolytopeCenter (double *t, Tcpolytope *mp)
 Computes the center of the polytope. More...
 
boolean InsidePolytope (double *t, Tcpolytope *mp)
 Identifies points inside a chart polytope. More...
 
double GetPolytopeRadius (Tcpolytope *mp)
 Returns the simple polytope radius. More...
 
unsigned int GetPolytopeDim (Tcpolytope *mp)
 Returns the simple polytope dimensionality. More...
 
TboxGetPolytopeBB (Tcpolytope *mp)
 Returns the simple polytope bounding box. More...
 
void SetPolytopeBB (Tbox *bb, Tcpolytope *mp)
 Modifies the bounding box of the polytope. More...
 
boolean ExpandiblePolytope (Tcpolytope *mp)
 Identifies polytopes not fully bounded. More...
 
void WrongPolytopeCorner (unsigned int nv, Tcpolytope *mp)
 Mark a vertex as wrong. More...
 
boolean GetPolytopeInteriorPoint (double rSample, double *t, Tcpolytope *mp)
 Returns a point inside the ball and the polytope. More...
 
boolean PolytopeBoundaryPointFromExternalCorner (double rSample, boolean rand, unsigned int *nv, double *t, Tcpolytope *mp)
 Random point on the boundary from the polytope vetices. More...
 
void PolytopeBoundaryPointsFromExternalCorners (double rSample, unsigned int *n, unsigned int **nv, double ***t, Tcpolytope *mp)
 Points on boundary from all the polytope vertexes. More...
 
boolean PolytopeRandomPointOnBoundary (double rSample, double *t, Tcpolytope *mp)
 Random point on the boundary of the chart. More...
 
boolean RandomPointInPolytope (double *t, Tcpolytope *mp)
 Random point on the polytope with uniform distribution. More...
 
double PolytopeMaxVolume (Tcpolytope *mp)
 Maximum volume of the polytope. More...
 
double PolytopeVolume (Tcpolytope *mp)
 Polytope volume. More...
 
unsigned int PolytopeNumNeighbours (Tcpolytope *mp)
 Number of neighbours of the polytope. More...
 
unsigned int PolytopeNeighbourID (unsigned int n, Tcpolytope *mp)
 Returns the identifier of one of the neighbours of a polytope. More...
 
void GetPolytopeVertices (unsigned int *nv, double ***v, Tcpolytope *mp)
 Gets the set of vertices of the polytope. More...
 
void GetPolytopeNeighboursFromVertices (unsigned int *nv, unsigned int **cID1, unsigned int **cID2, Tcpolytope *mp)
 Identifiy the three charts coincident at a vertex. More...
 
void GetPolytopeEdges (unsigned int *ne, unsigned int **vID1, unsigned int **vID2, Tcpolytope *mp)
 Gets the set of edges of the polytope. More...
 
unsigned int PolytopeMemSize (Tcpolytope *mp)
 Computes the memory used by the polytope. More...
 
void SavePolytope (FILE *f, Tcpolytope *mp)
 Saves the chart polytope to a file. More...
 
void LoadPolytope (FILE *f, Tcpolytope *mp)
 Reads the chart polytope from a file. More...
 
void PrintPolytopeInfo (Tcpolytope *mp)
 Prints information about the polytope. More...
 
void DeletePolytope (Tcpolytope *mp)
 Deletes the structure allocated by DefinePolytope. More...
 

Macro Definition Documentation

#define POLYTOPE_R_ENLARGEMENT   1.01

Whe initially defining the polytope, we define a box side slightly larger than the included ball (to avoid tangencies with it). This is the expansino ratio used.

Definition at line 32 of file cpolytope.h.

Referenced by DefinePolytope(), PolytopeMaxVolume(), and RandomPointInPolytope().

Function Documentation

void InitEmptyPolytope ( unsigned int  k,
double  r,
Tcpolytope mp 
)

Defines an empty chart polytope.

Parameters
kDimensinality of the space where to define the polytope.
rRadius of the ball to be enclosed by the polytope.
mpThe polytope to initialize.

Definition at line 65 of file cpolytope.c.

References Tcpolytope::emptyPolytope, Tcpolytope::k, Tcpolytope::open, PolytopeMaxVolume(), Tcpolytope::r, TRUE, and Tcpolytope::v.

Referenced by InitChartInt(), and SPolytope2Polytope().

void DefinePolytope ( Tcpolytope mp)

Defines a box with all vertices outside the ball defining the polytope. This polytope is refined as the local chart intersects with other local charts. In this refinement the external vertices progresively moves inside the ball. When all points are inside the ball, the chart is no longer in the frontier of expansion of the atlas.

Parameters
mpThe polytope to initialize.

Definition at line 77 of file cpolytope.c.

References Tcpolytope::bb, Tcpolytope::emptyPolytope, Tcpolytope::expandible, Tcpolytope::face, FALSE, FirstCombination(), Tcpolytope::freeVertex, Tcpolytope::ID, Tcpolytope::indices, InitBox(), Tcpolytope::k, Tcpolytope::maxFaces, Tcpolytope::maxIndices, Tcpolytope::maxVertices, NEW, NewInterval(), Tcpolytope::nExpandible, NextCombination(), Tcpolytope::nFaces, Tcpolytope::nIndices, NO_UINT, Tcpolytope::nVertices, Tcpolytope::open, POLYTOPE_R_ENLARGEMENT, Tcpolytope::r, SetBoxInterval(), TRUE, and Tcpolytope::vertex.

Referenced by CutPolytope(), GetPolytopeEdges(), GetPolytopeNeighboursFromVertices(), GetPolytopeVertices(), PolytopeBoundaryPointFromExternalCorner(), PolytopeBoundaryPointsFromExternalCorners(), PrintPolytopeInfo(), and SPolytope2Polytope().

void SPolytope2Polytope ( Tparameters pr,
Tscpolytope sp,
Tcpolytope p 
)

Defines a chart polytope from a simple chart polytope.

Parameters
prThe set of parameters.
spThe simple polytope from where to get the data.
pThe polytope to create.

Definition at line 188 of file cpolytope.c.

References CT_R, CutPolytopeWithFace(), DefinePolytope(), GetParameter(), GetSPolytopeDim(), GetSPolytopeFace(), GetSPolytopeNFaces(), InitEmptyPolytope(), NEW, and SPolytopeNeighbourID().

Referenced by GetChartNeighboursFromVertices(), PlotChart(), and PlotChartAsPolygon().

void Polytope2SPolytope ( Tparameters pr,
Tcpolytope p,
Tscpolytope sp 
)

Defines a simple chart polytope from a normal/full chart polytope.

Parameters
prThe set of parameters.
pThe normal polytope from where to get the data.
spThe simple polytope to create.

Definition at line 212 of file cpolytope.c.

References CT_DELTA, CT_SR, CutSPolytopeWithFace(), DefineSPolytope(), Tcpolytope::face, GetParameter(), Tcpolytope::ID, InitEmptySPolytope(), Tcpolytope::k, Tcpolytope::nFaces, and Tcpolytope::r.

void CopyPolytope ( Tcpolytope mp_dst,
Tcpolytope mp_src 
)

Copies the data defining the polytope from one chart to another.

Assumes the other fiels of the chart are already copied from src to dst (i.e., this is to be called at the end of the chart copy constructor).

Parameters
mp_dstThe polytope where to copy the information.
mp_srcThe polytope from where to copy the information.

Definition at line 229 of file cpolytope.c.

References Tcpolytope::bb, CopyBox(), Tcpolytope::emptyPolytope, Tcpolytope::expandible, Tcpolytope::face, FALSE, Tcpolytope::freeVertex, Tcpolytope::ID, Tcpolytope::indices, Tcpolytope::k, Tcpolytope::maxFaces, Tcpolytope::maxIndices, Tcpolytope::maxVertices, NEW, Tcpolytope::nExpandible, Tcpolytope::nFaces, Tcpolytope::nIndices, Tcpolytope::nVertices, Tcpolytope::open, Tcpolytope::r, Tcpolytope::v, and Tcpolytope::vertex.

Referenced by CopyChart().

boolean CutPolytope ( Tparameters pr,
double *  t,
double  r,
unsigned int  id,
void *  wcs,
void *  c,
unsigned int  m,
unsigned int *  tp,
Tbox ambient,
Tcpolytope mp 
)

Reduces a polytope bounding chart cropping it with a plane defined by the intersection of the chart ball with a ball centered at t with radious r. This ball is an approximation in the chart plane of the ball bounding another chart.

This is basically a particular case for CutPolytopeWithFace where the face is defined from the intersection of two balls.

Parameters
prThe set of parameters.
tCenter of the new ball.
rRadius of the new ball. This is typically the same as the ball for the current polytope.
idIdentifier of the chart generating the cut. This is used to update the list of neighbours.
wcsThe equations defining the problem at hand.
cPointer to the chart.
mThe dimensionality of the ambient space.
tpThe topology of the ambient space.
ambientThe ambient space.
mpThe chart with the polytope to crop.
Returns
TRUE if the polytope still has faces not generated by a neighboring chart (i.e., the intial faces or faces generated due crop with the domain limits).

Definition at line 396 of file cpolytope.c.

References CutPolytopeWithFace(), DefinePolytope(), Tcpolytope::emptyPolytope, Tcpolytope::k, Norm(), and Tcpolytope::r.

Referenced by ForceChartCut(), and IntersectChartsInt().

boolean CutPolytopeWithFace ( Tparameters pr,
double *  t,
double  offset,
unsigned int  id,
void *  wcs,
void *  c,
unsigned int  m,
unsigned int *  tp,
Tbox ambient,
Tcpolytope mp 
)

This is the generic function cutting a polytope by a plane that can come from the intersection of two balls or from anywhere else.

The plane is given in the form

\[ offset+\sum_{i=1}^{k} x_i t_i \leq 0 \]

where the $ t_i $ are given in t, the $ x_i $ are the variables in the tangent space, and $ k $ is the dimension of this space.

Parameters
prThe set of parameters.
tParameters of the plane.
offsetOffset of the plane.
idIdentifier of the chart generating the cut. This is used to update the list of neighbours.
wcsThe equations defining the problem at hand.
cPointer to the chart.
mThe dimensionality of the ambient space.
tpThe topology of the ambient space.
ambientThe ambient space.
mpThe chart with the polytope to crop.
Returns
TRUE if the polytope still has faces not generated by a neighboring chart (i.e., the intial faces or faces generated due crop with the domain limits).

Definition at line 412 of file cpolytope.c.

References Tcpolytope::bb, CS_WD_SIMP_INEQUALITIES_ERROR, DeleteBox(), DistancePointToBoxTopology(), Tcpolytope::emptyPolytope, ExpandBox(), Tcpolytope::expandible, Tcpolytope::face, FALSE, Tcpolytope::freeVertex, GeneralDotProduct(), HaveEdge(), Tcpolytope::ID, Tcpolytope::indices, InitBoxFromPoint(), Tcpolytope::k, Local2Global(), Tcpolytope::maxFaces, Tcpolytope::maxIndices, Tcpolytope::maxVertices, MEM_DUP, MEM_EXPAND, NEW, Tcpolytope::nExpandible, Tcpolytope::nFaces, Tcpolytope::nIndices, NO_UINT, Norm(), Tcpolytope::nVertices, Tcpolytope::open, Tcpolytope::r, TRUE, Tcpolytope::v, and Tcpolytope::vertex.

Referenced by AddBorderConstraint(), CutPolytope(), and SPolytope2Polytope().

void PolytopeCenter ( double *  t,
Tcpolytope mp 
)

Computes the center of the polytope.

Parameters
tSpace to store the center.
mpThe chart with the polytope to use.

Definition at line 301 of file cpolytope.c.

References Tcpolytope::emptyPolytope, Error(), Tcpolytope::k, Tcpolytope::maxIndices, Tcpolytope::nVertices, and Tcpolytope::vertex.

Referenced by GetPolytopeInteriorPoint().

boolean InsidePolytope ( double *  t,
Tcpolytope mp 
)

Decides wheter or not a point in inside the polytope bounding a chart.

Parameters
tThe point.
mpThe polytope.
Returns
TRUE point t is inside the polytope of chart mp.

Definition at line 329 of file cpolytope.c.

References Tcpolytope::emptyPolytope, Tcpolytope::face, FALSE, GeneralDotProduct(), Tcpolytope::k, Tcpolytope::nVertices, Tcpolytope::r, and TRUE.

Referenced by FocusedPointOnBoundary(), GetPolytopeInteriorPoint(), InsideChartPolytope(), PolytopeRandomPointOnBoundary(), PolytopeVolume(), and RandomPointInPolytope().

double GetPolytopeRadius ( Tcpolytope mp)

Returns the radious of the ball included in the initial polytope.

Parameters
mpThe simple polytope to query.
Returns
The radius.

Definition at line 654 of file cpolytope.c.

References Tcpolytope::r.

unsigned int GetPolytopeDim ( Tcpolytope mp)

Returns the dimensionality of the space where the simple polytope is defined.

Parameters
mpThe simple polytope to query.
Returns
The dimensionality.

Definition at line 659 of file cpolytope.c.

References Tcpolytope::k.

Tbox* GetPolytopeBB ( Tcpolytope mp)

Returns the axis aligned box bounding the polytope.

Parameters
mpThe simple polytope to query.
Returns
The bounding box.

Definition at line 664 of file cpolytope.c.

References Tcpolytope::bb, and Tcpolytope::emptyPolytope.

void SetPolytopeBB ( Tbox bb,
Tcpolytope mp 
)

Sets a new bounding box for the polytope. Use carefully since a wrong bounding box could render the polytope inconsitent/useless.

Parameters
bbThe new bounding box.
mpThe simple polytope to change.

Definition at line 672 of file cpolytope.c.

References Tcpolytope::bb, CopyBox(), DeleteBox(), and Tcpolytope::emptyPolytope.

boolean ExpandiblePolytope ( Tcpolytope mp)

Checks if a polytope has vertices that can be sued to expand it, i.e., to generate a new neighbour.

Parameters
mpThe polytope to query.
Returns
TRUE if the polytope still has vertices outside the ball.

Definition at line 679 of file cpolytope.c.

References Tcpolytope::emptyPolytope, and Tcpolytope::nExpandible.

Referenced by ExpandibleChart(), and OpenChart().

void WrongPolytopeCorner ( unsigned int  nv,
Tcpolytope mp 
)

If we tried to extend a chart towards a selected vertex and we could not do it, we mark the corner as problematic and avoid using it for future chart extensions. This is no an issue as far as the whole manifold can be covered in many ways.

Parameters
nvThe vertex to mark
mpThe polytope.

Definition at line 684 of file cpolytope.c.

References Tcpolytope::emptyPolytope, Tcpolytope::expandible, FALSE, and Tcpolytope::nExpandible.

Referenced by PolytopeBoundaryPointFromExternalCornerInt(), and WrongCorner().

boolean GetPolytopeInteriorPoint ( double  rSample,
double *  t,
Tcpolytope mp 
)

Returns a point inside the ball and the polytope. This point is used to define lines to external polytope corners that crosses the ball.

Parameters
rSampleThe radiuos of the ball. It can be smaller than the initial one.
tSpace to store the interal point.
mpThe chart with the polytope.
Returns
TRUE if the internal point can actually be computed.

Definition at line 693 of file cpolytope.c.

References FALSE, INF, InsidePolytope(), Tcpolytope::k, Tcpolytope::maxIndices, Norm(), Tcpolytope::nVertices, PolytopeCenter(), TRUE, and Tcpolytope::vertex.

Referenced by PolytopeBoundaryPointFromExternalCornerInt().

boolean PolytopeBoundaryPointFromExternalCorner ( double  rSample,
boolean  rand,
unsigned int *  nv,
double *  t,
Tcpolytope mp 
)

Returns a point on the ball selecting one of the external polytope vertices at random and connecting this vertex and the center of the ball. These points are typically in the border of expansion of the manifold discretization (i.e., good candidates for expansion).

Parameters
rSampleRadious to use in the sampling. This is typically the radius of the ball initially inside the polytope but it can be smaller if many attempts to sample points fail.
randTRUE if the external corner has to be selected at random from all external ones of FALSE if we have to just pick the first one.
nvThe identifier of the selected vertex.
tThe output point on the chart ball boundary (if any)
mpThe polytope to sample.
Returns
TRUE if the sampled point is actually on the boundary of the chart.

Definition at line 847 of file cpolytope.c.

References DefinePolytope(), Tcpolytope::emptyPolytope, FALSE, Tcpolytope::nExpandible, NO_UINT, PolytopeBoundaryPointFromExternalCornerInt(), and randomMax().

Referenced by BoundaryPointFromExternalCorner().

void PolytopeBoundaryPointsFromExternalCorners ( double  rSample,
unsigned int *  n,
unsigned int **  nv,
double ***  t,
Tcpolytope mp 
)

Generates all the possible points on the boundary from the polytope vertexes out of the ball with radius rSample.

Parameters
rSampleThe radius to determine if a polytope vertex is internal or external.
nNumber of generated points.
nvIdentifier of the vertex used to generate each point. The space is allocated internally but must be deallocated by the caller.
tThe generated points.The space is allocated internally but must be deallocated by the caller.
mpThe polytope.

Definition at line 876 of file cpolytope.c.

References DefinePolytope(), Tcpolytope::emptyPolytope, Tcpolytope::k, NEW, Tcpolytope::nExpandible, and PolytopeBoundaryPointFromExternalCornerInt().

Referenced by BoundaryPointsFromExternalCorners().

boolean PolytopeRandomPointOnBoundary ( double  rSample,
double *  t,
Tcpolytope mp 
)

Returns a random point uniformly distributed in the boundary of the hypersphere defined in the tangent space.

After sampling the point we check if it is actually outside the neighbouring charts. The border with the neighbouring charts are defined by the faces used to cut the polytope bounding the ball (see IntersectCharts).

Charts that are basically sorounded by neighbours and only have a small portion of its ball in the border or expansion of the manifold could be arbitrarily hard to sample.

It is not allowed to sample interior charts (see ExpandibleChart).

Parameters
rSampleRadious to use in the sampling. This is typically the radius of the ball initially inside the polytope but it can be smaller if many attempts to sample points fail.
tThe output point on the chart ball boundary (if any)
mpThe polytope to sample.
Returns
TRUE if the sampled point is actually on the boundary of the atlas.

Definition at line 908 of file cpolytope.c.

References InsidePolytope(), Tcpolytope::k, and randomOnBall().

Referenced by RandomPointOnBoundary().

boolean RandomPointInPolytope ( double *  t,
Tcpolytope mp 
)

Drawns a random point inside the polytope with uniform distribution. Rejection sampling is used so for some degenerate polytopes it can take long.

Parameters
tThe array where to store the sample (must be allocated externally).
mpThe polytope to sample.
Returns
TRUE if we could actually sample inside the polytope.

Definition at line 914 of file cpolytope.c.

References Tcpolytope::bb, Tcpolytope::emptyPolytope, InsidePolytope(), Tcpolytope::k, NewInterval(), POLYTOPE_R_ENLARGEMENT, Tcpolytope::r, randomInInterval(), RandomPointInBox(), and TRUE.

Referenced by ChartVolume(), PolytopeVolume(), and RandomPointInChart().

double PolytopeMaxVolume ( Tcpolytope mp)

Upper bound of the volume of the polytope.

This is basically the volume of the area where RandomPointInPolytope uses to generate random points.

Parameters
mpThe polytope to measure.
Returns
The polytope maximum volume.

Definition at line 943 of file cpolytope.c.

References Tcpolytope::bb, Tcpolytope::emptyPolytope, GetBoxVolume(), Tcpolytope::k, POLYTOPE_R_ENLARGEMENT, and Tcpolytope::r.

Referenced by ChartVolume(), InitEmptyPolytope(), and PolytopeVolume().

double PolytopeVolume ( Tcpolytope mp)

Returns an estimation of the polytope volume. Initially the estimation is tight but as the polytope is cut with new hyperplanes we estimate the volume via sampling.

Parameters
mpThe polytope to query.
Returns
The volume estimation.

Definition at line 951 of file cpolytope.c.

References InsidePolytope(), Tcpolytope::k, NEW, PolytopeMaxVolume(), RandomPointInPolytope(), and Tcpolytope::v.

Referenced by ChartMaxVolume().

unsigned int PolytopeNumNeighbours ( Tcpolytope mp)

Returns the number of neighbours of a polytope. The neighbours of a polytope are those detected when intersecting polytopes (see CutPolytope). This only include neighbours with similar tangent spaces (not neighbours across singularities).

Note that the neighbouring management is implemented in a way that is slow for query but constant time for update. This is so since we want to optimize the construction of the atlas and not its query.

Not that for charts at the border of the ambient space, this number might include "virtual" neighbours given by the intersection with the ambient limits. Thses "virtual" neighbours have NO_UINT as identifier (see PolytopeNeighbourID).

Parameters
mpThe polytope to query.
Returns
The numbe of neighbours of the polytope.

Definition at line 974 of file cpolytope.c.

References Tcpolytope::emptyPolytope, Tcpolytope::ID, Tcpolytope::nFaces, and NO_UINT.

Referenced by ChartNumNeighbours().

unsigned int PolytopeNeighbourID ( unsigned int  n,
Tcpolytope mp 
)

Returns the identifier of one of the neighbours of a polytope. This includes only neighbours with similar tangent spaces (neighbours in the same aspect of the manifold)

Parameters
nThe number of neighbour to query (numbered from 0).
mpThe chart to query.
Returns
The neighbour identifer. NO_UINT if i is larger than the actual number of neighbours of the polytope of if the requested neighbour is not defined.

Definition at line 992 of file cpolytope.c.

References Tcpolytope::emptyPolytope, FALSE, Tcpolytope::ID, NO_UINT, and TRUE.

Referenced by ChartNeighbourID().

void GetPolytopeVertices ( unsigned int *  nv,
double ***  v,
Tcpolytope mp 
)

Returns the set of vertices of the polytope.

Parameters
nvThe number of vertices returned.
vThe set of vertices (allocated internally). If the polytope has no vertices v is set to NULL.
mpThe polytope to query.

Definition at line 1027 of file cpolytope.c.

References DefinePolytope(), Tcpolytope::emptyPolytope, Tcpolytope::k, Tcpolytope::maxIndices, Tcpolytope::maxVertices, NEW, and Tcpolytope::vertex.

Referenced by PlotChart(), and PlotChartAsPolygon().

void GetPolytopeNeighboursFromVertices ( unsigned int *  nv,
unsigned int **  cID1,
unsigned int **  cID2,
Tcpolytope mp 
)

For bidimensional manifold, we identify the two neighbouring charts coincident for each vertex. These two charts together with the current chart form one of the triangles of the triangulation of the atlas.

Parameters
nvNumber of vertices.
cID1For each vertex, the identifier of the chart neighbouring by one of the two edges defining this vertex. The space for this array is allocated internally.
cID2For each vertex, the identifier of the chart neighbouring by other edge defining this vertex. The space for this array is allocated internally.
mpThe polytope to query.

Definition at line 1061 of file cpolytope.c.

References DefinePolytope(), Tcpolytope::emptyPolytope, Error(), HaveEdge(), Tcpolytope::ID, Tcpolytope::k, Tcpolytope::maxIndices, Tcpolytope::maxVertices, NEW, and Tcpolytope::nFaces.

Referenced by GetChartNeighboursFromVertices().

void GetPolytopeEdges ( unsigned int *  ne,
unsigned int **  vID1,
unsigned int **  vID2,
Tcpolytope mp 
)

Returns the set of edges of the polytope.

Edges are returned as pairs of identifiers of vertices. The identifers correspond to the edges are returned by GetPolytopeVertices.

Parameters
neThe number of edges returned.
vID1The identifier of the first point for each edge (allocated internally).
vID2The identifier of the second point for each edge (allocated internally).
mpThe polytope to query.

Definition at line 1126 of file cpolytope.c.

References DefinePolytope(), Tcpolytope::emptyPolytope, HaveEdge(), Tcpolytope::maxIndices, Tcpolytope::maxVertices, NEW, Tcpolytope::nFaces, and Tcpolytope::nVertices.

Referenced by PlotChart(), and PlotChartAsPolygon().

unsigned int PolytopeMemSize ( Tcpolytope mp)

Computes the approximated memory used by the polytope (in bytes).

Parameters
mpThe polytope.
Returns
The number of bytes used.

Definition at line 1169 of file cpolytope.c.

References Tcpolytope::k, Tcpolytope::maxFaces, Tcpolytope::maxIndices, Tcpolytope::maxVertices, Tcpolytope::nFaces, and Tcpolytope::nVertices.

Referenced by ChartMemSize().

void SavePolytope ( FILE *  f,
Tcpolytope mp 
)

Saves the information about the chart polytope (if any) to a given file.

Parameters
fThe file where to store the polytope information.
mpThe chart with the polytope to save.

Definition at line 1187 of file cpolytope.c.

References Tcpolytope::bb, Tcpolytope::emptyPolytope, Tcpolytope::expandible, Tcpolytope::face, Tcpolytope::freeVertex, Tcpolytope::ID, Tcpolytope::indices, Tcpolytope::k, Tcpolytope::maxFaces, Tcpolytope::maxIndices, Tcpolytope::maxVertices, Tcpolytope::nExpandible, Tcpolytope::nFaces, Tcpolytope::nIndices, Tcpolytope::nVertices, Tcpolytope::open, PrintBox(), Tcpolytope::r, Tcpolytope::v, and Tcpolytope::vertex.

Referenced by SaveChart().

void LoadPolytope ( FILE *  f,
Tcpolytope mp 
)

Initializes the information about the chart polytope (if any) from a given file.

Parameters
fThe file from where to read the polytope information.
mpThe chart with the polytope to initialize.

Definition at line 1252 of file cpolytope.c.

References Tcpolytope::bb, Tcpolytope::emptyPolytope, Tcpolytope::expandible, Tcpolytope::face, Tcpolytope::freeVertex, Tcpolytope::ID, Tcpolytope::indices, Tcpolytope::k, Tcpolytope::maxFaces, Tcpolytope::maxIndices, Tcpolytope::maxVertices, NEW, Tcpolytope::nExpandible, Tcpolytope::nFaces, Tcpolytope::nIndices, NO_UINT, Tcpolytope::nVertices, Tcpolytope::open, Tcpolytope::r, ReadBox(), Tcpolytope::v, and Tcpolytope::vertex.

Referenced by LoadChart().

void PrintPolytopeInfo ( Tcpolytope mp)