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

Method init_

source/MRMesh/MRDenseBox.cpp:51–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void 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
85void DenseBox::init_( const MeshPart& meshPart, const AffineXf3f* xf )
86{

Callers

nothing calls this directly

Calls 11

accumulateWeighedPointsFunction · 0.85
accumulatePointsFunction · 0.85
accumulateFaceCentersFunction · 0.85
accumulateLineCentersFunction · 0.85
getBasicXfMethod · 0.80
includeMethod · 0.45
inverseMethod · 0.45
sizeMethod · 0.45
validMethod · 0.45
volumeMethod · 0.45
computeBoundingBoxMethod · 0.45

Tested by

no test coverage detected