IDS peak ICV v1.5.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.

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.

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

◆ __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

◆ __repr__()

str __repr__ ( self)

Return an unambiguous string of the Rectangle object.

◆ __str__()

str __str__ ( self)

Get a string representation of the rectangle.

Returns
String representation of the rectangle

◆ 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

◆ height()

Union[int, float] height ( self)

Returns the height of the rectangle.

◆ position()

Point position ( self)

Returns the top-left corner of the rectangle.

◆ size()

Size size ( self)

Returns the dimensions of the rectangle.

◆ width()

Union[int, float] width ( self)

Returns the width of the rectangle.

◆ x()

Union[int, float] x ( self)

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

◆ y()

Union[int, float] y ( self)

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

Field Documentation

◆ _point

Point _point = point
protected

◆ _size

_size = size
protected