earwax.point module¶
Provides the Point class.
-
class
earwax.point.
Point
(x: T, y: T, z: T)¶ Bases:
typing.Generic
A point in 3d space.
-
angle_between
(other: earwax.point.Point) → float¶ Return the angle between two points.
Parameters: other – The other point to get the angle to.
-
coordinates
¶ Return
self.x
,self.y
, andself.z
as a tuple.
-
copy
() → earwax.point.Point[~T][T]¶ Copy this instance.
Returns a
Point
instance with duplicatex
andy
values.
-
directions_to
(other: earwax.point.Point) → earwax.point.PointDirections¶ Return the direction between this point and
other
.Parameters: other – The point to get directions to.
-
distance_between
(other: earwax.point.Point) → float¶ Return the distance between two points.
Parameters: other – The point to measure the distance to.
-
floor
() → earwax.point.Point[int][int]¶ Return a version of this object with both coordinates floored.
-
in_direction
(angle: float, distance: float = 1.0) → earwax.point.Point[float][float]¶ Return the coordinates in the given direction.
Parameters: - angle – The direction of travel.
- distance – The distance to travel.
-
classmethod
origin
() → earwax.point.Point[int][int]¶ Return
Point(0, 0, 0)
.
-
classmethod
random
(a: earwax.point.Point[int][int], b: earwax.point.Point[int][int]) → PointType¶ Return a random point between
a
, andb
.Parameters: - a – The first point.
- b – The second point.
-
-
class
earwax.point.
PointDirections
¶ Bases:
enum.Enum
Point directions enumeration.
Most of the possible directions between two
Point
instances.There are no vertical directions defined, although they would be easy to include.
-
east
= 3¶
-
here
= 0¶
-
north
= 1¶
-
northeast
= 2¶
-
northwest
= 8¶
-
south
= 5¶
-
southeast
= 4¶
-
southwest
= 6¶
-
west
= 7¶
-