class_docstr: Class representing a rectangle.
class_docstr_tok: ["Class","representing","a","rectangle","."]
docstr: Creates a rectangle.
  
  The corners of the rectangle can be specified by either a tuple
  (four items, two for each corner, respectively), four separate numbers
  (X and Y coordinates for each corner) or two separate numbers (width
  and height, the upper left corner is assumed to be at (0,0))
docstr_tok: ["Creates","a","rectangle",".","The","corners","of","the","rectangle","can","be","specified","by","either","a","tuple","(","four","items",",","two","for","each","corner",",","respectively",")",",","four","separate","numbers","(","X","and","Y","coordinates","for","each","corner",")","or","two","separate","numbers","(","width","and","height",",","the","upper","left","corner","is","assumed","to","be","at","(","0,0",")",")"]
code: def __init__(self, *args):
      """Creates a rectangle.
  
      The corners of the rectangle can be specified by either a tuple
      (four items, two for each corner, respectively), four separate numbers
      (X and Y coordinates for each corner) or two separate numbers (width
      and height, the upper left corner is assumed to be at (0,0))"""
      coords = None
      if len(args) == 1:
          if isinstance(args[0], Rectangle):
              coords = args[0].coords
          elif len(args[0]) >= 4:
              coords = tuple(args[0])[0:4]
          elif len(args[0]) == 2:
              coords = (0, 0, args[0][0], args[0][1])
      elif len(args) == 4:
          coords = tuple(args)
      elif len(args) == 2:
          coords = (0, 0, args[0], args[1])
      if coords is None:
          raise ValueError("invalid coordinate format")
  
      try:
          coords = tuple(float(coord) for coord in coords)
      except ValueError:
          raise ValueError(
              "invalid coordinate format, numbers expected"
          ) from None
  
      self.coords = coords
  
imports: from collections import defaultdict
  from math import atan2, cos, hypot, sin
  from typing import NamedTuple
  from igraph.utils import consecutive_pairs
label_desc: Use image node_id 1 to create a new Rectangle object  with example: obj = Rectangle()