# Find intersection between two Line3

**URL:** <https://discourse.threejs.org/t/find-intersection-between-two-line3/7119>\
**Category:** Questions\
**Tags:** math\
**Created:** [April 16, 2019, 6:00pm UTC](https://discourse.threejs.org/t/find-intersection-between-two-line3/7119 "2019-04-16T18:00:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Lee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mike_lee/32/6460_2.png) [@Mike\_Lee](https://discourse.threejs.org/u/Mike_Lee)\
**Post date:** [April 16, 2019, 6:00pm UTC](https://discourse.threejs.org/t/find-intersection-between-two-line3/7119/1 "2019-04-16T18:00:04Z")

</div>

How can I find the intersecting point between two `Line3`s (if there is any)?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [April 16, 2019, 6:15pm UTC](https://discourse.threejs.org/t/find-intersection-between-two-line3/7119/2 "2019-04-16T18:15:43Z")

</div>

This is actually duplicate from here:

> <https://stackoverflow.com/questions/2316490/the-algorithm-to-find-the-point-of-intersection-of-two-3d-line-segment/2316934#2316934>

You can compute the the shortest distance between two lines in 3D. If the distance is smaller than a certain threshold value, both lines intersect.

---

<div class="post-metadata">

**Author:** ![hofk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hofk/32/44944_2.png) [@hofk](https://discourse.threejs.org/u/hofk)\
**Post date:** [April 16, 2019, 6:43pm UTC](https://discourse.threejs.org/t/find-intersection-between-two-line3/7119/3 "2019-04-16T18:43:26Z")

</div>

Did you see that?

[[SOLVED] How to find intersection between two Rays?](https://discourse.threejs.org/t/solved-how-to-find-intersection-between-two-rays/6464/6)

[http://discourse.threejs.hofk.de/2019/LinesDistance/LinesDistance.html](http://discourse.threejs.hofk.de/2019/LinesDistance/LinesDistance.html) from [Collection of examples from discourse.threejs.org](https://discourse.threejs.org/t/collection-of-examples-from-discourse-threejs-org/4315)

---

<div class="post-metadata">

**Author:** ![Mike\_Lee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mike_lee/32/6460_2.png) [@Mike\_Lee](https://discourse.threejs.org/u/Mike_Lee)\
**Post date:** [April 16, 2019, 7:14pm UTC](https://discourse.threejs.org/t/find-intersection-between-two-line3/7119/4 "2019-04-16T19:14:39Z")

</div>

Thanks for the link! I did not see this before.

> [@\[SOLVED\] How to find intersection between two Rays?](https://discourse.threejs.org/t/solved-how-to-find-intersection-between-two-rays/6464/6):
>
> Thanks @prisoner849 and @hofk !! The missing piece was to use the dot product (which I still have to get my head around) to get the result I was looking for. the method name could use a better name if anyone uses it. function isPositive( start, end, intersection ){ // all parameters are THREE.Vector3() let v1 = new THREE.Vector3().copy( end ).sub( start ); let v2 = new THREE.Vector3().copy( intersection ).sub( start ); return v1.dot( v2 ) \>= 0; } // checks if two line segments will inte…

However, this seems to ignore the Z value. How can I retrieve the Z value for the intersection point as well?
