| 16 | { |
| 17 | |
| 18 | TEST( MRMesh, findClosestWeightedPoint ) |
| 19 | { |
| 20 | PointCloud pc; |
| 21 | pc.points.push_back( Vector3f( 0, 0, 0 ) ); |
| 22 | pc.points.push_back( Vector3f( 3, 0, 0 ) ); |
| 23 | pc.validPoints.resize( 2, true ); |
| 24 | |
| 25 | { |
| 26 | DistanceFromWeightedPointsComputeParams params |
| 27 | { { |
| 28 | .pointWeight = []( VertId ) { return 0.f; }, |
| 29 | .maxWeightGrad = 0 |
| 30 | } }; |
| 31 | auto res = findClosestWeightedPoint( Vector3f( 1, 0, 0 ), pc.getAABBTree(), params ); |
| 32 | ASSERT_TRUE( res.valid() ); |
| 33 | ASSERT_EQ( res.vId, 0_v ); |
| 34 | ASSERT_EQ( res.dist, 1 ); |
| 35 | |
| 36 | params.maxBidirDist = 0.5f; |
| 37 | res = findClosestWeightedPoint( Vector3f( 1, 0, 0 ), pc.getAABBTree(), params ); |
| 38 | ASSERT_FALSE( res.valid() ); |
| 39 | } |
| 40 | |
| 41 | { |
| 42 | DistanceFromWeightedPointsComputeParams params |
| 43 | { { |
| 44 | .pointWeight = []( VertId v ) { return v == 0_v ? -1.5f : 0.f; }, |
| 45 | .maxWeightGrad = 0.5f |
| 46 | } }; |
| 47 | auto res = findClosestWeightedPoint( Vector3f( 1, 0, 0 ), pc.getAABBTree(), params ); |
| 48 | ASSERT_TRUE( res.valid() ); |
| 49 | ASSERT_EQ( res.vId, 1_v ); |
| 50 | ASSERT_EQ( res.dist, 2 ); |
| 51 | |
| 52 | params.maxBidirDist = 1.5f; |
| 53 | res = findClosestWeightedPoint( Vector3f( 1, 0, 0 ), pc.getAABBTree(), params ); |
| 54 | ASSERT_FALSE( res.valid() ); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | TEST( MRMesh, findClosestWeightedMeshPoint ) |
| 59 | { |
nothing calls this directly
no test coverage detected