nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/gamnit: intro draw_mode
[nit.git]
/
lib
/
geometry
/
boxes.nit
diff --git
a/lib/geometry/boxes.nit
b/lib/geometry/boxes.nit
index
fc35c20
..
6ecf483
100644
(file)
--- a/
lib/geometry/boxes.nit
+++ b/
lib/geometry/boxes.nit
@@
-120,48
+120,31
@@
class Box[N: Numeric]
assert left != null and right != null and top != null and bottom != null
assert left != null and right != null and top != null and bottom != null
- self.left = left
- self.right = right
- self.top = top
- self.bottom = bottom
+ init(left, right, top, bottom)
end
# Create a `Box` using left, right, bottom and top
init lrbt(left, right, bottom, top: N)
do
end
# Create a `Box` using left, right, bottom and top
init lrbt(left, right, bottom, top: N)
do
- self.left = left
- self.right = right
- self.top = top
- self.bottom = bottom
+ init(left, right, top, bottom)
end
# Create a `Box` using left, right, top and bottom
init lrtb(left, right, top, bottom: N)
do
end
# Create a `Box` using left, right, top and bottom
init lrtb(left, right, top, bottom: N)
do
- self.left = left
- self.right = right
- self.top = top
- self.bottom = bottom
+ init(left, right, top, bottom)
end
# Create a `Box` using left, bottom, width and height
init lbwh(left, bottom, width, height: N)
do
end
# Create a `Box` using left, bottom, width and height
init lbwh(left, bottom, width, height: N)
do
- self.left = left
- self.bottom = bottom
-
- self.right = left + width
- self.top = bottom + height
+ init(left, left + width, bottom + height, bottom)
end
# Create a `Box` using left, top, width and height
init ltwh(left, top, width, height: N)
do
end
# Create a `Box` using left, top, width and height
init ltwh(left, top, width, height: N)
do
- self.left = left
- self.top = top
-
- self.right = left + width
- self.bottom = top - height
+ init(left, left+width, top, top - height)
end
redef fun to_s do return "<left: {left}, right: {right}, top: {top}, bottom: {bottom}>"
end
redef fun to_s do return "<left: {left}, right: {right}, top: {top}, bottom: {bottom}>"
@@
-232,6
+215,8
@@
class Box3d[N: Numeric]
# assert box.right == 4 and box.top == 4
init around(boxed: Boxed3d[N]...)
do
# assert box.right == 4 and box.top == 4
init around(boxed: Boxed3d[N]...)
do
+ super
+
assert not boxed.is_empty
var left: nullable N = null
assert not boxed.is_empty
var left: nullable N = null