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

Method add

tools/Wires/Parameters/OffsetParameters.cpp:25–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 }
24
25void OffsetParameters::add(const VectorI& roi,
26 const std::string& formula, Float value, size_t axis) {
27 const Float tol = 1e-12;
28 const size_t dim = m_wire_network->get_dim();
29 const size_t num_vertices = m_wire_network->get_num_vertices();
30 const VectorF bbox_min = m_wire_network->get_bbox_min();
31 const VectorF bbox_max = m_wire_network->get_bbox_max();
32 const VectorF bbox_center = 0.5 * (bbox_min + bbox_max);
33 const MatrixFr& vertices = m_wire_network->get_vertices();
34 assert(axis < dim);
35
36 VectorF roi_min = bbox_max;
37 VectorF roi_max = bbox_min;
38
39 const size_t num_roi = roi.size();
40 for (size_t i=0; i<num_roi; i++) {
41 size_t v_idx = roi[i];
42 assert(v_idx < num_vertices);
43 const VectorF& v = vertices.row(v_idx);
44 roi_min = roi_min.cwiseMin(v);
45 roi_max = roi_max.cwiseMax(v);
46 }
47
48 if (fabs(roi_max[axis] - bbox_center[axis]) < tol &&
49 fabs(roi_min[axis] - bbox_center[axis]) < tol) {
50 // No dof in this axis without destroy symmetry.
51 return;
52 }
53 if (roi_min[axis] > bbox_min[axis] + tol &&
54 roi_max[axis] < bbox_max[axis] - tol) {
55 m_params.emplace_back(PatternParameter::Ptr(
56 new VertexOffsetParameter(m_wire_network, axis)));
57 PatternParameter::Ptr param = m_params.back();
58 param->set_roi(roi);
59 param->set_value(value);
60 param->set_formula(formula);
61 }
62}
63
64void OffsetParameters::add(const VectorI& roi,
65 const std::string& formula, Float value,

Callers 9

add_offset_parameterMethod · 0.45
coplanar_analysisFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
ProcessFileFunction · 0.45
ProcessFileFunction · 0.45
_GenerateMocksFunction · 0.45

Calls 9

get_bbox_minMethod · 0.80
get_bbox_maxMethod · 0.80
set_roiMethod · 0.80
set_valueMethod · 0.80
set_formulaMethod · 0.80
get_dimMethod · 0.45
get_num_verticesMethod · 0.45
get_verticesMethod · 0.45
sizeMethod · 0.45

Tested by 3

TEST_FFunction · 0.36
TEST_FFunction · 0.36
ProcessFileFunction · 0.36