geometry.Circle()¶
-
class
feign.geometry.Circle(c, r)¶ A class used to represent a Circle.
- Parameters
c (Point()) – center of Circle
r (float) – radius of Circle
-
r¶ radius of Circle
- Type
float
-
encloses_point(P)¶ The function to assess whether a point is enclosed by a Circle.
- Parameters
P (Point()) – point to decide whether is enclosed by the Circle
- Returns
True if P is enclosed by the Circle, False otherwise
- Return type
bool
Examples
>>> c=Circle(Point(1,1),5) >>> P=Point(3,4) >>> c.encloses_point(P) True >>> Q=Point(4,3) >>> c=Circle(Point(1,1),5) False
-
intersection(seg)¶ The function to find the intersection of a Circle with a Segment.
- Parameters
seg (Segment()) – The Segment for which the intersection is calculated
- Returns
list of the intersection
- Return type
list of Point()
Notes
The returned list has one element if one of the endpoints of the Segment is enclosed by the circle.
The list has two elements if both endpoints of the Segment lies outside the Circle and the Segment passes through the circle.
An empty list is returned if the Segment does not pass through the Circle, or in case the Segment is a tangent.
Examples
>>> c=Circle(Point(1,1),5) >>> s1=Segment(Point(-4,-8),Point(-4,10)) >>> c.intersection(s1) [] >>> s2=Segment(Point(3,1),Point(9,1)) >>> c.intersection(s2) [Point(6.000, 1.000)] >>> s3=Segment(Point(-8,1),Point(9,1)) [Point(6.000, 1.000), Point(-4.000, 1.000)]