📜  Python| Sympy Line.are_concurrent 方法

📅  最后修改于: 2022-05-13 01:55:36.178000             🧑  作者: Mango

Python| Sympy Line.are_concurrent 方法

在 Sympy 中,函数are_concurrent() 用于检查给定的线性
实体(行)是否并发。两个或更多线性实体是并发的,如果
它们都在一个点相交。
Syntax: Line.are_concurrent(lines)

Parameters:
 lines: a sequence of linear entities.

Returns:
 True:  if the set of linear entities intersect in one point
 False: otherwise.

示例 #1:

# import sympy and Point, Line
from sympy import Point, Line
  
p1, p2 = Point(0, 0), Point(3, 5)
p3, p4 = Point(-2, -2), Point(0, 2)
  
l1, l2, l3 = Line(p1, p2), Line(p1, p3), Line(p1, p4)
  
# using are_concurrent() method
areConcurrent = Line.are_concurrent(l1, l2, l3)
  
print(areConcurrent)

输出:

True

示例 #2:

# import sympy and Point, Line
from sympy import Point, Line
  
p1, p2 = Point(0, 0), Point(3, 5)
p3, p4 = Point(-2, -2), Point(0, 2)
  
l1, l2, l3 = Line(p1, p3), Line(p1, p4), Line(p2, p3)
  
# using are_concurrent() method
areConcurrent = Line.are_concurrent(l1, l2, l3)
  
print(areConcurrent)

输出:

False