Remix.run Logo
layer8 a day ago

> Create a parallelogram by attaching a flipped copy of the triangle.

You don’t need to duplicate the triangle. You can also turn any triangle into an equal-area rectangle like this: https://youtu.be/nVz3kCrJLWo?t=77

Bad ASCII art:

           /|\
         / A|B\
       /____|__\
     /      |   \
   /        |    \
 ’——————————+—————`
The middle horizontal line cuts the height of the triangle in half. Rotating the upper two “quarter” triangles A and B by 180° around the end points of the horizontal line completes the lower half to a rectangle:

  ________________
 | A /      |   \B|
 | /        |    \|
 ’——————————+—————`
Depending on the coordinate representation/quantization, one drawback might however be that if a random point lands exactly on one of the edges of A and B, the mapping between the triangle and the rectangle is not a bijection. (For example, the single edge between A and B in the triangle becomes two separate edges in the rectangle. Likewise for the middle horizontal line, and conversely for the diagonal triangle edges.)
fuzzythinker 19 hours ago | parent [-]

          ⋰|\  
        ⋰ A|B\  
      ⋰____|__\  
    ⋰      |   \  
  ⋰        |    \  
 ’——————————+—————`  
For shallower slopes, use the 3 dots