Introducing world box.

This commit is contained in:
Matthias Koefferlein 2022-02-07 22:44:35 +01:00
parent 79be9aba41
commit 0bb0f400bf
2 changed files with 35 additions and 0 deletions

View File

@ -49,6 +49,11 @@ struct box_defs
return c.release ();
}
static C world ()
{
return C::world ();
}
static C *new_v ()
{
return new C ();
@ -132,6 +137,22 @@ struct box_defs
"are not provided in the correct order (i.e. right < left), these are "
"swapped."
) +
method ("world", &world,
"@brief Gets the 'world' box\n"
"The world box is the biggest box that can be represented. So it is basically 'all'. The "
"world box behaves neutral on intersections for example. In other operations such as displacement or transformations, "
"the world box may render unexpected results because of coordinate overflow.\n"
"\n"
"The world box can be used\n"
"@ul\n"
" @li for comparison ('==', '!=', '<') @/li\n"
" @li in union and intersection ('+' and '&') @/li\n"
" @li in relations (\\contains?, \\overlaps?, \\touches?) @/li\n"
" @li as 'all' argument in region queries @/li\n"
"@/ul\n"
"\n"
"This method has been introduced in version 0.28."
) +
method ("p1", &C::p1,
"@brief Gets the lower left point of the box\n"
) +

View File

@ -106,6 +106,13 @@ class DBBox_TestClass < TestBase
a = RBA::DBox.new
assert_equal( a.empty?, true )
a = RBA::DBox::world
b = RBA::DBox::new(1, 2, 3, 4)
assert_equal( a.empty?, false )
assert_equal( a == RBA::DBox::world, true )
assert_equal( (a + b) == RBA::DBox::world, true )
assert_equal( (a & b) == b, true )
end
# DBox basics
@ -303,6 +310,13 @@ class DBBox_TestClass < TestBase
a = RBA::Box.new
assert_equal( a.empty?, true )
a = RBA::Box::world
b = RBA::Box::new(1, 2, 3, 4)
assert_equal( a.empty?, false )
assert_equal( a == RBA::Box::world, true )
assert_equal( (a + b) == RBA::Box::world, true )
assert_equal( (a & b) == b, true )
end
# Box basics