| 49 | } |
| 50 | |
| 51 | void DenseBox::init_( const std::vector<Vector3f>& points, const std::vector<float>* weights, const AffineXf3f* xf ) |
| 52 | { |
| 53 | MR_TIMER; |
| 54 | for ( const auto& p : points ) |
| 55 | box_.include( xf ? (*xf)( p ) : p ); |
| 56 | if ( xf ) |
| 57 | { |
| 58 | basisXf_ = *xf; |
| 59 | basisXfInv_ = basisXf_.inverse(); |
| 60 | } |
| 61 | |
| 62 | assert( !weights || points.size() == weights->size() ); |
| 63 | PointAccumulator accum; |
| 64 | if ( weights ) |
| 65 | accumulateWeighedPoints( accum, points, *weights, xf ); |
| 66 | else |
| 67 | accumulatePoints( accum, points, xf ); |
| 68 | if ( !accum.valid() ) |
| 69 | return; |
| 70 | |
| 71 | const auto aXf = AffineXf3f( accum.getBasicXf() ); |
| 72 | const auto aInvXf = aXf.inverse(); |
| 73 | const auto tempXf = xf ? aInvXf * ( *xf ) : aInvXf; |
| 74 | Box3f abox; |
| 75 | for ( const auto& p : points ) |
| 76 | abox.include( tempXf( p ) ); |
| 77 | if ( abox.volume() < box_.volume() ) |
| 78 | { |
| 79 | box_ = abox; |
| 80 | basisXf_ = aXf; |
| 81 | basisXfInv_ = aInvXf; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | void DenseBox::init_( const MeshPart& meshPart, const AffineXf3f* xf ) |
| 86 | { |
nothing calls this directly
no test coverage detected