MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / apply_z_correction

Method apply_z_correction

tools/Wires/Inflator/GeometryCorrectionTable.cpp:170–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void GeometryCorrectionTable::apply_z_correction(
171 const Vector3F& edge_dir, MatrixFr& loop) {
172 //const Float max_z_error = 0.125;
173 //const Float max_z_error = 0.09;
174 const Float max_z_error = 0.00;
175 VectorF bbox_min = loop.colwise().minCoeff();
176 VectorF bbox_max = loop.colwise().maxCoeff();
177 VectorF bbox_center = 0.5 * (bbox_min + bbox_max);
178
179 Vector3F side_dir = edge_dir.cross(Vector3F::UnitZ());
180 Float sin_val = side_dir.norm();
181 if (sin_val < 1e-3) return;
182
183 const size_t num_vts = loop.rows();
184 for (size_t i=0; i<num_vts; i++) {
185 Vector3F v = loop.row(i) - bbox_center.transpose();
186 Float side_component = side_dir.dot(v) / sin_val;
187 Vector3F proj_v = v - side_component * side_dir / sin_val;
188 Float proj_component = proj_v.norm();
189 if (proj_component > 1e-3) {
190 proj_v -= proj_v / proj_component * (sin_val * max_z_error);
191 }
192 loop.row(i) = bbox_center + proj_v + side_component * side_dir / sin_val;
193 }
194}
195
196Vector2F GeometryCorrectionTable::lookup(Float half_width, Float half_height) {
197 const size_t num_entries = m_measurements.size();

Callers

nothing calls this directly

Calls 1

normMethod · 0.80

Tested by

no test coverage detected