geometry¶
Classes representing geometric coordinates and shapes.
Point¶
Dimensions¶
- class tanmatsu.geometry.Dimensions(w: int, h: int)¶
Dimensions on a 2D plane.
- Variables
w (int) – width (w dimension).
h (int) – height (h dimension).
- set(w: int, h: int)¶
Set the dimensions to w, h.
- duplicate() Self¶
Returns a copy of the dimensions.
- __eq__(other: Dimensions) bool¶
Whether the width and height of this dimensions object is equal to the width and height of the dimensions object other.
- __lt__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether the width and height of this dimensions object are both less than the width and height of object other.
- __le__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether the width and height of this dimensions object are both less than or equal to the width and height of object other.
- __gt__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether the width and height of this dimensions object are both greater than the width and height of object other.
- __ge__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether the width and height of this dimensions object are both greater than or equal to the width and height of object other.
- __str__() str¶
Returns a string representation of the dimensions.
Rectangle¶
- class tanmatsu.geometry.Rectangle(x: int, y: int, w: int, h: int)¶
Coordinates and dimensions on a 2D plane.
- Variables
x (int) – x coordinate.
y (int) – y coordinate.
w (int) – width (w dimension).
h (int) – height (h dimension).
- property x1¶
Alias of x.
- property y1¶
Alias of y.
- property x2: int¶
The coordinate at x + w - 1. I.e., the far x coordinate.
- property y2: int¶
The coordinate at y + h - 1. I.e., the far y coordinate.
- duplicate() Self¶
Returns a copy of this rectangle.
- origin_point() Point¶
Returns the near x, y. In other words, the origin point (top left) of the rectangle.
- end_point() Point¶
Returns the far x, y. In other words, the end point (bottom right) of the rectangle.
- dimensions() Dimensions¶
Returns the dimensions of the rectangle.
- __eq__(other: Rectangle) bool¶
Whether this rectangle’s position in space and dimensions are equal to rectangle other.
- __lt__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether this rectangle’s width and height are both less than the width and height of object other.
- __le__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether this rectangle’s width and height are both less than or equal to the width and height of object other.
- __gt__(other: tanmatsu.geometry.Rectangle | tanmatsu.geometry.Dimensions) bool¶
Whether this rectangle’s width and height are both greater than or equal to the width and height of object other.
- __and__(other: Rectangle) Rectangle¶
Returns the rectangle that represents the overlap between this rectangle and rectangle other.
- __str__() str¶
Returns a string representation of the rectangle.