MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / createMesh

Function createMesh

Demos/BarDemo/main.cpp:130–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128
129
130void createMesh()
131{
132 SimulationModel* model = Simulation::getCurrent()->getModel();
133 model->addRegularTetModel(width, height, depth,
134 Vector3r(5, 0, 0), Matrix3r::Identity(), Vector3r(10.0, 1.5, 1.5));
135
136 ParticleData& pd = model->getParticles();
137 for (unsigned int i = 0; i < 1; i++)
138 {
139 for (unsigned int j = 0; j < height; j++)
140 {
141 for (unsigned int k = 0; k < depth; k++)
142 pd.setMass(i*height*depth + j*depth + k, 0.0);
143 }
144 }
145
146 // init constraints
147 model->setSolidStiffness(1.0);
148 if (model->getSolidSimulationMethod() == 3)
149 model->setSolidStiffness(1000000);
150 if (model->getSolidSimulationMethod() == 6)
151 model->setSolidStiffness(100000);
152
153 model->setSolidVolumeStiffness(1.0);
154 if (model->getSolidSimulationMethod() == 6)
155 model->setSolidVolumeStiffness(100000);
156 for (unsigned int cm = 0; cm < model->getTetModels().size(); cm++)
157 {
158 model->addSolidConstraints(model->getTetModels()[cm], model->getSolidSimulationMethod(), model->getSolidStiffness(),
159 model->getSolidPoissonRatio(), model->getSolidVolumeStiffness(), model->getSolidNormalizeStretch(), model->getSolidNormalizeShear());
160
161 model->getTetModels()[cm]->updateMeshNormals(pd);
162
163 LOG_INFO << "Number of tets: " << model->getTetModels()[cm]->getParticleMesh().numTets();
164 LOG_INFO << "Number of vertices: " << width * height * depth;
165 }
166}
167

Callers 1

buildModelFunction · 0.70

Calls 15

getModelMethod · 0.80
addRegularTetModelMethod · 0.80
setMassMethod · 0.80
setSolidStiffnessMethod · 0.80
addSolidConstraintsMethod · 0.80
getSolidStiffnessMethod · 0.80
getSolidPoissonRatioMethod · 0.80

Tested by

no test coverage detected