mirror of https://github.com/CGAL/cgal
Improve the API of <CGAL/Mesh_3/polylines_to_protect.h>
Now the word type and the null functor are passed as parameters.
This commit is contained in:
parent
ee0fb3b23a
commit
4d38c931ce
|
|
@ -42,7 +42,7 @@ namespace CGAL {
|
|||
*/
|
||||
template<class Image,
|
||||
class BGT,
|
||||
typename Image_word_type = unsigned char,
|
||||
typename Image_word_type_ = unsigned char,
|
||||
typename Subdomain_index = int,
|
||||
class Null_subdomain_index = Default,
|
||||
class Wrapper_ = Default >
|
||||
|
|
@ -51,7 +51,7 @@ class Labeled_image_mesh_domain_3
|
|||
<typename Default::Get
|
||||
<Wrapper_,
|
||||
Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
|
||||
Image_word_type,
|
||||
Image_word_type_,
|
||||
Subdomain_index>
|
||||
>::type,
|
||||
BGT,
|
||||
|
|
@ -59,6 +59,7 @@ class Labeled_image_mesh_domain_3
|
|||
>
|
||||
{
|
||||
public:
|
||||
typedef Image_word_type_ Image_word_type;
|
||||
typedef typename Default::Get
|
||||
<Wrapper_,
|
||||
Mesh_3::Image_to_labeled_function_wrapper<Image, BGT,
|
||||
|
|
|
|||
|
|
@ -28,15 +28,20 @@
|
|||
#include <CGAL/internal/Mesh_3/split_in_polylines.h>
|
||||
#include <CGAL/internal/Mesh_3/Graph_manipulations.h>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <CGAL/Labeled_image_mesh_domain_3.h> // for CGAL::Null_subdomain_index
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
template <typename P>
|
||||
template <typename P,
|
||||
typename Image_word_type,
|
||||
typename Null_subdomain_index>
|
||||
void
|
||||
polylines_to_protect(const CGAL::Image_3& cgal_image,
|
||||
const double, const double, const double,
|
||||
std::vector<std::vector<P> >& polylines)
|
||||
const double vx, const double vy, const double vz,
|
||||
std::vector<std::vector<P> >& polylines,
|
||||
Image_word_type*,
|
||||
Null_subdomain_index null)
|
||||
{
|
||||
typedef typename Kernel_traits<P>::Kernel K;
|
||||
typedef P Point_3;
|
||||
|
|
@ -85,7 +90,6 @@ polylines_to_protect(const CGAL::Image_3& cgal_image,
|
|||
// we have gone too far
|
||||
continue;
|
||||
}
|
||||
typedef unsigned char Image_word_type;
|
||||
typedef tuple<Pixel, Point_3, Image_word_type> Enriched_pixel;
|
||||
|
||||
array<array<Enriched_pixel, 2>, 2> square =
|
||||
|
|
@ -99,9 +103,9 @@ polylines_to_protect(const CGAL::Image_3& cgal_image,
|
|||
for(int jj = 0; jj < 2; ++jj)
|
||||
{
|
||||
const Pixel& pixel = get<0>(square[ii][jj]);
|
||||
double x = pixel[0] * cgal_image.vx();
|
||||
double y = pixel[1] * cgal_image.vy();
|
||||
double z = pixel[2] * cgal_image.vz();
|
||||
double x = pixel[0] * vx;
|
||||
double y = pixel[1] * vy;
|
||||
double z = pixel[2] * vz;
|
||||
get<1>(square[ii][jj]) = Point_3(x, y, z);
|
||||
get<2>(square[ii][jj]) = static_cast<Image_word_type>(cgal_image.value(pixel[0],
|
||||
pixel[1],
|
||||
|
|
@ -340,7 +344,22 @@ case_4:
|
|||
}
|
||||
|
||||
|
||||
template <typename P>
|
||||
template <typename P, typename Image_word_type, typename Null_subdomain_index>
|
||||
void
|
||||
polylines_to_protect(const CGAL::Image_3& cgal_image,
|
||||
std::vector<std::vector<P> >& polylines,
|
||||
Image_word_type* word_type,
|
||||
Null_subdomain_index null)
|
||||
{
|
||||
polylines_to_protect<P>
|
||||
(cgal_image,
|
||||
cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
|
||||
polylines,
|
||||
word_type,
|
||||
null);
|
||||
}
|
||||
|
||||
template <typename P, typename Image_word_type>
|
||||
void
|
||||
polylines_to_protect(const CGAL::Image_3& cgal_image,
|
||||
std::vector<std::vector<P> >& polylines)
|
||||
|
|
@ -348,7 +367,9 @@ polylines_to_protect(const CGAL::Image_3& cgal_image,
|
|||
polylines_to_protect<P>
|
||||
(cgal_image,
|
||||
cgal_image.vx(), cgal_image.vy(),cgal_image.vz(),
|
||||
polylines);
|
||||
polylines,
|
||||
(Image_word_type*)0,
|
||||
CGAL::Null_subdomain_index());
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage,
|
|||
|
||||
if(protect_features && polylines.empty()){
|
||||
std::vector<std::vector<Point_3> > polylines_on_bbox;
|
||||
CGAL::polylines_to_protect<Point_3>(*pImage, polylines_on_bbox);
|
||||
CGAL::polylines_to_protect<
|
||||
Point_3,
|
||||
Image_mesh_domain::Image_word_type>(*pImage, polylines_on_bbox);
|
||||
p_domain->add_features(polylines_on_bbox.begin(), polylines_on_bbox.end());
|
||||
}
|
||||
if(! polylines.empty()){
|
||||
|
|
|
|||
Loading…
Reference in New Issue