Point

class visualife.diagrams.Point(x, y)

Bases: object

A simple data structure to hold X,Y coordinates on a screen.

Diagram nodes, such as RectNode or DotNode are derived from Point to define their location. The Point class defines also basic arithmetic operations, user can therefore easily compute coordinates of a new node based on existing nodes (e.g. coordinates of a point that is exactly in the middle of two nodes)

Creates a point from the given coordinates

Parameters:
  • x – (number) x viewport coordinate
  • y – (number) y viewport coordinate

Attributes Summary

x
y

Methods Summary

distance_to(another_point) Calculated distance from this Point to another one

Attributes Documentation

x
y

Methods Documentation

distance_to(another_point)

Calculated distance from this Point to another one

Parameters:another_point – another :class:`Point`object
Returns:(float) a distance in viewport coordinates