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

Function TEST

source/MRTest/MRFeaturesTests.cpp:10–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8static constexpr float testEps = 0.0001f;
9
10TEST( Features, PrimitiveConstruction )
11{
12 { // Infinite line to cone segment.
13 Vector3f pos( 10, 20, 35 );
14 Vector3f dir( 0, -3, 0 );
15 auto cone = toPrimitive( Line3f( pos, dir ) );
16
17 ASSERT_EQ( cone.positiveSideRadius, 0 );
18 ASSERT_EQ( cone.negativeSideRadius, 0 );
19 ASSERT_LE( ( cone.referencePoint - pos ).length(), testEps );
20 ASSERT_LE( ( cone.dir - Vector3f( 0, -1, 0 ) ).length(), testEps );
21 ASSERT_EQ( cone.positiveLength, INFINITY );
22 ASSERT_EQ( cone.negativeLength, INFINITY );
23 }
24
25 { // Finite line to cone segment.
26 Vector3f pos( 10, 20, 35 );
27 Vector3f dir( 0, -3, 0 );
28 auto cone = toPrimitive( LineSegm3f( pos, pos + dir ) );
29
30 ASSERT_EQ( cone.positiveSideRadius, 0 );
31 ASSERT_EQ( cone.negativeSideRadius, 0 );
32 ASSERT_LE( ( cone.referencePoint - pos ).length(), testEps );
33 ASSERT_LE( ( cone.dir - Vector3f( 0, -1, 0 ) ).length(), testEps );
34 ASSERT_NEAR( cone.positiveLength, 3, testEps );
35 ASSERT_NEAR( cone.negativeLength, 0, testEps );
36 }
37
38 { // Cone segment defined as a cylinder.
39 Vector3f pos( 10, 20, 35 );
40 Vector3f dir( 0, -3, 0 );
41 float rad = 4;
42 auto cone = primitiveCylinder( pos, pos + dir, rad );
43 ASSERT_EQ( cone.positiveSideRadius, rad );
44 ASSERT_EQ( cone.negativeSideRadius, rad );
45 ASSERT_LE( ( cone.referencePoint - pos ).length(), testEps );
46 ASSERT_LE( ( cone.dir - Vector3f( 0, -1, 0 ) ).length(), testEps );
47 ASSERT_NEAR( cone.positiveLength, 3, testEps );
48 ASSERT_NEAR( cone.negativeLength, 0, testEps );
49 }
50
51 { // Cone segment defined as a cone.
52 Vector3f pos( 10, 20, 35 );
53 Vector3f dir( 0, -3, 0 );
54 float rad = 4;
55 auto cone = primitiveCylinder( pos, pos + dir, rad );
56 ASSERT_EQ( cone.positiveSideRadius, rad );
57 ASSERT_EQ( cone.negativeSideRadius, rad );
58 ASSERT_LE( ( cone.referencePoint - pos ).length(), testEps );
59 ASSERT_LE( ( cone.dir - Vector3f( 0, -1, 0 ) ).length(), testEps );
60 ASSERT_NEAR( cone.positiveLength, 3, testEps );
61 ASSERT_NEAR( cone.negativeLength, 0, testEps );
62 }
63}
64
65TEST( Features, PrimitiveOps_ConeSegment )
66{

Callers

nothing calls this directly

Calls 15

primitiveCylinderFunction · 0.85
maxFunction · 0.85
clampFunction · 0.85
SphereClass · 0.85
lerpFunction · 0.85
absFunction · 0.85
primitiveCircleFunction · 0.85
untruncateConeMethod · 0.80
toPrimitiveFunction · 0.50
swapFunction · 0.50
measureFunction · 0.50
crossFunction · 0.50

Tested by

no test coverage detected