USML
seq_rayfan.h
1 
5 #ifndef USML_TYPES_SEQ_RAYFAN_H
6 #define USML_TYPES_SEQ_RAYFAN_H
7 
8 #include <usml/types/seq_data.h>
9 
10 namespace usml {
11 namespace types {
14 
29 class USML_DECLSPEC seq_rayfan: public seq_data
30 {
31 public:
42  seq_rayfan( value_type first=-90.0, value_type last=90.0,
43  size_type size=181, value_type center=0.0, value_type spread=6.0 )
44  : seq_data(size)
45  {
46  // garuntees that the smallest values is first and goes up to the largest value
47  if( first > last ) {
48  _value = first ;
49  first = last ;
50  last = _value ;
51  }
52 
53  _index = 0 ;
54  _value = first ;
55  _index_data = first ;
56  _sign = 1.0;
57 
58  const double first_ang = atan( (first-center)/spread ) ;
59  const double last_ang = atan( (last-center)/spread ) ;
60  const double scale = (last_ang - first_ang) / (size - 1);
61 
62  for ( size_type n=0; n < size; ++n ) {
63  const double x = first_ang + scale * n ;
64  _data[n] = center + tan(x) * spread ;
65  if ( n > 0 ) {
66  _increment[n-1] = _data[n] - _data[n-1];
67  _increment[n] = _increment[n-1] ;
68  }
69  }
70  }
71 
72 }; // end of class
73 
75 } // end of namespace types
76 } // end of namespace usml
77 
78 #endif
Defines a sequence of values that are tangentially spaced.
Definition: seq_rayfan.h:29
BOOST_UBLAS_INLINE matrix_unary1_traits< E, scalar_tan< typename E::value_type > >::result_type tan(const matrix_expression< E > &e)
Tangent of a matrix.
Definition: matrix_math.h:380
BOOST_UBLAS_INLINE matrix_unary1_traits< E, scalar_atan< typename E::value_type > >::result_type atan(const matrix_expression< E > &e)
Inverse tangent of a matrix.
Definition: matrix_math.h:461
Sequence defined by an unevenly spaced vector of points.
Definition: seq_data.h:28
seq_rayfan(value_type first=-90.0, value_type last=90.0, size_type size=181, value_type center=0.0, value_type spread=6.0)
Construct sequence of tangentially spaced angles using first value, last value, size, and center.
Definition: seq_rayfan.h:42
vector< value_type >::size_type size_type
Definition: seq_vector.h:44
double value_type
Definition: seq_vector.h:43