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

Function TEST

source/MRTest/MRPointCloudVariadicOffsetTests.cpp:18–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17
18TEST( 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
58TEST( MRMesh, findClosestWeightedMeshPoint )
59{

Callers

nothing calls this directly

Calls 15

findClosestWeightedPointFunction · 0.85
fromTrianglesFunction · 0.85
absFunction · 0.85
makeCubeFunction · 0.85
meshShellFunction · 0.85
makeTorusFunction · 0.85
ParallelForFunction · 0.85
ParametersMetricClass · 0.85
suggestVoxelSizeFunction · 0.85
makeUVSphereFunction · 0.85

Tested by

no test coverage detected