Python| Sympy Segment.perpendicular_bisector() 方法
在 Sympy 中,函数vertical_bisector
perpendicular_bisector()
用于找到给定线段的垂直平分线。如果没有指定点或指定的点不在等分线上,则等分线作为直线返回。否则,返回连接指定点和平分线与线段交点的段。 Syntax: Segment.perpendicular_bisector(p=None)
Parameters:
p: Point
Returns:
bisector: Line or Segment
示例 #1:
# import sympy and Point, Segment
from sympy import Point, Segment
p1, p2, p3 = Point(0, 0), Point(6, 6), Point(5, 1)
s1 = Segment(p1, p2)
# using perpendicular_bisector() method
perpendicularBisector = s1.perpendicular_bisector()
print(perpendicularBisector)
输出:
Line2D(Point2D(3, 3), Point2D(-3, 9))
示例 #2:
# import sympy and Point, Segment
from sympy import Point, Segment
p1, p2, p3 = Point(0, 0), Point(6, 6), Point(5, 1)
s1 = Segment(p1, p2)
# using perpendicular_bisector() method
perpendicularBisector = s1.perpendicular_bisector(p3)
print(perpendicularBisector)
输出:
Segment2D(Point2D(5, 1), Point2D(3, 3))