samples.h
Go to the documentation of this file.
1 #ifndef SAMPLESH
2 #define SAMPLESH
3 
4 #include "chart.h"
5 #include "parameters.h"
6 #include "link.h"
7 #include "filename.h"
8 
28 #define INIT_NUM_SAMPLES 100
29 
37 #define PATH_NODES 1
38 
39 
47 #define SMOOTH_RANDOM 0
48 
57 #define SMOOTH_GRADIENT 1
58 
59 
67 #define SMOOTH_SHORTCUT 2
68 
79 #define SMOOTH_EFFORT 3
80 
90 #define SMOOTH_DISPERSION 4
91 
102 #define DEFAULT_CONNECT ConnectSamplesChart
103 
117 #define KINEMATIC_SUBSPACE 0
118 
183 typedef double (*TStepCost)(Tparameters *,unsigned int *,
184  boolean *,
185  unsigned int,
186  double *,double *,double *,
187  unsigned int,
188  Tchart*,Tchart *,Tchart *,Tworld *);
189 
235 typedef boolean (*TStepCostGradient)(Tparameters *,unsigned int *,
236  boolean *,unsigned int,
237  double *,double *,double *,double *,double *,
238  Tchart *,Tchart *,Tchart *,Tchart *,Tchart *,
240  double *,Tworld *);
241 
252 void InitSamples(unsigned int *ms,unsigned int *ns,double ***path);
253 
280 void SmoothSamples(Tparameters *pr,boolean parallel,int mode,
281  unsigned int maxIterations,
282  unsigned int ns,double **path,
283  unsigned int *sns,double ***spath,TAtlasBase *w);
284 
298 void ConcatSamples(unsigned int nvs,
299  unsigned int ns1,double **path1,
300  unsigned int ns2,double **path2,
301  unsigned int *ns,double ***path);
302 
318 void ReverseConcatSamples(unsigned int nvs,
319  unsigned int ns1,double **path1,
320  unsigned int ns2,double **path2,
321  unsigned int *ns,double ***path);
322 
331 void ReverseSamples(unsigned int ns,double **path);
332 
349 void AddSample2Samples(unsigned int nv,double *sample,
350  unsigned int nvs,boolean *systemVars,
351  unsigned int *ms,unsigned int *ns,double ***path);
352 
408 double ConnectSamplesChart(Tparameters *pr,unsigned int *tp,
409  boolean *sv,Tbox *domain,
410  unsigned int m,unsigned int n,
411  double *s1,double *s2,
412  double md,boolean checkCollisions,
413  TJacobian *sJ,
414  boolean *reached,boolean *collision,double *lastSample,
415  unsigned int *ns,double ***path,
416  TAtlasBase *w);
417 
464 double ConnectSamples(Tparameters *pr,unsigned int *tp,
465  boolean *sv,Tbox *domain,
466  unsigned int m,unsigned int n,
467  double *s1,double *s2,
468  double md,boolean checkCollisions,
469  TJacobian *sJ,
470  boolean *reached,boolean *collision,double *lastSample,
471  unsigned int *ns,double ***path,
472  TAtlasBase *w);
473 
490 double PathLength(unsigned int *tp,
491  boolean *sv,unsigned int m,
492  unsigned int np,double **point);
493 
519 double PathEffort(Tparameters *p,
520  unsigned int m,unsigned int np,double **point,
521  Tworld *w);
522 
541 unsigned int ReadOneSample(Tparameters *p,char *fname,unsigned int nvs,double **s);
542 
562 unsigned int ReadTwoSamples(Tparameters *p,char *fname,unsigned int nvs,double **s1,double **s2);
563 
576 void SaveSamples(char *fname,char *suffix,unsigned int nvs,
577  unsigned int ns,double **path);
578 
594 void SaveSamplesN(char *fname,boolean smooth,unsigned int n,unsigned int nvs,
595  unsigned int ns,double **path);
608 /*boolean LoadSamples(char *fname,boolean smooth,unsigned int *nvs,
609  unsigned int *ns,double ***path);*/
610 
611 boolean LoadSamples(Tfilename *fname,unsigned int *nvs,
612  unsigned int *ns,double ***path);
613 
614 
632 void PlotSamples(Tparameters *p,Tplot3d *p3d,
633  unsigned int xID,unsigned int yID,unsigned int zID,
634  unsigned int ns,double **path);
635 
656 void PlotForceField(Tparameters *p,Tplot3d *p3d,
657  unsigned int xID,unsigned int yID,unsigned int zID,
658  Tworld *w,
659  unsigned int ns,double **sols);
660 
669 void DeleteSamples(unsigned int ns,double **path);
670 
671 #endif
double ConnectSamplesChart(Tparameters *pr, unsigned int *tp, boolean *sv, Tbox *domain, unsigned int m, unsigned int n, double *s1, double *s2, double md, boolean checkCollisions, TJacobian *sJ, boolean *reached, boolean *collision, double *lastSample, unsigned int *ns, double ***path, TAtlasBase *w)
Determines the connection between two points on the manifold.
Definition: samples.c:694
boolean(* TStepCostGradient)(Tparameters *, unsigned int *, boolean *, unsigned int, double *, double *, double *, double *, double *, Tchart *, Tchart *, Tchart *, Tchart *, Tchart *, TJacobian *, TStepCost, double *, Tworld *)
Template of step cost gradients.
Definition: samples.h:235
Data structure to hold the information about the name of a file.
Definition: filename.h:271
double(* TStepCost)(Tparameters *, unsigned int *, boolean *, unsigned int, double *, double *, double *, unsigned int, Tchart *, Tchart *, Tchart *, Tworld *)
Template of step costs.
Definition: samples.h:183
double PathEffort(Tparameters *p, unsigned int m, unsigned int np, double **point, Tworld *w)
Approximated control effort of a path.
Definition: samples.c:1708
Definition of the Tfilename type and the associated functions.
All the necessary information to generate equations for mechanisms.
Definition: world.h:229
void SaveSamples(char *fname, char *suffix, unsigned int nvs, unsigned int ns, double **path)
Saves a set of samples to a file.
Definition: samples.c:2879
A chart on a manifold.
Definition: chart.h:70
void ReverseConcatSamples(unsigned int nvs, unsigned int ns1, double **path1, unsigned int ns2, double **path2, unsigned int *ns, double ***path)
Reverses and concats a path.
Definition: samples.c:2727
void SmoothSamples(Tparameters *pr, boolean parallel, int mode, unsigned int maxIterations, unsigned int ns, double **path, unsigned int *sns, double ***spath, TAtlasBase *w)
Path smoothing.
Definition: samples.c:2541
A 3D plot.
Definition: plot3d.h:54
void AddSample2Samples(unsigned int nv, double *sample, unsigned int nvs, boolean *systemVars, unsigned int *ms, unsigned int *ns, double ***path)
Adds a sample to a set of samples.
Definition: samples.c:672
boolean LoadSamples(Tfilename *fname, unsigned int *nvs, unsigned int *ns, double ***path)
Reads a set of samples from file.
Definition: samples.c:2913
unsigned int ReadTwoSamples(Tparameters *p, char *fname, unsigned int nvs, double **s1, double **s2)
Reads two samples from a file.
Definition: samples.c:2803
void PlotSamples(Tparameters *p, Tplot3d *p3d, unsigned int xID, unsigned int yID, unsigned int zID, unsigned int ns, double **path)
Plots a 3D projection of a path.
Definition: samples.c:2960
A table of parameters.
Type defining the equations on which the atlas is defined.
Definition: wcs.h:30
Definition of a local chart on a manifold.
A box.
Definition: box.h:83
double ConnectSamples(Tparameters *pr, unsigned int *tp, boolean *sv, Tbox *domain, unsigned int m, unsigned int n, double *s1, double *s2, double md, boolean checkCollisions, TJacobian *sJ, boolean *reached, boolean *collision, double *lastSample, unsigned int *ns, double ***path, TAtlasBase *w)
Determines the connection between two points on the manifold.
Definition: samples.c:966
void ReverseSamples(unsigned int ns, double **path)
Reverses a set of samples.
Definition: samples.c:2752
void InitSamples(unsigned int *ms, unsigned int *ns, double ***path)
Initializes a set of samples.
Definition: samples.c:665
The Jacobian of a set of equations.
Definition: jacobian.h:23
unsigned int boolean
Boolean type.
Definition: boolean.h:13
void SaveSamplesN(char *fname, boolean smooth, unsigned int n, unsigned int nvs, unsigned int ns, double **path)
Saves a set of samples to a file.
Definition: samples.c:2894
void DeleteSamples(unsigned int ns, double **path)
Deletes the space used by a set of samples.
Definition: samples.c:3159
Definition of the Tparameters type and the associated functions.
void PlotForceField(Tparameters *p, Tplot3d *p3d, unsigned int xID, unsigned int yID, unsigned int zID, Tworld *w, unsigned int ns, double **sols)
Plots the force-field on a set of points.
Definition: samples.c:3056
double PathLength(unsigned int *tp, boolean *sv, unsigned int m, unsigned int np, double **point)
Length of a path formed by a set of samples.
Definition: samples.c:1096
unsigned int ReadOneSample(Tparameters *p, char *fname, unsigned int nvs, double **s)
Reads one sample from a file.
Definition: samples.c:2772
void ConcatSamples(unsigned int nvs, unsigned int ns1, double **path1, unsigned int ns2, double **path2, unsigned int *ns, double ***path)
Concats two path.
Definition: samples.c:2706