# libpysal.cg.Line

class libpysal.cg.Line(m, b)

  Geometric representation of line objects.

  Parameters:
    m{`python:int`, `python:float`}

      The slope of the line. `m` is also an attribute.

    b{`python:int`, `python:float`}

      The \(y\)-intercept of the line. `b` is also an attribute.

  Raises:
    `ArithmeticError`

      Raised when infinity is passed in as the slope.

  Examples

      >>> ls = Line(1, 0)
      >>> ls.m
      1.0

      >>> ls.b
      0.0

  __init__(m, b)

  Methods

  `__init__`(m, b) |
  `x`(y) | Returns the \(x\)-value of the line at a particular \(y\)-value.
  `y`(x) | Returns the \(y\)-value of the line at a particular \(x\)-value.

  x(y: int | float) → float

    Returns the \(x\)-value of the line at a particular \(y\)-value.

    Parameters:
      y{`python:int`, `python:float`}

        The \(y\)-value at which to compute \(x\).

    Raises:
      `ArithmeticError`

        Raised when `0.` is passed in as the slope.

    Examples

        >>> l = Line(0.5, 0)
        >>> l.x(0.25)
        0.5

  y(x: int | float) → float

    Returns the \(y\)-value of the line at a particular \(x\)-value.

    Parameters:
      x{`python:int`, `python:float`}

        The \(x\)-value at which to compute \(y\).

    Examples

        >>> l = Line(1, 0)
        >>> l.y(1)
        1.0