NDEVR
API Documentation
PointContainer.h
1#pragma once
2#include <NDEVR/Vertex.h>
3#include <NDEVR/Buffer.h>
4#include <NDEVR/File.h>
5namespace NDEVR
6{
13 template<class t_point_type>
15 {
16 public:
23 {
24 locations.setSize(size);
25 weights.setSize(size);
26 data.setSize(size);
27 }
28
30 uint04 size() const
31 {
32 return locations.size();
33 }
34
35 void clear()
36 {
37 locations.clear();
38 weights.clear();
39 data.clear();
40 };
41
43 void addAll(const PointContainer& other)
44 {
45 locations.addAll(other.locations);
46 weights.addAll(other.weights);
47 data.addAll(other.data);
48 }
49
51 void writeToFile(File& file) const
52 {
53 FILE* f = file.filePtr();
54 uint04 s = size();
55 fwrite(&s, sizeof(uint04), 1, f);
56 fwrite(locations.begin(), sizeof(Vertex<3, fltp04>), s, f);
57 fwrite(data.begin(), sizeof(t_point_type), s, f);
58 fwrite(weights.begin(), sizeof(uint04), s, f);
59 }
60
63 {
64 FILE* f = file.filePtr();
65 uint04 s;
66 fread(&s, sizeof(uint04), 1, f);
67 setSize(s);
68 fread(locations.begin(), sizeof(Vertex<3, fltp04>), s, f);
69 fread(data.begin(), sizeof(t_point_type), s, f);
70 fread(weights.begin(), sizeof(uint04), s, f);
71 }
72
75 {
76 for (uint04 i = 0; i < weights.size();)
77 {
78 if (weights[i] < weight)
79 {
80 locations.removeIndexBackSwap(i);
81 weights.removeIndexBackSwap(i);
82 data.removeIndexBackSwap(i);
83 }
84 else
85 {
86 i++;
87 }
88 }
89 }
90 };
91}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
A templated container for 3D point cloud data with per-point positions, typed attributes,...
void filterByWeight(uint04 weight)
Remove all points with weights below the given threshold (back-swap removal).
Buffer< Vertex< 3, fltp04 > > locations
3D positions of each point
Buffer< uint04 > weights
Per-point confidence weights.
void clear()
Clear all buffers, removing all points.
void setSize(uint04 size)
Resize all internal buffers to hold the given number of points.
void addAll(const PointContainer &other)
Append all points from another container.
Buffer< t_point_type > data
Per-point attribute data.
void readFromFile(File &file)
Deserialize point data from a binary file.
uint04 size() const
Get the number of points in the container.
void writeToFile(File &file) const
Serialize all point data to a binary file.
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
@ file
The source file path associated with this object.