# Random walker through points

**URL:** <https://discourse.processing.org/t/random-walker-through-points/18040>\
**Category:** Coding Questions\
**Created:** [February 23, 2020, 8:14am UTC](https://discourse.processing.org/t/random-walker-through-points/18040 "2020-02-23T08:14:08Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 23, 2020, 2:47pm UTC](https://discourse.processing.org/t/random-walker-through-points/18040/13 "2020-02-23T14:47:29Z")

</div>

The 3D idea will not work with your plans to stop a walker when crossing another line though

Better stay 2D…

See [Vector math for line-to-line intersection](https://discourse.processing.org/t/vector-math-for-line-to-line-intersection/5296)

> [@Vector math for line-to-line intersection](https://discourse.processing.org/t/vector-math-for-line-to-line-intersection/5296):
>
> While learning about vectors, I worked through this to better understand line-to-line intersection math instead of simply using it “because it works”. final int N = 4; // Fixed number to make two segments int MAX\_DIST = 20; // Control points PVector[] p = new PVector[N]; boolean held = false; int nearest = -1; float startx = 0; float starty = 0; float DIV\_TOO\_FAR = 0.00001; // Calculates the intersection with vectors. // Surely this uses the same math as solving the equations. // Input: // …

---

_[View the full topic](https://discourse.processing.org/t/random-walker-through-points/18040)._
