MEPP2 Project
Parameters.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2022 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 
12 #pragma once
13 
14 #include <iostream>
15 
16 namespace FEVV {
17 namespace Filters {
18 
19 enum class PREDICTION_TYPE {
20  POSITION = 0,
21  DELTA,
22  //BARYCENTER_PREDICTOR, // (not implemented in this release)
23  //BARYCENTER, // (not implemented in this release)
24  //HALFRING, // (not implemented in this release)
25  BUTTERFLY,
26 };
27 
28 enum class VKEPT_POSITION { MIDPOINT = 0,
29  HALFEDGE,
30  FULLEDGE
31  };
32 
33 enum class METRIC_TYPE {
34  NO_METRIC = -1,
35  QEM_3D,
36  EDGE_LENGTH,
38 };
39 
40 
45 class Parameters // Local Parameters
46 {
47 private:
51  bool _first_call;
52  bool _allow_duplicates; // Global parameters
54 
55 public:
58  METRIC_TYPE get_metric() const { return _metric; }
59  bool get_first_call() const { return _first_call; }
60  bool get_allow_duplicates() const { return _allow_duplicates; }
62  VKEPT_POSITION __vkept_pos = VKEPT_POSITION::MIDPOINT,
63  METRIC_TYPE __metric = METRIC_TYPE::EDGE_LENGTH,
64  bool __first_call = true,
65  bool __allow_duplicates = false,
66  int __quantization_bits = 16)
67  {
68  _prediction = __prediction;
69  _vkept_pos = __vkept_pos;
70  _metric = __metric;
71  _first_call = __first_call;
72  _allow_duplicates = __allow_duplicates;
73  _quantization_bits = __quantization_bits;
74  }
75 
77  void set_first_call(bool _first) { _first_call = _first; }
78  int get_quantization() const { return _quantization_bits; }
79 
80  std::string get_prediction_type_as_string() const
81  {
82  switch(_prediction)
83  {
84  case PREDICTION_TYPE::POSITION:
85  return "position";
86  break;
87  case PREDICTION_TYPE::DELTA:
88  return "delta";
89  break;
90  /*case PREDICTION_TYPE::BARYCENTER_PREDICTOR:
91  return "barycentre_predictor";
92  break;
93  case PREDICTION_TYPE::BARYCENTER:
94  return "barycentre";
95  break;
96  case PREDICTION_TYPE::HALFRING:
97  return "simple_barycentre_half_ring";
98  break;*/
100  return "butterfly";
101  break;
102  default:
103  return "unknown";
104  break;
105  }
106  }
107  std::string get_vkept_type_as_string() const
108  {
109  switch(_vkept_pos)
110  {
111  case VKEPT_POSITION::HALFEDGE:
112  return "halfedge";
113  break;
115  return "fulledge";
116  break;
117  case VKEPT_POSITION::MIDPOINT:
118  return "midpoint";
119  break;
120  default:
121  return "midpoint";
122  break;
123  }
124  }
125  std::string get_metric_type_as_string() const
126  {
127  switch(_metric)
128  {
129  case FEVV::Filters::METRIC_TYPE::NO_METRIC:
130  return "no_metric";
131  break;
133  return "qem";
134  break;
135  case FEVV::Filters::METRIC_TYPE::EDGE_LENGTH:
136  return "edge-length";
137  break;
139  return "volume-preserving";
140  break;
141  default:
142  return "unknown";
143  break;
144  }
145  }
146 
148  {
149  _metric = metr;
150  _vkept_pos = vk;
151  }
152 };
153 
154 } // namespace Filters
155 } // namespace FEVV
FEVV::Filters::Parameters::Parameters
Parameters(PREDICTION_TYPE __prediction=PREDICTION_TYPE::BUTTERFLY, VKEPT_POSITION __vkept_pos=VKEPT_POSITION::MIDPOINT, METRIC_TYPE __metric=METRIC_TYPE::EDGE_LENGTH, bool __first_call=true, bool __allow_duplicates=false, int __quantization_bits=16)
Definition: Parameters.h:61
FEVV::Filters::Parameters::get_vkept_position
VKEPT_POSITION get_vkept_position() const
Definition: Parameters.h:57
FEVV::Filters::Parameters::_first_call
bool _first_call
Definition: Parameters.h:51
FEVV::Filters::PREDICTION_TYPE
PREDICTION_TYPE
Definition: Parameters.h:19
FEVV::Filters::METRIC_TYPE
METRIC_TYPE
Definition: Parameters.h:33
FEVV::Filters::Parameters::~Parameters
~Parameters()
Definition: Parameters.h:76
FEVV::Filters::Parameters::_quantization_bits
int _quantization_bits
Definition: Parameters.h:53
FEVV::Filters::Parameters::set_methods
void set_methods(METRIC_TYPE metr, VKEPT_POSITION vk)
Definition: Parameters.h:147
FEVV::Filters::Parameters::set_first_call
void set_first_call(bool _first)
Definition: Parameters.h:77
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::Filters::Parameters::_allow_duplicates
bool _allow_duplicates
Definition: Parameters.h:52
FEVV::Filters::Parameters::get_prediction
PREDICTION_TYPE get_prediction() const
Definition: Parameters.h:56
FEVV::Filters::METRIC_TYPE::NO_METRIC
@ NO_METRIC
FEVV::Filters::Parameters::_vkept_pos
VKEPT_POSITION _vkept_pos
Definition: Parameters.h:49
FEVV::Filters::Parameters::get_prediction_type_as_string
std::string get_prediction_type_as_string() const
Definition: Parameters.h:80
FEVV::Filters::Parameters::get_quantization
int get_quantization() const
Definition: Parameters.h:78
FEVV::Filters::Parameters::get_metric
METRIC_TYPE get_metric() const
Definition: Parameters.h:58
FEVV::Filters::Parameters::_metric
METRIC_TYPE _metric
Definition: Parameters.h:50
FEVV::Filters::VKEPT_POSITION
VKEPT_POSITION
Definition: Parameters.h:28
FEVV::Filters::Parameters::get_first_call
bool get_first_call() const
Definition: Parameters.h:59
FEVV::Filters::Parameters::get_vkept_type_as_string
std::string get_vkept_type_as_string() const
Definition: Parameters.h:107
FEVV::Filters::Parameters::get_metric_type_as_string
std::string get_metric_type_as_string() const
Definition: Parameters.h:125
FEVV::Filters::Parameters
Parameters contains the compression parameters except the stopping criteria.
Definition: Parameters.h:46
FEVV::Filters::METRIC_TYPE::QEM_3D
@ QEM_3D
do not use a local metric (not implemented in this release)
FEVV::Filters::Parameters::_prediction
PREDICTION_TYPE _prediction
Definition: Parameters.h:48
FEVV::Filters::PREDICTION_TYPE::POSITION
@ POSITION
FEVV::Filters::VKEPT_POSITION::MIDPOINT
@ MIDPOINT
FEVV::Filters::Parameters::get_allow_duplicates
bool get_allow_duplicates() const
Definition: Parameters.h:60