File: VertexDataSource.hpp

package info (click to toggle)
therion 6.3.4-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,544 kB
  • sloc: cpp: 195,273; tcl: 19,779; ansic: 8,434; perl: 1,895; makefile: 1,281; python: 255; asm: 219; sh: 104
file content (48 lines) | stat: -rw-r--r-- 850 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef VertexDataSource_h
#define VertexDataSource_h

#include "Vector3.hpp"

namespace quickhull {
	
	template<typename T>
	class VertexDataSource {
		const Vector3<T>* m_ptr;
		size_t m_count;
	
	public:
		VertexDataSource(const Vector3<T>* ptr, size_t count) : m_ptr(ptr), m_count(count) {
			
		}
		
		VertexDataSource(const std::vector<Vector3<T>>& vec) : m_ptr(&vec[0]), m_count(vec.size()) {
			
		}
		
		VertexDataSource() : m_ptr(nullptr), m_count(0) {
			
		}
		
		VertexDataSource& operator=(const VertexDataSource& other) = default;
		
		size_t size() const {
			return m_count;
		}
		
		const Vector3<T>& operator[](size_t index) const {
			return m_ptr[index];
		}
		
		const Vector3<T>* begin() const {
			return m_ptr;
		}
		
		const Vector3<T>* end() const {
			return m_ptr + m_count;
		}
	};
	
}


#endif /* VertexDataSource_h */