Point

class pyscan.Point(a, b, c)

This is a point class. Internally the data is represented using a homogenous coordinate system. For those not familiar this means that a homogenous coordinate \((a, b, c)\) in standard coordinates would be \((a / c, b / c)\)). These points can also be used to represent lines in which case the homogenous coordinate \((a, b, c)\) is the line \(a x + b y + c = 0\).

Parameters:
  • a – double
  • b – double
  • c – double
>>> import pyscan
>>> p1 = pyscan.Point(1.0, 2.0, 1.0)
>>> p2 = pyscan.Point(5.0, 10.0, 1.0)
>>> p1.approx_eq(p2)
False
>>> p1.parallel_lte(p2)
True
>>> p1.evaluate(p2)
26.0
>>> p1[0]
1.0
Point.approx_eq(p_other)

Checks to see if these points are approximately the same. Internally compares floats using float distance.

Parameters:p_other – Another Point object.
Return type:True or False.
Point.__getitem__(index)

Returns the value at the standard coordinate index.

Parameters:index – An integer.
Return type:A double.
Point.get_coord(index)

Returns the homogenous coordinate at index.

Parameters:index – An integer.
Return type:A double.
Point.above(pt)

Returns whether this point is above the line represented by pt. Note that a line and point can have an upward or downward orientation.

Parameters:pt – A line (or point).
Return type:boolean.
Point.above_closed(pt)

Returns whether this point is above the line or contained inside of the line represented by pt. Note that a line and point can have an upward or downward orientation.

Parameters:pt – A line (or point).
Return type:boolean.
Point.below(pt)

Returns whether this point is below the line represented by pt. Note that a line and point can have an upward or downward orientation.

Parameters:pt – A line (or point).
Return type:boolean.
Point.below_closed(pt)

Returns whether this point is below the line or contained inside of the line represented by pt. Note that a line and point can have an upward or downward orientation.

Parameters:pt – A line (or point).
Return type:boolean.
Point.crosses(p1, p2)

Returns whether the line represented by the homogenous coordinates in point crosses the line segment between p1 and p2. In the dual formulation this can be thought of as checking if this point lies inside of the double wedge defined by the lines p1 and p2.

Parameters:
  • p1 – A point(or line).
  • p2 – A point(or line).
Return type:

boolean.

Point.evaluate(pt)

Takes the dot product between this point’s and the argument’s homogenous coordinates.

Parameters:p1 – A point(or line).
Return type:double
Point.orient_down(ix)

Ensures that the line’s normal is oriented such that ix coordinate of the normal is negative.

Parameters:ix – Integer between 0 and 2.
Return type:Point
Point.orient_up(ix)

Ensures that the line’s normal is oriented such that ix coordinate of the normal is positive.

Parameters:ix – Integer between 0 and 2.
Return type:Point
Point.dist(pt)

Returns the euclidean distance between this point and pt.

Parameters:pt – Point object
Return type:double
Point.pdot(pt)

Dot product using the normalized coordinates.

Parameters:pt – Point object
Return type:double
Point.parallel_lt(pt)

Checks to see if this line is parallel to the line represented by pt and also happens to be less than it in terms of their orientations.

Parameters:pt – Point object
Return type:bool
Point.parallel_lte(pt)

Checks to see if this line is parallel to the line represented by pt and also happens to be less than or equal to it in terms of their orientations.

Parameters:pt – Point object
Return type:bool
class pyscan.WPoint(weight, a, b, c)

This inherits all the methods that Point has, but also has positive weight.

Parameters:
  • weight – double
  • a – double
  • b – double
  • c – double
WPoint.get_weight()

Returns this points weight.

Return type:double
class pyscan.LPoint(label, weight, a, b, c)

This inherits all the methods that WPoint has, but also has a integer label.

Parameters:
  • label – A non negative integer.
  • weight – double
  • a – double
  • b – double
  • c – double
LPoint.get_label()

Returns this points label.

Return type:integer
LPoint.get_label()

Returns this points label.

Return type:integer
class pyscan.Point3(a, b, c, d)

Same methods as Point, but for 3d points.

class pyscan.WPoint3(weight, a, b, c, d)
class pyscan.LPoint3(label, weight, a, b, c, d)