MCPcopy Create free account
hub / github.com/PDAL/PDAL / initialize

Method initialize

io/FauxReader.cpp:91–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89
90
91void FauxReader::initialize()
92{
93 if (m_mode == Mode::Uniform || m_mode == Mode::Normal)
94 {
95 if (!m_seedArg->set())
96 m_seed = (uint32_t)std::time(NULL);
97 m_generator.seed(m_seed);
98 }
99 if (m_mode == Mode::Grid)
100 {
101 m_bounds.minx = ceil(m_bounds.minx);
102 m_bounds.maxx = ceil(m_bounds.maxx);
103 m_bounds.miny = ceil(m_bounds.miny);
104 m_bounds.maxy = ceil(m_bounds.maxy);
105 m_bounds.minz = ceil(m_bounds.minz);
106 m_bounds.maxz = ceil(m_bounds.maxz);
107 // Here delX/Y/Z represent the number of points in each direction.
108 double count = 1.0;
109 if (m_bounds.maxx <= m_bounds.minx)
110 m_delX = 0;
111 else
112 {
113 m_delX = m_bounds.maxx - m_bounds.minx;
114 count *= m_delX;
115 }
116 if (m_bounds.maxy <= m_bounds.miny)
117 m_delY = 0;
118 else
119 {
120 m_delY = m_bounds.maxy - m_bounds.miny;
121 count *= m_delY;
122 }
123 if (m_bounds.maxz <= m_bounds.minz)
124 m_delZ = 0;
125 else
126 {
127 m_delZ = m_bounds.maxz - m_bounds.minz;
128 count *= m_delZ;
129 }
130 if (!m_delX && !m_delY && !m_delZ)
131 count = 0;
132 if (!Utils::numericCast(count, m_count))
133 throwError("Requested range generates more points than supported.");
134 }
135 else if (m_mode == Mode::Normal)
136 {
137 //using nd = std::normal_distribution<double>;
138
139 m_normalX.reset(new nd(m_mean_x, m_stdev_x));
140 m_normalY.reset(new nd(m_mean_y, m_stdev_y));
141 m_normalZ.reset(new nd(m_mean_z, m_stdev_z));
142 }
143 else if (m_mode == Mode::Uniform)
144 {
145 //using urd = std::uniform_real_distribution<double>;
146
147 m_uniformX.reset(new urd(m_bounds.minx, m_bounds.maxx));
148 m_uniformY.reset(new urd(m_bounds.miny, m_bounds.maxy));

Callers

nothing calls this directly

Calls 4

ceilFunction · 0.85
numericCastFunction · 0.85
setMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected