geometry.Segment()

class feign.geometry.Segment(p, q)

A class used to represent a Segment.

Parameters
  • p (Point()) – first end point of Segment

  • q (Point()) – second end point of Segment

p

first end point of Segment

Type

Point()

q

second end point of Segment

Type

Point()

slope

slope of the line (np.Inf if vertical)

Type

float

intercept

intercept on the y axis (intercept on the x axis if vertical)

Type

float

points

list of p and q

Type

list of Point()

intersection(other)

The function to find the intersection of two Segment objects.

Parameters

other (Segment()) – The Segment() for which the intersection is calculated

Returns

list of the intersections

Return type

list of Point()

Notes

The list has one element if the Segments intersect (even if only through their end points).

An empty list is returned if the Segments do not have an intersection.

Examples

>>> s1=Segment(Point(2,2),Point(-2,-2))
>>> s2=Segment(Point(-2,2),Point(2,-2))
>>> s1.intersection(s2)
 [Point(0.000, 0.000)]
>>> s3=Segment(Point(-3,-4),Point(-6,-7))
>>> s1.intersection(s3)
 []
rotate(alpha)

The function to rotate a Segment around the origin with alpha (deg)

Parameters

alpha (float) – Rotation angle (in degrees)

Returns

Segment with rotated end points

Return type

Segment()