# [面试题 16.03. 交点](https://leetcode.cn/problems/intersection-lcci)

[English Version](/lcci/16.03.Intersection/README_EN.md)

## 题目描述

<!-- 这里写题目描述 -->
<p>给定两条线段(表示为起点<code>start = {X1, Y1}</code>和终点<code>end = {X2, Y2}</code>),如果它们有交点,请计算其交点,没有交点则返回空值。</p>
</p>要求浮点型误差不超过<code>10^-6</code>。若有多个交点(线段重叠)则返回X值最小的点,X坐标相同则返回Y值最小的点。</p>
<p><strong>示例 1:</strong></p>
<pre><strong>输入:</strong>
line1 = {0, 0}, {1, 0}
line2 = {1, 1}, {0, -1}
<strong>输出:</strong> {0.5, 0}
</pre>
<p><strong>示例 2:</strong></p>
<pre><strong>输入:</strong>
line1 = {0, 0}, {3, 3}
line2 = {1, 1}, {2, 2}
<strong>输出:</strong> {1, 1}
</pre>
<p><strong>示例 3:</strong></p>
<pre><strong>输入:</strong>
line1 = {0, 0}, {1, 1}
line2 = {1, 0}, {2, 1}
<strong>输出:</strong> {},两条线段没有交点
</pre>
<p><strong>提示:</strong></p>
<ul>
<li>坐标绝对值不会超过2^7</li>
<li>输入的坐标均是有效的二维坐标</li>
</ul>

## 解法

<!-- 这里可写通用的实现逻辑 -->
<!-- tabs:start -->

### **Python3**

<!-- 这里可写当前语言的特殊实现逻辑 -->

```python

```

### **Java**

<!-- 这里可写当前语言的特殊实现逻辑 -->

```java

```

### **...**

```

```

<!-- tabs:end -->