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

Method Add

plugins/trajectory/filters/PulseCollection.cpp:22–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20{}
21
22void PulseCollection::Add(double time, const Eigen::Vector3d& r, int nr, int rn, double angle)
23{
24 // Let's skip return unless num and ret are sensible
25 if (rn < 1 || rn > nr)
26 return;
27
28 angle *= m_args.flipScanAngle;
29
30 if (m_first)
31 {
32 // Somewhat arbitrary choice of origin (to ensure internal calculations
33 // are well conditioned.
34 m_timeOrigin = std::floor(time / 10) * 10; // Round left to lowest 10 value.
35 m_rOrigin = (Eigen::floor(r.array() / 100) * 100).matrix(); // Round to nearest 100
36 m_timeMin = time;
37 m_first = false;
38 }
39 double adjTime = time - m_timeOrigin;
40 if (adjTime < m_lastAdjTime)
41 throw pdal_error("PulseCollection: returns are not sorted in time");
42
43 if (nr == 1)
44 {
45 addPoint(adjTime, r - m_rOrigin, r - m_rOrigin, angle);
46 m_lowhigh = 0; // In case we didn't get a good multi-return pulse.
47 }
48 else
49 {
50 if (rn == 1)
51 {
52 m_rlow = r;
53 m_lowhigh++;
54 }
55 else if (nr == rn)
56 {
57 m_rhigh = r;
58 m_lowhigh++;
59 }
60 if (m_lowhigh == 2)
61 {
62 addPoint(adjTime, m_rlow - m_rOrigin, m_rhigh - m_rOrigin, angle);
63 m_lowhigh = 0;
64 }
65 }
66 m_lastAdjTime = adjTime;
67 m_timeMax = time;
68}
69
70bool PulseCollection::usingMulti() const
71{

Callers 1

runAlgorithmMethod · 0.80

Calls 1

addPointFunction · 0.85

Tested by

no test coverage detected