在已有point的基础上,实现组合类LLine,此类包含俩个point对象p1 p2并实现计算俩点之间距离的函数Distance。L
时间: 2023-05-28 22:07:57 浏览: 60
Line类的定义如下:
```python
class LLine:
def __init__(self, p1, p2):
self.p1 = p1
self.p2 = p2
def Distance(self):
return ((self.p2.x - self.p1.x)**2 + (self.p2.y - self.p1.y)**2)**0.5
```
其中,p1和p2是Point对象,Distance函数计算并返回两个点之间的距离。