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 
31 #define ADJUST_SR 0
32 
38 #define INIT_NUM_FACES 10
39 
61 typedef struct {
62  unsigned int k;
63  double r;
65  double sr;
66  double lsr;
69  double msr;
70  double v;
72  unsigned int nFaces;
73  unsigned int maxFaces;
74  double **face;
76  unsigned int *ID;
77 } Tscpolytope;
78 
79 
95 void InitEmptySPolytope(double delta,unsigned int k,double r,double sr,Tscpolytope *mp);
96 
106 void DefineSPolytope(Tscpolytope *mp);
107 
118 void CopySPolytope(Tscpolytope *mp_dst,Tscpolytope *mp_src);
119 
137 void CutSPolytope(double *t,double r,unsigned int id,Tscpolytope *mp);
138 
160 void CutSPolytopeWithFace(double *t,double offset,unsigned int id,Tscpolytope *mp);
161 
162 
175 boolean InsideSPolytope(double *t,Tscpolytope *mp);
176 
190 unsigned int DetermineSPolytopeNeighbour(double epsilon,double *t,Tscpolytope *mp);
191 
201 void EnlargeSPolytope(double *t,Tscpolytope *mp);
202 
212 double GetSPolytopeRadius(Tscpolytope *mp);
213 
229 double GetSPolytopeBoxSide(Tscpolytope *mp);
230 
240 unsigned int GetSPolytopeDim(Tscpolytope *mp);
241 
251 unsigned int GetSPolytopeNFaces(Tscpolytope *mp);
252 
267 void GetSPolytopeFace(unsigned int n,double *f,Tscpolytope *mp);
268 
290 boolean SPolytopeRandomPointOnBoundary(double rSample,double *t,Tscpolytope *mp);
291 
307 boolean RandomPointInSPolytope(double scale,double *t,Tscpolytope *mp);
308 
319 
333 
345 
358 double SPolytopeMaxVolume(Tscpolytope *mp);
359 
372 double SPolytopeVolume(Tscpolytope *mp);
373 
387 unsigned int SPolytopeNumNeighbours(Tscpolytope *mp);
388 
404 unsigned int SPolytopeNeighbourID(unsigned int n,Tscpolytope *mp);
405 
415 unsigned int SPolytopeMemSize(Tscpolytope *mp);
416 
428 void SaveSPolytope(FILE *f,Tscpolytope *mp);
429 
441 void LoadSPolytope(FILE *f,Tscpolytope *mp);
442 
452 void DeleteSPolytope(Tscpolytope *mp);
453 
454 #endif
Definition of the boolean type.
double v
Definition: scpolytope.h:70
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:74
double lsr
Definition: scpolytope.h:66
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:332
double SPolytopeMaxVolume(Tscpolytope *mp)
Maximum volume of the simple polytope.
Definition: scpolytope.c:304
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:355
A simpleifed polytope associated with chart on a manifold.
Definition: scpolytope.h:61
unsigned int * ID
Definition: scpolytope.h:76
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:72
void DeleteSPolytope(Tscpolytope *mp)
Deletes the structure allocated by DefineSPolytope.
Definition: scpolytope.c:415
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:62
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:69
unsigned int SPolytopeMemSize(Tscpolytope *mp)
Computes the memory used by the polytope.
Definition: scpolytope.c:345
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:381
boolean InsideSPolytope(double *t, Tscpolytope *mp)
Identifies points inside a chart simple polytope.
Definition: scpolytope.c:88
unsigned int maxFaces
Definition: scpolytope.h:73
void SPolytopeIncreaseSamplingRadius(Tscpolytope *mp)
Increases the sampling radius.
Definition: scpolytope.c:286
void SPolytopeDecreaseSamplingRadius(Tscpolytope *mp)
Decreases the sampling radious.
Definition: scpolytope.c:295
double sr
Definition: scpolytope.h:65
double SPolytopeVolume(Tscpolytope *mp)
Volume of the simple polytope.
Definition: scpolytope.c:309
double r
Definition: scpolytope.h:63
unsigned int SPolytopeNeighbourID(unsigned int n, Tscpolytope *mp)
Returns the identifier of one of the neighbours of a polytope.
Definition: scpolytope.c:337