surface_param.hpp
Go to the documentation of this file.
1 /*
2 ** TP CPE Lyon
3 ** Copyright (C) 2014 Damien Rohmer
4 **
5 ** This program is free software: you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation, either version 3 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 
20 #pragma once
21 
22 #ifndef SURFACE_PARAM_HPP
23 #define SURFACE_PARAM_HPP
24 
25 #include "../lib3d/vec3.hpp"
26 #include <vector>
27 
28 namespace cpe
29 {
31 {
32  public:
33 
34  // ********************************************* //
35  // ********************************************* //
36  // CONSTRUCTORS
37  // ********************************************* //
38  // ********************************************* //
39 
41  surface_param();
43  surface_param(unsigned int Nu,unsigned int Nv);
44 
45  // ********************************************* //
46  // ********************************************* //
47  // Size
48  // ********************************************* //
49  // ********************************************* //
50 
51 
53  void resize(unsigned int Nu,unsigned int Nv);
54 
56  unsigned int size_u() const;
58  unsigned int size_v() const;
59 
60 
61  // ********************************************* //
62  // ********************************************* //
63  // Data
64  // ********************************************* //
65  // ********************************************* //
66 
68  const vec3& operator()(unsigned int ku,unsigned int kv) const;
70  vec3& operator()(unsigned int ku,unsigned int kv);
71 
72 
73  // ********************************************* //
74  // ********************************************* //
75  // Internal access
76  // ********************************************* //
77  // ********************************************* //
78 
80  const vec3* pointer() const;
83 
84 
85  protected:
86 
88  const vec3& get(unsigned int ku,unsigned int kv) const;
89 
91  void assert_size(unsigned int ku,unsigned int kv) const;
92 
93  private:
94 
95 
96 
97 
98 
100  unsigned int internal_size_u;
102  unsigned int internal_size_v;
104  std::vector<vec3> internal_data;
105 };
106 }
107 
108 #endif
Definition: surface_param.hpp:30
unsigned int internal_size_u
internal size in u
Definition: surface_param.hpp:100
unsigned int size_u() const
return the size in u direction
Definition: surface_param.cpp:43
std::vector< vec3 > internal_data
internal data
Definition: surface_param.hpp:104
const vec3 * pointer() const
export internal pointer
Definition: surface_param.cpp:65
const vec3 & operator()(unsigned int ku, unsigned int kv) const
Accessor to the value (ku,kv)
Definition: surface_param.cpp:53
surface_param()
empty constructor
Definition: surface_param.cpp:26
unsigned int internal_size_v
internal size in v
Definition: surface_param.hpp:102
unsigned int size_v() const
return the size in v direction
Definition: surface_param.cpp:48
Vectors/Points 3D.
Definition: vec3.hpp:36
vec3 * pointer_unprotected()
export internal pointer unprotected, use with care
Definition: surface_param.cpp:69
void resize(unsigned int Nu, unsigned int Nv)
resize the grid
Definition: surface_param.cpp:36
void assert_size(unsigned int ku, unsigned int kv) const
ensure (ku,kv) is coherent with the size of the grid
Definition: surface_param.cpp:74