Python | método sympy is_collinear()

La función is_collinear() nos permite verificar si los puntos dados (coordenadas) son colineales 
o no. 
 

Syntax: 

Parameters:  x, y, z are coordinates.

Return: True : if points are collinear, otherwise False.

Ejemplo 1: 
 

Python3

# import sympy and geometry module
from sympy import *
from sympy.geometry import *
 
x = Point(0, 0)
y = Point(1, 1)
z = Point(2, 2)
 
# Using Point.is_collinear() method
isTrue = Point.is_collinear(x, y, z)
 
print(isTrue)

Producción: 
 

True

Ejemplo #2: 
 

Python3

# import sympy and geometry module
from sympy import *
from sympy.geometry import *
 
x = Point(1, 0)
y = Point(1, 2)
z = Point(2, 2)
 
# Using Point.is_collinear() method
isTrue = Point.is_collinear(x, y, z)
 
print(isTrue)

Producción: 
 

False

Publicación traducida automáticamente

Artículo escrito por ravikishor y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *