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

Method choose_material

tools/Assembler/Materials/PeriodicMaterial.cpp:40–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40size_t PeriodicMaterial::choose_material(VectorF coord) const {
41 size_t num_materials = m_materials.size();
42 Float proj = coord.dot(m_axis) - m_phase * m_period;
43 Float int_part;
44 Float frac_part = modf(proj / m_period, &int_part);
45 if (frac_part < 0) {
46 frac_part = 1.0 + frac_part;
47 }
48
49 if (frac_part <= m_ratio) {
50 return 0;
51 } else {
52 return 1;
53 }
54}
55
56void PeriodicMaterial::check_validity() const {
57 Float axis_length = m_axis.norm();

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected