| 304 | } |
| 305 | |
| 306 | bool BinaryStlSaver::writeTri( const Triangle3f& tri ) |
| 307 | { |
| 308 | // perform normal computation in double-precision to get exactly the same single-precision result on all platforms |
| 309 | const Vector3d ad = applyDouble( settings_.xf, tri[0] ); |
| 310 | const Vector3d bd = applyDouble( settings_.xf, tri[1] ); |
| 311 | const Vector3d cd = applyDouble( settings_.xf, tri[2] ); |
| 312 | const Vector3f normal( cross( bd - ad, cd - ad ).normalized() ); |
| 313 | const Vector3f ap( ad ); |
| 314 | const Vector3f bp( bd ); |
| 315 | const Vector3f cp( cd ); |
| 316 | |
| 317 | out_.write( (const char*)&normal, 12 ); |
| 318 | out_.write( (const char*)&ap, 12 ); |
| 319 | out_.write( (const char*)&bp, 12 ); |
| 320 | out_.write( (const char*)&cp, 12 ); |
| 321 | std::uint16_t attr{ 0 }; |
| 322 | out_.write( ( const char* )&attr, 2 ); |
| 323 | ++savedNumTris_; |
| 324 | return (bool)out_; |
| 325 | } |
| 326 | |
| 327 | bool BinaryStlSaver::updateHeadCounter() |
| 328 | { |
no test coverage detected