scpolytope.h
Go to the documentation of this file.
1 #ifndef SCPOLYTOPE
2 #define SCPOLYTOPE
3 
4 #include "boolean.h"
5 #include "box.h"
6 
22 #define INIT_NUM_FACES 10
23 
45 typedef struct {
46  unsigned int k;
47  double r;
49  double sr;
50  double lsr;
53  double msr;
54  double v;
56  unsigned int nFaces;
57  unsigned int maxFaces;
58  double **face;
60  unsigned int *ID;
61 } Tscpolytope;
62 
63 
79 void InitEmptySPolytope(double delta,unsigned int k,double r,double sr,Tscpolytope *mp);
80 
91 
102 void CopySPolytope(Tscpolytope *mp_dst,Tscpolytope *mp_src);
103 
121 void CutSPolytope(double *t,double r,unsigned int id,Tscpolytope *mp);
122 
144 void CutSPolytopeWithFace(double *t,double offset,unsigned int id,Tscpolytope *mp);
145 
146 
159 boolean InsideSPolytope(double *t,Tscpolytope *mp);
160 
174 unsigned int DetermineSPolytopeNeighbour(double epsilon,double *t,Tscpolytope *mp);
175 
185 void EnlargeSPolytope(double *t,Tscpolytope *mp);
186 
196 double GetSPolytopeRadius(Tscpolytope *mp);
197 
213 double GetSPolytopeBoxSide(Tscpolytope *mp);
214 
224 unsigned int GetSPolytopeDim(Tscpolytope *mp);
225 
235 unsigned int GetSPolytopeNFaces(Tscpolytope *mp);
236 
251 void GetSPolytopeFace(unsigned int n,double *f,Tscpolytope *mp);
252 
274 boolean SPolytopeRandomPointOnBoundary(double rSample,double *t,Tscpolytope *mp);
275 
291 boolean RandomPointInSPolytope(double scale,double *t,Tscpolytope *mp);
292 
303 
317 
329 
342 double SPolytopeMaxVolume(Tscpolytope *mp);
343 
356 double SPolytopeVolume(Tscpolytope *mp);
357 
371 unsigned int SPolytopeNumNeighbours(Tscpolytope *mp);
372 
388 unsigned int SPolytopeNeighbourID(unsigned int n,Tscpolytope *mp);
389 
399 unsigned int SPolytopeMemSize(Tscpolytope *mp);
400 
412 void SaveSPolytope(FILE *f,Tscpolytope *mp);
413 
425 void LoadSPolytope(FILE *f,Tscpolytope *mp);
426 
436 void DeleteSPolytope(Tscpolytope *mp);
437 
438 #endif
Definition of the boolean type.
double v
Definition: scpolytope.h:54
void EnlargeSPolytope(double *t, Tscpolytope *mp)
Ensures that a polytompe includes a given point.
Definition: scpolytope.c:170
void CopySPolytope(Tscpolytope *mp_dst, Tscpolytope *mp_src)
Copies the simplified polytope from one chart to another.
Definition: scpolytope.c:54
double ** face
Definition: scpolytope.h:58
double lsr
Definition: scpolytope.h:50
boolean RandomPointInSPolytope(double scale, double *t, Tscpolytope *mp)
Random point on the polytope with uniform distribution.
Definition: scpolytope.c:262
boolean SPolytopeRandomPointOnBoundary(double rSample, double *t, Tscpolytope *mp)
Random point on the boundary of the chart.
Definition: scpolytope.c:255
double GetSPolytopeBoxSide(Tscpolytope *mp)
Returns the size of the box side.
Definition: scpolytope.c:234
void CutSPolytopeWithFace(double *t, double offset, unsigned int id, Tscpolytope *mp)
Cuts a simple polytope with a given plane.
Definition: scpolytope.c:199
double GetSPolytopeRadius(Tscpolytope *mp)
Returns the simple polytope radius.
Definition: scpolytope.c:229
void DefineSPolytope(Tscpolytope *mp)
Initial definition of the simple polytope bounding the local chart.
Definition: scpolytope.c:43
unsigned int SPolytopeNumNeighbours(Tscpolytope *mp)
Number of neighbours of the simple polytope.
Definition: scpolytope.c:328
double SPolytopeMaxVolume(Tscpolytope *mp)
Maximum volume of the simple polytope.
Definition: scpolytope.c:300
void CutSPolytope(double *t, double r, unsigned int id, Tscpolytope *mp)
Crops the polytope bounding chart with a plane.
Definition: scpolytope.c:186
void SaveSPolytope(FILE *f, Tscpolytope *mp)
Saves the chart polytope to a file.
Definition: scpolytope.c:351
A simpleifed polytope associated with chart on a manifold.
Definition: scpolytope.h:45
unsigned int * ID
Definition: scpolytope.h:60
Definition of the Tbox type and the associated functions.
double SPolytopeGetSamplingRadius(Tscpolytope *mp)
Returns the current sampling radius.
Definition: scpolytope.c:281
unsigned int nFaces
Definition: scpolytope.h:56
void DeleteSPolytope(Tscpolytope *mp)
Deletes the structure allocated by DefineSPolytope.
Definition: scpolytope.c:411
void InitEmptySPolytope(double delta, unsigned int k, double r, double sr, Tscpolytope *mp)
Defines an empty chart simplieifed polytope.
Definition: scpolytope.c:21
void GetSPolytopeFace(unsigned int n, double *f, Tscpolytope *mp)
Gets a face.
Definition: scpolytope.c:249
unsigned int GetSPolytopeNFaces(Tscpolytope *mp)
Number of faces of a simple chart polytope.
Definition: scpolytope.c:244
unsigned int k
Definition: scpolytope.h:46
unsigned int DetermineSPolytopeNeighbour(double epsilon, double *t, Tscpolytope *mp)
Identifes the neighbour containing a given point.
Definition: scpolytope.c:105
double msr
Definition: scpolytope.h:53
unsigned int SPolytopeMemSize(Tscpolytope *mp)
Computes the memory used by the polytope.
Definition: scpolytope.c:341
unsigned int GetSPolytopeDim(Tscpolytope *mp)
Returns the simple polytope dimensionality.
Definition: scpolytope.c:239
void LoadSPolytope(FILE *f, Tscpolytope *mp)
Reads the chart polytope from a file.
Definition: scpolytope.c:377
boolean InsideSPolytope(double *t, Tscpolytope *mp)
Identifies points inside a chart simple polytope.
Definition: scpolytope.c:88
unsigned int maxFaces
Definition: scpolytope.h:57
void SPolytopeIncreaseSamplingRadius(Tscpolytope *mp)
Increases the sampling radius.
Definition: scpolytope.c:286
void SPolytopeDecreaseSamplingRadius(Tscpolytope *mp)
Decreases the sampling radious.
Definition: scpolytope.c:293
double sr
Definition: scpolytope.h:49
double SPolytopeVolume(Tscpolytope *mp)
Volume of the simple polytope.
Definition: scpolytope.c:305
double r
Definition: scpolytope.h:47
unsigned int SPolytopeNeighbourID(unsigned int n, Tscpolytope *mp)
Returns the identifier of one of the neighbours of a polytope.
Definition: scpolytope.c:333