Geometry

Helper functions for constructing arrows and the analysis graph.

You are unlikely to need these, but they are included here for reference.

gifpgn.geometry.angle_between_two_points(point1: Coord, point2: Coord) float[source]

Returns the angle of a line between two points in radians

Parameters:
  • point1 (Coord)

  • point2 (Coord)

Return float:

Radians

gifpgn.geometry.line_intersection(line1: Tuple[Coord, Coord], line2: Tuple[Coord, Coord]) Coord | None[source]

Returns the intersection point of two lines of infinite length, or None if no intersection

Parameters:
  • line1 (Tuple[Coord, Coord])

  • line2 (Tuple[Coord, Coord])

Return Optional[Coord]:

gifpgn.geometry.rotate_around_point(point: Coord, radians: float, origin: Coord) Coord[source]

Rotates point around origin by radians

Parameters:
  • point (Coord)

  • radians (float)

  • origin (Coord) – defaults to (0, 0)

Return Coord:

gifpgn.geometry.shorten_line(c1: Coord, c2: Coord, pix: int) Tuple[Coord, Coord][source]

Shortens a line between two points by set number of pixels from the second point

Parameters:
  • c1 (Coord)

  • c2 (Coord)

  • pix (int)

Return Tuple[Coord,Coord]: