Go to the documentation of this file.00001 #ifndef H_LASER_DATA_INLINE
00002 #define H_LASER_DATA_INLINE
00003
00004 #include <gsl/gsl_math.h>
00005 #include <gsl/gsl_vector.h>
00006
00007 #include "csm.h"
00008
00009
00010
00011
00012
00013 INLINE int ld_valid_ray(LDP ld, int i) {
00014 return (i>=0) && (i<ld->nrays) && (ld->valid[i]);
00015 }
00016
00017 INLINE int ld_valid_alpha(LDP ld, int i) {
00018 return ld->alpha_valid[i] != 0;
00019 }
00020
00021 INLINE void ld_set_null_correspondence(LDP ld, int i) {
00022 ld->corr[i].valid = 0;
00023 ld->corr[i].j1 = -1;
00024 ld->corr[i].j2 = -1;
00025 ld->corr[i].dist2_j1 = GSL_NAN;
00026 }
00027
00028 INLINE void ld_set_correspondence(LDP ld, int i, int j1, int j2) {
00029 ld->corr[i].valid = 1;
00030 ld->corr[i].j1 = j1;
00031 ld->corr[i].j2 = j2;
00032 }
00033
00036 INLINE int ld_next_valid(LDP ld, int i, int dir) {
00037 int j;
00038 for(j=i+dir;(j<ld->nrays)&&(j>=0)&&!ld_valid_ray(ld,j);j+=dir);
00039 return ld_valid_ray(ld,j) ? j : -1;
00040 }
00041
00042 INLINE int ld_next_valid_up(LDP ld, int i){
00043 return ld_next_valid(ld, i, +1);
00044 }
00045
00046 INLINE int ld_next_valid_down(LDP ld, int i){
00047 return ld_next_valid(ld, i, -1);
00048 }
00049
00050
00051 INLINE int ld_valid_corr(LDP ld, int i) {
00052 return ld->corr[i].valid;
00053 }
00054
00055 #endif
00056