Skip to content

Commit 2990655

Browse files
committed
test entobb::left/entobb::right
1 parent 05196c6 commit 2990655

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/testmpr.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,37 @@ namespace
175175
vec v = e.supportpoint(vec(1,1,1));
176176
assert(v == vec(2,2,3));
177177
}
178+
179+
void test_entobb_left_right()
180+
{
181+
std::printf("testing entobb::left and entobb::right\n");
182+
{
183+
physent p;
184+
p.xradius = 1;
185+
p.yradius = 1;
186+
p.eyeheight = 1;
187+
p.o = vec(0,0,0);
188+
p.yaw = 0;
189+
mpr::EntOBB e(&p);
190+
float l = e.left();
191+
float r = e.right();
192+
assert(l == -r);
193+
assert(l == -1.f);
194+
}
195+
{
196+
physent p;
197+
p.xradius = 2;
198+
p.yradius = 1;
199+
p.eyeheight = 1;
200+
p.o = vec(0,0,0);
201+
p.yaw = 0;
202+
mpr::EntOBB e(&p);
203+
float l = e.left();
204+
float r = e.right();
205+
assert(l == -r);
206+
assert(l == -2.f);
207+
}
208+
}
178209
}
179210

180211
void test_mpr()
@@ -193,4 +224,5 @@ testing mpr functionality\n\
193224
test_ent_ctor();
194225
test_ent_center();
195226
test_entobb_supportpoint();
227+
test_entobb_left_right();
196228
}

0 commit comments

Comments
 (0)