| 164 | } |
| 165 | |
| 166 | void initializeClothPositions (collide2::ClothModel & cloth) { |
| 167 | |
| 168 | sim_collisions.clear(); |
| 169 | |
| 170 | for (size_t i=0; i<NX; ++i) { |
| 171 | for (size_t j=0; j<NZ; ++j) { |
| 172 | cloth.x_0_[NX*i+j].x = -(.5f*width) + (float)i*(width/(float)(NX-1)); |
| 173 | cloth.x_0_[NX*i+j].y = +1.5f; |
| 174 | cloth.x_0_[NX*i+j].z = -(.5f*height) + (float)j*(height/(float)(NZ-1)); |
| 175 | } |
| 176 | } |
| 177 | cloth.x_ = cloth.x_0_; |
| 178 | cloth.x_old_ = cloth.x_0_; |
| 179 | cloth.x_last_ = cloth.x_0_; |
| 180 | collide2::vec_t nullvec(0.f, 0.f, 0.f); |
| 181 | std::fill (cloth.v_.begin (), cloth.v_.end (), nullvec); |
| 182 | |
| 183 | cur_time = 0; |
| 184 | cloth.clearCollisionConstraints(); |
| 185 | } |
| 186 | |
| 187 | unsigned int createClothSheet (RTCScene scene) |
| 188 | { |
no test coverage detected