RectD

Synopsis

A rectangle defined with floating point precision. See detailed description below

Functions

Detailed Description

A rectangle where x1 < x2 and y1 < y2 such as width() == (x2 - x1) && height() == (y2 - y1) (x1,y1) is are the coordinates of the bottom left corner of the rectangle. The last element valid in the y dimension is y2 - 1 and the last valid in the x dimension is x2 - 1. x1,x2,y1 and y2 are with floating point precision.

Member functions description

NatronEngine.RectD.area()
Return type:double

Returns the area covered by the rectangle, that is: (y2 - y1) * (x2 - x1)

NatronEngine.RectD.bottom()
Return type:double

Returns the bottom edge, that is the

NatronEngine.RectD.clear()

Same as set (0,0,0,0)

NatronEngine.RectD.contains(otherRect)
Parameters:otherRectRectD
Return type:bool

Returns True if otherRect is contained in or equals this rectangle, that is if:

otherRect.x1 >= x1 and
otherRect.y1 >= y1 and
otherRect.x2 <= x2 and
otherRect.y2 <= y2
NatronEngine.RectD.height()
Return type:double

Returns the height of the rectangle, that is: y2 - y1

NatronEngine.RectD.intersect(otherRect)
Parameters:otherRectRectD
Return type:RectD

Returns the intersection between this rectangle and otherRect. If the intersection is empty, the return value will have the isNull() function return True.

NatronEngine.RectD.intersects(otherRect)
Parameters:otherRectRectD
Return type:bool

Returns True if rectangle and otherRect intersect.

NatronEngine.RectD.isInfinite()
Return type:bool

Returns True if this rectangle is considered to cover an infinite area. Some generator effects use this to indicate that they can potentially generate an image of infinite size.

NatronEngine.RectD.isNull()
Return type:bool

Returns true if x2 <= x1 or y2 <= y1

NatronEngine.RectD.left()
Return type:double

Returns x1, that is the position of the left edge of the rectangle.

NatronEngine.RectD.merge(otherRect)
Parameters:otherRectRectD

Unions this rectangle with otherRect. In other words, this rectangle becomes the bounding box of this rectangle and otherRect.

NatronEngine.RectD.left()
Return type:double

Returns x1, that is the position of the left edge of the rectangle.

NatronEngine.RectD.right()
Return type:double

Returns x2, that is the position of the right edge of the rectangle. x2 is considered to be the first element outside the rectangle.

NatronEngine.RectD.set(x1, y1, x2, y2)
Parameters:
  • x1double
  • y1double
  • x2double
  • y2double

Set the x1, y1, x2, y2 coordinates of this rectangle.

NatronEngine.RectD.set_bottom(y1)
Parameters:y1double

Set y1

NatronEngine.RectD.set_left(x1)
Parameters:y1double

Set x1

NatronEngine.RectD.set_right(x2)
Parameters:x2double

Set x2

NatronEngine.RectD.set_top(y2)
Parameters:y2double

Set y2

NatronEngine.RectD.top()
Return type:double

Returns y2, that is the position of the top edge of the rectangle. y2 is considered to be the first element outside the rectangle.

NatronEngine.RectD.translate(dx, dy)
Parameters:
  • dxdouble
  • dydouble

Moves all edges of the rectangle by dx, dy, that is:

x1 += dx;
y1 += dy;
x2 += dx;
y2 += dy;
NatronEngine.RectD.width()
Return type:double

Returns the width of the rectangle, that is x2 - x1.