Go to the documentation of this file.00001
00002 #ifndef bsta_kent_h_
00003 #define bsta_kent_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "bsta_distribution.h"
00016 #include <vnl/vnl_vector_fixed.h>
00017 #include <vnl/vnl_matrix_fixed.h>
00018 #if 0
00019 #include <vgl/vgl_plane_3d.h>
00020 #endif
00021 #include <vsl/vsl_binary_io.h>
00022 #include <vcl_vector.h>
00023 #include <vcl_iostream.h>
00024
00025 template <class T>
00026 class bsta_kent
00027 {
00028 public:
00029
00030 bsta_kent()
00031 : kappa_(0), beta_(0), gamma1_(vnl_vector_fixed<T,3>(0,0,0)),
00032 gamma2_(vnl_vector_fixed<T,3>(0,0,0)), gamma3_(vnl_vector_fixed<T,3>(0,0,0)) {}
00033
00034 bsta_kent(T kappa, T beta, vnl_vector_fixed<T,3> const& gamma1,
00035 vnl_vector_fixed<T,3> const& gamma2, vnl_vector_fixed<T,3> const& gamma3)
00036 : kappa_(kappa), beta_(beta), gamma1_(gamma1), gamma2_(gamma2), gamma3_(gamma3) {}
00037
00038 int version() const { return 1; }
00039
00040 #if 0
00041
00042 bsta_kent(vcl_vector<vgl_plane_3d<T> > const& planes);
00043 #endif
00044
00045
00046 bsta_kent(vnl_matrix_fixed<T,3,3> const& m);
00047
00048 ~bsta_kent() {}
00049
00050 T kappa() const { return kappa_; }
00051 T beta() const { return beta_; }
00052 vnl_vector_fixed<T,3> minor_axis() const { return gamma1_; }
00053 vnl_vector_fixed<T,3> major_axis() const { return gamma2_; }
00054 vnl_vector_fixed<T,3> mean_direction() const { return gamma3_; }
00055
00056
00057 bool unimodal() const { return kappa_/beta_ >= T(2); }
00058
00059
00060 T prob_density(vnl_vector_fixed<T,3> const& x);
00061
00062 vnl_vector_fixed<T,3> mean() const { return gamma1_; }
00063
00064 private:
00065 T kappa_;
00066 T beta_;
00067 vnl_vector_fixed<T,3> gamma1_;
00068 vnl_vector_fixed<T,3> gamma2_;
00069 vnl_vector_fixed<T,3> gamma3_;
00070
00071
00072 T normalizing_const(T kappa=0, T beta=0);
00073 };
00074
00075 template <class T>
00076 void vsl_b_write(vsl_b_ostream & os, bsta_kent<T> const& b);
00077
00078 template <class T>
00079 void vsl_b_write(vsl_b_ostream & os, bsta_kent<T> const* &b);
00080
00081 template <class T>
00082 void vsl_b_read(vsl_b_istream & is, bsta_kent<T> &b);
00083
00084 template <class T>
00085 void vsl_b_read(vsl_b_istream & is, bsta_kent<T> *&b);
00086
00087 template <class T>
00088 vcl_ostream& operator<< (vcl_ostream& os, bsta_kent<T> & b);
00089
00090 #endif