Point
Added in version 1.0.
- class Point(*args, **kwargs)
A point with two coordinates.
Constructors
- class Point
- classmethod alloc() Point
Allocates a new
Point
structure.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
a
andb
.Added in version 1.0.
- Parameters:
b – a
Point
- equal(b: Point) bool
Checks if the two points
a
andb
point 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
p
to the givenx
andy
coordinates.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
p
with the same coordinates ofsrc
.Added in version 1.0.
- Parameters:
src – the
Point
to use
- init_from_vec2(src: Vec2) Point
Initializes
p
with 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
a
andb
using the givenfactor
.Added in version 1.0.
- Parameters:
b – a
Point
factor – the linear interpolation factor