python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class Point(tuple):

View In Hierarchy

Class representing a point on the 2D plane.

Class Variable __slots__ Undocumented
Method __new__ Creates a new point with the given coordinates
Method __repr__ Returns a nicely formatted representation of the point
Method __getnewargs__ Return self as a plain tuple. Used by copy and pickle.
Class Variable x Undocumented
Class Variable y Undocumented
Method __add__ Adds the coordinates of a point to another one
Method __sub__ Subtracts the coordinates of a point to another one
Method __mul__ Multiplies the coordinates by a scalar
Method __div__ Divides the coordinates by a scalar
Method as_polar Returns the polar coordinate representation of the point.
Method distance Returns the distance of the point from another one.
Method interpolate Linearly interpolates between the coordinates of this point and another one.
Method length Returns the length of the vector pointing from the origin to this point.
Method normalized Normalizes the coordinates of the point s.t. its length will be 1 after normalization. Returns the normalized point.
Method sq_length Returns the squared length of the vector pointing from the origin to this point.
Method towards Returns the point that is at a given distance from this point towards another one.
Class Method FromPolar Constructs a point from polar coordinates.
Class Variable _fields Undocumented
Class Method _make Creates a new point from a sequence or iterable
Method _asdict Returns a new dict which maps field names to their values
Method _replace Returns a new point object replacing specified fields with new values
__slots__ =

Undocumented

(type: tuple)
_fields =

Undocumented

(type: tuple[str, ...])
def __new__(cls, x, y):

Creates a new point with the given coordinates

@classmethod
def _make(cls, iterable, new=tuple.__new__, len=len):

Creates a new point from a sequence or iterable

def __repr__(self):

Returns a nicely formatted representation of the point

def _asdict(self):

Returns a new dict which maps field names to their values

def _replace(self, **kwds):

Returns a new point object replacing specified fields with new values

def __getnewargs__(self):

Return self as a plain tuple. Used by copy and pickle.

x =

Undocumented

y =

Undocumented

def __add__(self, other):

Adds the coordinates of a point to another one

def __sub__(self, other):

Subtracts the coordinates of a point to another one

def __mul__(self, scalar):

Multiplies the coordinates by a scalar

def __div__(self, scalar):

Divides the coordinates by a scalar

def as_polar(self):

Returns the polar coordinate representation of the point.

Returnsthe radius and the angle in a tuple.
def distance(self, other):

Returns the distance of the point from another one.

Example:

>>> p1 = Point(5, 7)
>>> p2 = Point(8, 3)
>>> p1.distance(p2)
5.0
def interpolate(self, other, ratio=0.5):

Linearly interpolates between the coordinates of this point and another one.

Parametersotherthe other point
ratiothe interpolation ratio between 0 and 1. Zero will return this point, 1 will return the other point.
def length(self):

Returns the length of the vector pointing from the origin to this point.

def normalized(self):

Normalizes the coordinates of the point s.t. its length will be 1 after normalization. Returns the normalized point.

def sq_length(self):

Returns the squared length of the vector pointing from the origin to this point.

def towards(self, other, distance=0):

Returns the point that is at a given distance from this point towards another one.

@classmethod
def FromPolar(cls, radius, angle):

Constructs a point from polar coordinates.

`radius` is the distance of the point from the origin; `angle` is the angle between the X axis and the vector pointing to the point from the origin.

API Documentation for python-igraph, generated by pydoctor 21.2.2 at 2021-03-26 11:21:53.