MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / makeFreeFormOriginGrid

Function makeFreeFormOriginGrid

source/MRMesh/MRFreeFormDeformer.cpp:139–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137{
138
139std::vector<Vector3f> makeFreeFormOriginGrid( const Box3f& box, const Vector3i& resolution )
140{
141 auto resXY = resolution.x * resolution.y;
142 std::vector<Vector3f> res( resXY * resolution.z );
143 for ( int z = 0; z < resolution.z; ++z )
144 for ( int y = 0; y < resolution.y; ++y )
145 for ( int x = 0; x < resolution.x; ++x )
146 {
147 auto index = x + y * resolution.x + z * resXY;
148 Vector3f coef( x / float( resolution.x - 1 ), y / float( resolution.y - 1 ), z / float( resolution.z - 1 ) );
149
150 res[index] = Vector3f(
151 box.min.x * ( 1.0f - coef.x ) + box.max.x * coef.x,
152 box.min.y * ( 1.0f - coef.y ) + box.max.y * coef.y,
153 box.min.z * ( 1.0f - coef.z ) + box.max.z * coef.z );
154 }
155 return res;
156}
157
158FreeFormDeformer::FreeFormDeformer( VertCoords& coords, const VertBitSet& valid ) :
159 coords_{ coords },

Callers 3

initMethod · 0.85
stabilize_Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected