Point#
Added in version 1.0.
- class Point(*args, **kwargs)#
A point with two coordinates.
Constructors#
- class Point
- classmethod alloc() Point#
Allocates a new
Pointstructure.The coordinates of the returned point are (0, 0).
It’s possible to chain this function with
init()orinit_from_point(), e.g.:graphene_point_t * point_new (float x, float y) { return graphene_point_init (graphene_point_alloc (), x, y); } graphene_point_t * point_copy (const graphene_point_t *p) { return graphene_point_init_from_point (graphene_point_alloc (), p); }
Added in version 1.0.
Methods#
- class Point
- distance(b: Point) tuple[float, float, float]#
Computes the distance between
aandb.Added in version 1.0.
- Parameters:
b – a
Point
- equal(b: Point) bool#
Checks if the two points
aandbpoint to the same coordinates.This function accounts for floating point fluctuations; if you want to control the fuzziness of the match, you can use
near()instead.Added in version 1.0.
- Parameters:
b – a
Point
- init(x: float, y: float) Point#
Initializes
pto the givenxandycoordinates.It’s safe to call this function multiple times.
Added in version 1.0.
- Parameters:
x – the X coordinate
y – the Y coordinate
- init_from_point(src: Point) Point#
Initializes
pwith the same coordinates ofsrc.Added in version 1.0.
- Parameters:
src – the
Pointto use
- init_from_vec2(src: Vec2) Point#
Initializes
pwith the coordinates inside the givenVec2.Added in version 1.4.
- Parameters:
src – a
Vec2
- interpolate(b: Point, factor: float) Point#
Linearly interpolates the coordinates of
aandbusing the givenfactor.Added in version 1.0.
- Parameters:
b – a
Pointfactor – the linear interpolation factor