Point¶
from kurbopy import Point
pt = Point(50.0, 100.0)
- class kurbopy.Point¶
A 2D point.
- ceil()¶
Returns a new Point, with x and y rounded up to the nearest integer, unless they are already an integer.
Examples:
from kurbopy import Point a = Point(3.3, 3.6).ceil() b = Point(3.0, -3.1).ceil() assert a.x == 4.0 assert a.y == 4.0 assert b.x == 3.0 assert b.y == -3.0
- distance(other)¶
Euclidean distance.
- expand()¶
Returns a new Point, with x and y rounded away from zero to the nearest integer, unless they are already an integer.
Examples:
from kurbopy import Point a = Point(3.3, 3.6).expand() b = Point(3.0, -3.1).expand() assert a.x == 4.0 assert a.y == 4.0 assert b.x == 3.0 assert b.y == -4.0
- floor()¶
Returns a new Point, with x and y rounded down to the nearest integer, unless they are already an integer.
Examples:
from kurbopy import Point a = Point(3.3, 3.6).floor() b = Point(3.0, -3.1).floor() assert a.x == 3.0 assert a.y == 3.0 assert b.x == 3.0 assert b.y == -4.0
- is_finite()¶
Is this point finite?
- is_nan()¶
Is this point NaN?
- lerp(other, t)¶
Linearly interpolate between two points.
- midpoint(other)¶
Determine the midpoint of two points.
- round()¶
Returns a new Point, with x and y rounded to the nearest integer.
Examples:
from kurbopy import Point a = Point(3.3, 3.6).round() b = Point(3.0, -3.1).round() assert a.x == 3.0 assert a.y == 4.0 assert b.x == 3.0 assert b.y == -3.0
- to_vec2()¶
Convert this point into a Vec2.
- trunc()¶
Returns a new Point, with x and y rounded towards zero to the nearest integer, unless they are already an integer.
Examples:
from kurbopy import Point a = Point(3.3, 3.6).trunc() b = Point(3.0, -3.1).trunc() assert a.x == 3.0 assert a.y == 3.0 assert b.x == 3.0 assert b.y == -3.0
- x¶
- y¶