Divide a rectangle into a number of unequal triangles: Difference between revisions
Divide a rectangle into a number of unequal triangles (view source)
Revision as of 11:16, 19 December 2021
, 2 years ago→{{header|Python}}: split a couple of long lines
(→{{header|Wren}}: Added a further check that the areas of all triangles are different.) |
m (→{{header|Python}}: split a couple of long lines) |
||
Line 68:
D C
Create the two extra lines D-p and p-C creating 3 triangles A-p-D, D-p-C and p-B-C.
Now if distances A-p, p-B and B-C are all different, then the triangles will be different.
If we instead inserted **two** points between A-B, p0 and p1, we can insert **one** point q0, along D-C
Line 79 ⟶ 80:
We think of the L-to-R ordered top points as A p0 p1 then B; and the ordered l-to-R bottom points as D q0 then C.
* Create the triangles by using the i'th, (i+1)'th top points and the i'th bottom point; alternating with
the (i)'th (i+1)'th bottom point and the (i+1)'th top point.
* Ensure the distances between successive top points, B-C, and successive bottom points are all different to get different triangles.
* If you insert `n`top points p, then you need `n-1` bottom points q.
|