~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/geomstat/state/state_geom.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/sysfuncs.h>
  7 #include <tina/math.h>
  8 #include <tina/mathfuncs.h>
  9 #include <tina/vision.h>
 10 #include <tina/visionfuncs.h>
 11 
 12 Bool    state_badpair(State * state, int i1, int i2)
 13 {
 14     if (state == NULL)
 15     {
 16         error("state_badpair: null state", non_fatal);
 17         return (true);
 18     }
 19     if (i1 < 0 || i1 >= state->maxindex || i2 < 0 || i2 >= state->maxindex)
 20     {
 21         error("state_badpair: index out of range", non_fatal);
 22         return (true);
 23     }
 24     return (false);
 25 }
 26 
 27 
 28 double  state_angle(State * state, int i1, int i2)
 29 {
 30     int     type1, type2;
 31     void   *geom1, *geom2;
 32 
 33     if (state_badpair(state, i1, i2))
 34         return (1e10);
 35 
 36     type1 = vector_get(state->type, i1);
 37     type2 = vector_get(state->type, i2);
 38     geom1 = vector_getp(state->geom, i1);
 39     geom2 = vector_getp(state->geom, i2);
 40 
 41     return (geom_angle(geom1, type1, geom2, type2));
 42 }
 43 
 44 double  state_dist(State * state, int i1, int i2)
 45 {
 46     int     type1, type2;
 47     void   *geom1, *geom2;
 48 
 49     if (state == NULL)
 50     {
 51         error("state_dist: null state", non_fatal);
 52         return (1e10);
 53     }
 54     if (i1 < 0 || i1 >= state->maxindex || i2 < 0 || i2 >= state->maxindex)
 55     {
 56         error("state_dist: index out of range", non_fatal);
 57         return (1e10);
 58     }
 59     type1 = vector_get(state->type, i1);
 60     type2 = vector_get(state->type, i2);
 61     geom1 = vector_getp(state->geom, i1);
 62     geom2 = vector_getp(state->geom, i2);
 63 
 64     return (geom_dist(geom1, type1, geom2, type2));
 65 }
 66 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.