# 3D Crosswalk: Perspective Anamorphism as a Nudge for Pedestrian Safety

**URL:** <https://community.wolfram.com/t/3d-crosswalk-perspective-anamorphism-as-a-nudge-for-pedestrian-safety/14152>\
**Category:** Staff Picks\
**Tags:** image-processing, optics, equation-solving, geometry, interface-construction, staff-pick\
**Created:** [May 29, 2019, 2:12pm UTC](https://community.wolfram.com/t/3d-crosswalk-perspective-anamorphism-as-a-nudge-for-pedestrian-safety/14152 "2019-05-29T14:12:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erikmahieu](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/erikmahieu/32/8091_2.png) [@erikmahieu](https://community.wolfram.com/u/erikmahieu)\
**Post date:** [May 29, 2019, 2:12pm UTC](https://community.wolfram.com/t/3d-crosswalk-perspective-anamorphism-as-a-nudge-for-pedestrian-safety/14152/1 "2019-05-29T14:12:07Z")

</div>

It started in [India(left)](https://interestingengineering.com/two-women-design-super-cool-3d-painted-crosswalk-india) and was adapted in [Iceland (mid)](https://www.boredpanda.com/3d-pedestrian-crossing-island/?utm_source=google&utm_medium=organic&utm_campaign=organic). Now you can see it as experiments in several villages in Holland and [Belgium(right)](https://www.hln.be/nieuws/binnenland/agentschap-wegen-en-verkeer-test-op-drie-locaties-3d-zebrapaden-uit~aed03261/). They are called 3D crosswalks and are part of a new trend in traffic safety called “nudging” or helping drivers become more aware of dangerous situations by small indirect suggestions.

 ![3crosswalksintro.jpg](https://global.discourse-cdn.com/wolfram/original/2X/4/420fcf21d77c682496eaebd82853c6bb92072534.jpeg)

This visual illusion of “floating blocks” are a perfect example of perspective anamorphism. We can use Mathematica to visualize and make a template to paint this new, and allegedly safer, type of crosswalk.

 ![6685geometry.png](https://global.discourse-cdn.com/wolfram/original/2X/7/7e6dfdcb948b83b2f6137799fb52eff4bd12493c.png)

P is a vertex of one of the 3D roadblock cuboids. We are interested in two projections of P to the street level (the z==0 plane): Pr starting from the driver’s view point V and Ps (the shadow), starting form the sun S or light source. We do this for all the vertices of the road blocks and we convert a set of 3D primitives into a 2D graphics of the blocks and their shadow that can be painted on the street.

This function computes the projection a point pt from the viewPt to the plane z==0 .

```
project[pt_List, viewPt : {xv_, yv_, zv_}] := 
 Module[{base, viewLine},
  base = InfinitePlane[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}];
  viewLine = HalfLine[{viewPt, pt}];
  NSolve[{x, y, z} \[Element] viewLine && {x, y, z} \[Element] 
      base, {x, y, z}][[1, All, -1]]]

```

This Manipulate makes all these computations for a whole set of parameters. You can use it to make a template for making your own crosswalk proposal and maybe make your neighborhood street more safe for pedestrians?!

```
Manipulate[
 Module[{stripeWidth, step, viewPt, sun, road, fronts, tops, lefts, 
   rights, shadow},
  step = 51/(n - 1); stripeWidth = sFr step; viewPt = {vx, -vy, vz}; 
  sun = {sx, sy, sz}; 
  road = InfinitePlane[{{0, 0, -.01}, {1, 0, -.01}, {0, 1, -.01}}]; 
  fronts = ParallelTable[{{p, 5, sH}, {stripeWidth + p, 5, 
      sH}, {stripeWidth + p, 5, sH + sTh}, {p, 5, sH + sTh}}, {p, 
     Range[0, 51, step]}]; 
  tops = ParallelTable[{{stripeWidth + p, 5, sTh + sH}, {p, 5, 
      sTh + sH}, {p, 5 + sL, sTh + sH}, {stripeWidth + p, 5 + sL, 
      sTh + sH}}, {p, Range[0, 51, step]}]; 
  lefts = ParallelTable[{{p, 5, sH}, {p, 5, sTh + sH}, {p, 5 + sL, 
      sTh + sH}, {p, 5 + sL, sH}}, {p, Range[0, 51, step]}]; 
  rights = ParallelTable[{{stripeWidth + p, 5, sH}, {stripeWidth + p, 
      5, sTh + sH}, {stripeWidth + p, 5 + sL, 
      sTh + sH}, {stripeWidth + p, 5 + sL, sH}}, {p, 
     Range[0, 51, step]}]; 
  shadow = ParallelMap[project[#1, sun] &, tops, {2}];
  Column[{Graphics3D[{{Gray, road}, {Red, 
       Ball[viewPt, .1]}, {Lighter[Black, .05], 
       Polygon /@ shadow}, {{Lighter[Gray, .55], 
        ParallelMap[Polygon, lefts]}, {Lighter[Gray, .55], 
        ParallelMap[Polygon, rights]}, {White, 
        ParallelMap[Polygon, tops]}, {Lighter[Black, .35], 
        ParallelMap[Polygon, fronts]}}, {White, AbsoluteThickness[6], 
       Line[{{-2, -10, 0}, {-2, 40, 0}}], 
       Line[{{n step, -10, 0}, {n step, 40, 0}}]}}, Boxed -> False, 
     ViewCenter -> {{0.5`, 0.5`, 0.5`}, {0.5`, 0.734}}, 
     ViewPoint -> .75 {0., -5, 1.}, 
     PlotRange -> {Automatic, {-10, 40}, Automatic}, 
     Lighting -> {{"Ambient", White}}, ImageSize -> {550, 200}, 
     PlotLabel -> 
      Style["3D: what an approaching driver sees", 15, Bold]], 
    Graphics[{{Black, Polygon /@ shadow}, {Lighter[Gray, 0.5`], 
        Polygon[ParallelMap[project[#1, viewPt] &, 
          rights, {2}]]}, {Lighter[Gray, .75], 
        Polygon[ParallelMap[project[#1, viewPt] &, 
          lefts, {2}]]}, {White, 
        Polygon[ParallelMap[project[#1, viewPt] &, 
          tops, {2}]]}, {Lighter[Black, .35], 
        Polygon[ParallelMap[project[#1, viewPt] &, 
          fronts, {2}]]}} /. {x_?NumericQ, y_, z_} :> {x, y}, 
     Background -> Gray, ImageSize -> 550, 
     PlotLabel -> 
      Style["2D: what is painted on the road", White, 15, Bold]]}]],
 Style["driver view position", Bold], {{vx, 27, "view pos-x"}, 
  None}, {{vy, 25, "view distance"}, 1, 50, 1, 
  Appearance -> "Labeled", 
  ImageSize -> Small}, {{vz, 15, "view height"}, 10, 25, 1, 
  Appearance -> "Labeled", ImageSize -> Small}, Delimiter, 
 Style["sun position (for shadows)", 
  Bold], {{sy, 50, 1, "sun distance"}, 
  None}, {{sx, 28., "direction"}, -50, 150, 1, 
  Appearance -> "Labeled", ImageSize -> Small}, {{sz, 350, "height"}, 
  200, 1000, 5, Appearance -> "Labeled", 
  ImageSize -> Small}, Delimiter, 
 Style["stripes specification", Bold], {{n, 11, "number of stripes"}, 
  Range[6, 15]}, {{sFr, .65, "width as fraction of step"}, 
  Range[.5, .75, .05]}, {{sH, 2., "height above road"}, .01, 5, .01, 
  Appearance -> "Labeled", ImageSize -> Small}, {{sL, 16, "lenght"}, 
  5, 20, .1, Appearance -> "Labeled", 
  ImageSize -> Small}, {{sTh, 1.25, "thickness"}, .5, 2.5, .01, 
  Appearance -> "Labeled", ImageSize -> Small}]

```

 ![3239manipulate.png](https://global.discourse-cdn.com/wolfram/original/3X/6/4/6498551142711135335b15ffcbdffa59349323f9.png)

I could not paint a printout on the street in my home town but I printed a smaller version on paper (right), put in on my desktop and simulated what a car driver would see (left) looking at the “crosswalk”.

 ![makeshifcrosswalk.jpg](https://global.discourse-cdn.com/wolfram/original/3X/8/5/8572ca518c4da4d9d4117c018e7cf92dcf14647f.jpeg)

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [June 4, 2019, 9:55am UTC](https://community.wolfram.com/t/3d-crosswalk-perspective-anamorphism-as-a-nudge-for-pedestrian-safety/14152/2 "2019-06-04T09:55:36Z")

</div>

![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)

- Congratulations! This post is now featured in our [Staff Pick](http://community.wolfram.com/content?curTag=staff+picks) column as distinguished by a badge on your profile of a [Featured Contributor](http://community.wolfram.com/web/erikmahieu)! Thank you, keep it coming, and consider contributing your work to the [The Notebook Archive](http://notebookarchive.org)!

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [June 7, 2019, 10:06pm UTC](https://community.wolfram.com/t/3d-crosswalk-perspective-anamorphism-as-a-nudge-for-pedestrian-safety/14152/3 "2019-06-07T22:06:50Z")

</div>

Really cool! thanks for sharing!
