libpysal.cg.Line

class libpysal.cg.Line(m, b)[source]

Geometric representation of line objects.

Attributes
mfloat

slope

bfloat

y-intercept

__init__(self, m, b)[source]

Returns a Line object.

__init__(number, number) -> Line

Test tag: <tc>#is#Line.__init__</tc> Test tag: <tc>#tests#Line.__init__</tc>

Parameters
mthe slope of the line
bthe y-intercept of the line

Examples

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

Methods

__init__(self, m, b)

Returns a Line object.

x(self, y)

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

y(self, x)

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

x(self, y)[source]

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

x(number) -> number

Parameters
ythe y-value to compute x at

Examples

>>> l = Line(0.5, 0)
>>> l.x(0.25)
0.5
y(self, x)[source]

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

y(number) -> number

Parameters
xthe x-value to compute y at

Examples

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