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

Class XForm

pdal/pdal_types.hpp:136–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136struct XForm
137{
138 struct XFormComponent
139 {
140 XFormComponent() : m_val(0.0), m_auto(false)
141 {}
142
143 XFormComponent(double val) : m_val(val), m_auto(false)
144 {}
145
146 double m_val;
147 bool m_auto;
148
149 bool set(const std::string& sval)
150 {
151 if (sval == "auto")
152 m_auto = true;
153 else
154 {
155 bool failed = false;
156 try
157 {
158 failed = !Utils::fromString(sval, m_val);
159 }
160 catch (...)
161 {
162 failed = true;
163 }
164 if (failed)
165 {
166 m_val = 0;
167 return false;
168 }
169 }
170 return true;
171 }
172
173 friend std::istream& operator>>(std::istream& in, XFormComponent& xfc);
174 friend std::ostream& operator<<(std::ostream& in,
175 const XFormComponent& xfc);
176 };
177
178 XForm() : m_scale(1.0), m_offset(0.0)
179 {}
180
181 XForm(double scale, double offset) : m_scale(scale), m_offset(offset)
182 {}
183
184 // Scale component of the transform.
185 XFormComponent m_scale;
186 // Offset component of the transform.
187 XFormComponent m_offset;
188
189 double toScaled(double val) const
190 { return (val - m_offset.m_val) / m_scale.m_val; }
191
192 double fromScaled(double val) const
193 { return (val * m_scale.m_val) + m_offset.m_val; }

Callers 1

fetchHeaderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected