MEPP2 Project
get_max_bb_size.hpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <boost/graph/graph_traits.hpp>
14 #include <boost/graph/properties.hpp>
16 
18 
19 
20 namespace FEVV {
21 namespace Filters {
22 
32 template< typename HalfedgeGraph,
33  typename PointMap,
34  typename GeometryTraits = FEVV::Geometry_traits< HalfedgeGraph > >
35 double
36 get_max_bb_size(const HalfedgeGraph &g,
37  PointMap &pm,
38  GeometryTraits &gt)
39 {
40  typename boost::property_traits< PointMap >::value_type min_aabb,
41  max_aabb;
43  PointMap,
44  GeometryTraits >(g,
45  pm,
46  min_aabb,
47  max_aabb,
48  gt);
49 
50 #ifdef __GNUC__
51 #pragma GCC diagnostic push
52 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
53 #endif // __GNUC__
54  double xmax = gt.get_x(max_aabb) - gt.get_x(min_aabb);
55  double ymax = gt.get_y(max_aabb) - gt.get_y(min_aabb);
56  double zmax = gt.get_z(max_aabb) - gt.get_z(min_aabb);
57 #ifdef __GNUC__
58 #pragma GCC diagnostic pop
59 #endif // __GNUC__
60  double max = xmax > ymax ? xmax : ymax;
61 
62  return max > zmax ? max : zmax;
63 }
64 
74 template< typename HalfedgeGraph,
75  typename PointMap,
76  typename GeometryTraits = FEVV::Geometry_traits< HalfedgeGraph > >
77 double
78 get_max_bb_size(const HalfedgeGraph &g,
79  PointMap &pm)
80 {
81  GeometryTraits gt(g);
82  return get_max_bb_size< HalfedgeGraph,
83  PointMap,
84  GeometryTraits >(g, pm, gt);
85 }
86 
87 } //namespace Filters
88 } //namespace FEVV
FEVV::Geometry_traits< HalfedgeGraph >
FEVV::Filters::compute_mesh_bounding_box
void compute_mesh_bounding_box(const PropertyGraph &g, const PointMap &pm, typename boost::property_traits< PointMap >::value_type &min_aabb, typename boost::property_traits< PointMap >::value_type &max_aabb, const GeometryTraits &gt)
Compute the mesh Axis-Aligned Bounding-Box (AABB).
Definition: compute_mesh_bounding_box.hpp:38
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
compute_mesh_bounding_box.hpp
FEVV::Filters::get_max_bb_size
double get_max_bb_size(const HalfedgeGraph &g, PointMap &pm, GeometryTraits &gt)
Gets the maximum size of the object bounding box.
Definition: get_max_bb_size.hpp:36
Geometry_traits.h