IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
Rectangle Class Reference

Public Member Functions

None __init__ (self, Point point, Size size)
 Creates a rectangle from a point and a size.
 
Rectangle create_from_coordinates_and_dimensions (cls, Union[int, float] x, Union[int, float] y, Union[int, float] width, Union[int, float] height)
 Constructs a rectangle from x, y, width and height.
 
bool __eq__ (self, Any other)
 Check if two rectangles are equal.
 
bool __ne__ (self, Any other)
 Check if two rectangles are not equal.
 
str __str__ (self)
 Get a string representation of the rectangle.
 
str __repr__ (self)
 Return an unambiguous string of the Rectangle object.
 
Point position (self)
 Returns the top-left corner of the rectangle.
 
Size size (self)
 Returns the dimensions of the rectangle.
 
Union[int, float] x (self)
 Returns the x-coordinate of the rectangle's top-left corner.
 
Union[int, float] y (self)
 Returns the y-coordinate of the rectangle's top-left corner.
 
Union[int, float] width (self)
 Returns the width of the rectangle.
 
Union[int, float] height (self)
 Returns the height of the rectangle.
 

Protected Attributes

Point _point = point
 
Size _size = size
 

Detailed Description

A rectangle defined by a point and a size.

Represents a rectangle composed of a position (top-left corner) and a size. The position and size types are customizable via template parameters.

Definition at line 10 of file rectangle.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self,
Point point,
Size size )

Creates a rectangle from a point and a size.

Parameters
pointThe top-left corner of the rectangle.
sizeThe dimensions of the rectangle.

Definition at line 21 of file rectangle.py.

Member Function Documentation

◆ __eq__()

bool __eq__ ( self,
Any other )

Check if two rectangles are equal.

Parameters
otherAnother rectangle object OR List of coordinates [x,y,width,height] OR Tuple of coordinates (x,y,width,height)
Returns
True if rectangles are equal, False otherwise

Definition at line 58 of file rectangle.py.

◆ __ne__()

bool __ne__ ( self,
Any other )

Check if two rectangles are not equal.

Parameters
otherAnother rectangle object
Returns
True if rectangles are not equal, False otherwise

Definition at line 78 of file rectangle.py.

◆ __repr__()

str __repr__ ( self)

Return an unambiguous string of the Rectangle object.

Definition at line 99 of file rectangle.py.

◆ __str__()

str __str__ ( self)

Get a string representation of the rectangle.

Returns
String representation of the rectangle

Definition at line 89 of file rectangle.py.

◆ create_from_coordinates_and_dimensions()

Rectangle create_from_coordinates_and_dimensions ( cls,
Union[int, float] x,
Union[int, float] y,
Union[int, float] width,
Union[int, float] height )

Constructs a rectangle from x, y, width and height.

Parameters
xx coordinate of the upper left corner
yy coordinate of the upper left corner
widthWidth of the rectangle
heightHeight of the rectangle

Definition at line 39 of file rectangle.py.

◆ height()

Union[int, float] height ( self)

Returns the height of the rectangle.

Definition at line 148 of file rectangle.py.

◆ position()

Point position ( self)

Returns the top-left corner of the rectangle.

Definition at line 108 of file rectangle.py.

◆ size()

Size size ( self)

Returns the dimensions of the rectangle.

Definition at line 116 of file rectangle.py.

◆ width()

Union[int, float] width ( self)

Returns the width of the rectangle.

Definition at line 140 of file rectangle.py.

◆ x()

Union[int, float] x ( self)

Returns the x-coordinate of the rectangle's top-left corner.

Definition at line 124 of file rectangle.py.

◆ y()

Union[int, float] y ( self)

Returns the y-coordinate of the rectangle's top-left corner.

Definition at line 132 of file rectangle.py.

Field Documentation

◆ _point

Point _point = point
protected

Definition at line 33 of file rectangle.py.

◆ _size

_size = size
protected

Definition at line 34 of file rectangle.py.