Point#

class gbox.Point(x: float, y: float)#
distance(x_2: float, y_2: float)#
Parameters:
  • x_2 – x-coordinate

  • y_2 – y-coordinate

Returns:

distance between the current point and (x_2, y_2)

>>> Point(0.0, 0.0).distance(3.0, 4.0)
5.0
slope(x_2: float, y_2: float, eps=1e-16)#
Parameters:
  • x_2 – x-coordinate

  • y_2 – y-coordinate

  • eps – A small number to avoid zero-division errors

Returns:

the slope of the line connecting this points to (x_2, y_2)

>>> Point(0.0, 0.0).slope(3.0, 3.0)
1.0
line_eqn(x_2: float, y_2: float)#

Finds the equation of line connecting this point to (x_2, y_2) :param x_2: :param y_2: :return: a, b, c of the line equation ax + by + c = 0 :rtype: tuple[float, float, float]

>>> Point(0.0, 2.0).line_eqn(-1.0, 6.0)
(-4.0, -1.0, 2.0)