Added a convenience binding for vector+point

This way, the vector/point sum is commutable.
vector+point == point+vector.
This commit is contained in:
Matthias Koefferlein
2017-10-27 22:02:26 +02:00
parent 374816fe0e
commit d90593df89
2 changed files with 23 additions and 0 deletions
+10
View File
@@ -55,6 +55,11 @@ class DBVector_TestClass < TestBase
b.y = a.y
assert_equal( a, b )
assert_equal( c.to_p.class == RBA::DPoint, true )
assert_equal( c.class == RBA::DVector, true )
assert_equal( (c + RBA::DPoint::new(1, 2)).class == RBA::DPoint, true )
assert_equal( (c + RBA::DPoint::new(1, 2)).to_s, "6,13" )
end
# Transforming DVector
@@ -101,6 +106,11 @@ class DBVector_TestClass < TestBase
b.y = a.y
assert_equal( a, b )
assert_equal( c.to_p.class == RBA::Point, true )
assert_equal( c.class == RBA::Vector, true )
assert_equal( (c + RBA::Point::new(1, 2)).class == RBA::Point, true )
assert_equal( (c + RBA::Point::new(1, 2)).to_s, "6,13" )
end
# Transforming Vector