51 lines
952 B
Plaintext
Executable File
51 lines
952 B
Plaintext
Executable File
plex Point {
|
|
nat x;
|
|
nat y;
|
|
|
|
init(nat x, nat y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
toS() {
|
|
return "[x:" + (this.x as str) +
|
|
", y:" + (this.y as str) + "]";
|
|
}
|
|
}
|
|
|
|
plex Rect {
|
|
Point top_left;
|
|
Point bottom_right;
|
|
nat width;
|
|
nat height;
|
|
|
|
init(Point tl, Point br, nat width, nat height) {
|
|
this.top_left = tl;
|
|
this.bottom_right = br;
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
toS() {
|
|
return "[top_left:" +
|
|
this.top_left.toS() +
|
|
", bottom_right: " +
|
|
this.bottom_right.toS() +
|
|
", width:" + (this.width as str) +
|
|
", height:" + (this.height as str) + "]";
|
|
}
|
|
}
|
|
|
|
function create_geometry() Rect {
|
|
Point tl(10, 20);
|
|
Point br(100, 50);
|
|
Rect final_rect(tl, br, 90, 180);
|
|
return final_rect;
|
|
}
|
|
|
|
function main() int {
|
|
Rect r = create_geometry();
|
|
print(r.toS());
|
|
return 0;
|
|
}
|