1 #ifndef bwm_algo_t_
2 #define bwm_algo_t_
3 
4 #include <vector>
5 #include <iostream>
6 #include <list>
7 #include <vgl/vgl_point_3d.h>
8 #include <vgl/vgl_vector_3d.h>
9 #include <vgl/vgl_homg_point_2d.h>
10 
11 #include <vsol/vsol_point_3d_sptr.h>
12 #include <vsol/vsol_polygon_2d_sptr.h>
13 #include <vsol/vsol_polygon_3d_sptr.h>
14 #include <vsol/vsol_polyline_2d_sptr.h>
15 
16 #include <vpgl/vpgl_rational_camera.h>
17 
18 #include <vil/vil_image_resource_sptr.h>
19 
20 #ifdef _MSC_VER
21 #  include <vcl_msvc_warnings.h>
22 #endif
23 
24 class bwm_algo
25 {
26  public:
27   static void get_vertices_xy(vsol_polygon_2d_sptr poly2d, float **x, float **y);
28 
29   static void get_vertices_xy(vsol_polygon_2d_sptr poly2d, double **x, double **y);
30 
31   static void get_vertices_xy(vsol_polyline_2d_sptr poly2d, float **x, float **y);
32 
33   static void get_vertices_xyz(vsol_polygon_3d_sptr poly3d, double **x, double **y, double **z);
34 
35   static vsol_polygon_3d_sptr move_points_to_plane(vsol_polygon_3d_sptr polygon);
36 
37   static vsol_polygon_3d_sptr move_points_to_plane(std::vector<vsol_point_3d_sptr> points);
38 
39 
40   static vgl_point_3d<double> fit_sphere_to_corner(vgl_point_3d<double> P1, vgl_vector_3d<double> N1,
41                                                    vgl_point_3d<double> P2, vgl_vector_3d<double> N2,
42                                                    vgl_point_3d<double> P3, vgl_vector_3d<double> N3,
43                                                    double r);
44 
45   static bool find_intersection_points(vgl_homg_point_2d<double> img_point1,
46                                        vgl_homg_point_2d<double> img_point2,
47                                        vsol_polygon_3d_sptr poly3d,
48                                        vgl_point_3d<double>& point1,
49                                        vgl_point_3d<double>& l1, vgl_point_3d<double>& l2,
50                                        vgl_point_3d<double>& point2,
51                                        vgl_point_3d<double>& l3, vgl_point_3d<double>& l4);
52 
53   static vpgl_rational_camera<double>* extract_nitf_camera(vil_image_resource_sptr img);
54   static vpgl_rational_camera<double>* extract_nitf_camera(std::string img_path);
55 
56   static bool fit_circle(const std::list<vgl_point_2d<double> > &points,
57                          double &radius, vgl_point_2d<double> &center);
58 };
59 
60 #endif
61