| 44 | 
  | 
 * | 
| 45 | 
  | 
 *  Created by Charles F. Vardeman II on 11 Dec 2006. | 
| 46 | 
  | 
 *  @author  Charles F. Vardeman II | 
| 47 | 
< | 
 *  @version $Id: ConvexHull.cpp,v 1.6 2008-05-14 14:31:48 chuckv Exp $ | 
| 47 | 
> | 
 *  @version $Id: ConvexHull.cpp,v 1.7 2008-06-18 17:03:30 chuckv Exp $ | 
| 48 | 
  | 
 * | 
| 49 | 
  | 
 */ | 
| 50 | 
  | 
 | 
| 75 | 
  | 
typedef CGAL::Simple_cartesian<RT>                K; | 
| 76 | 
  | 
typedef CGAL::Convex_hull_traits_3<K>             Traits; | 
| 77 | 
  | 
typedef Traits::Polyhedron_3                      Polyhedron_3; | 
| 78 | 
< | 
typedef K::Point_3                                Point; | 
| 78 | 
> | 
typedef K::Point_3                                Point_3; | 
| 79 | 
  | 
 | 
| 80 | 
  | 
 | 
| 81 | 
  | 
ConvexHull::ConvexHull(){} | 
| 83 | 
  | 
bool ConvexHull::genHull(std::vector<Vector3d> pos) | 
| 84 | 
  | 
{ | 
| 85 | 
  | 
   | 
| 86 | 
< | 
  std::vector<Point> points;     | 
| 86 | 
> | 
  std::vector<Point_3> points;   | 
| 87 | 
  | 
   | 
| 88 | 
  | 
   | 
| 89 | 
  | 
  // Copy the positon vector into a points vector for cgal. | 
| 90 | 
  | 
  for (int i = 0; i < pos.size(); ++i) | 
| 91 | 
  | 
    { | 
| 92 | 
< | 
      Point pt(pos[i][0],pos[i][1],pos[i][2]); | 
| 92 | 
> | 
      Point_3 pt(pos[i][0],pos[i][1],pos[i][2]); | 
| 93 | 
  | 
      points.push_back(pt); | 
| 94 | 
  | 
    } | 
| 95 | 
  | 
   | 
| 96 | 
  | 
  // define object to hold convex hull | 
| 97 | 
< | 
  Polyhedron_3 ch_object_; | 
| 97 | 
> | 
  CGAL::Object ch_object_; | 
| 98 | 
> | 
  Polyhedron_3 polyhedron; | 
| 99 | 
> | 
 | 
| 100 | 
  | 
  // compute convex hull | 
| 101 | 
+ | 
  std::cerr << "Creating hull" << std::endl; | 
| 102 | 
  | 
  CGAL::convex_hull_3(points.begin(), points.end(), ch_object_); | 
| 103 | 
< | 
   | 
| 104 | 
< | 
  for (Polyhedron_3::Vertex_iterator v = ch_object_.vertices_begin(); ch_object_.vertices_end(); ++v){ | 
| 103 | 
> | 
  std::cerr << "Done Creating hull" << std::endl; | 
| 104 | 
> | 
  std::vector<Point_3>::const_iterator p_it; | 
| 105 | 
> | 
 | 
| 106 | 
> | 
  for (p_it = points.begin(); p_it != points.end(); p_it++) | 
| 107 | 
> | 
    { | 
| 108 | 
> | 
      std::cerr << (*p_it).x() << std::endl; | 
| 109 | 
> | 
    } | 
| 110 | 
> | 
 | 
| 111 | 
> | 
  /* | 
| 112 | 
> | 
  for (Polyhedron_3::Vertex_iterator v = ch_object_.vertices_begin();  | 
| 113 | 
> | 
       ch_object_.vertices_end(); ++v){ | 
| 114 | 
  | 
    std::cout<< v.point()<<std::endl; | 
| 115 | 
  | 
  } | 
| 116 | 
< | 
   | 
| 105 | 
< | 
   | 
| 116 | 
> | 
  */ | 
| 117 | 
  | 
} | 
| 118 | 
  | 
 | 
| 119 | 
  | 
 |