Open In App

Python | Sympy is_tangent() method

Last Updated : 27 Sep, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

In Sympy, the function is_tangent() is used to check whether the given line is tangent to the given circle or not.

Syntax:  Circle().is_tangent(line)

Return: True:if line is tangent to circle, otherwise False.

Example #1:




# import sympy and geometry module
from sympy import * 
from sympy.geometry import * 
  
x = Point(0, 0)
  
# making line with given points
l = Line(Point(5, -5), Point(5, 5))
  
# making circle with Circle() of 
# radius 5 and using is_tangent()
isTangent = Circle(x, 5).is_tangent(l)
  
print(isTangent)


Output:

True

Example #2:




# import sympy and geometry module
from sympy import * 
from sympy.geometry import * 
  
x = Point(0, 0)
y = Point(1, 1)
  
# making line with given points
l = Line(x, y)
  
# making circle with Circle() of radius 5 and using is_tangent()
isTangent = Circle(x, 5).is_tangent(l)
  
print(isTangent)


Output:

False


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads