| 1 |
# test_Polygon_simplify.praat |
| 2 |
|
| 3 |
printline test_Polygon_simplify |
| 4 |
|
| 5 |
for j to 10 |
| 6 |
m = Create simple Matrix... ps 2 100 randomUniform (0,1) |
| 7 |
p1x = Get value in cell... 1 1 |
| 8 |
p1y = Get value in cell... 2 1 |
| 9 |
p2x = Get value in cell... 1 10 |
| 10 |
p2y = Get value in cell... 2 10 |
| 11 |
for i from 2 to 99 |
| 12 |
if ( i mod 10) =0 |
| 13 |
p1x = Get value in cell... 1 i |
| 14 |
p1y = Get value in cell... 2 i |
| 15 |
p2x = Get value in cell... 1 i+10 |
| 16 |
p2y = Get value in cell... 2 i+10 |
| 17 |
elsif ( i mod 10) >0 |
| 18 |
# 9 points on the edge from p(i) to point(i+10) |
| 19 |
af = randomUniform (0,1) |
| 20 |
xn = p1x +af*(p2x-p1x) |
| 21 |
yn = p1y + af*(p2y-p1y) |
| 22 |
Set value... 1 i xn |
| 23 |
Set value... 2 i yn |
| 24 |
endif |
| 25 |
endfor |
| 26 |
|
| 27 |
p = To Polygon |
| 28 |
for k to 10 |
| 29 |
select p |
| 30 |
p3 = Circular permutation... randomUniform (1, 100) |
| 31 |
p4 = Simplify |
| 32 |
np = Get number of points |
| 33 |
assert np = 11 |
| 34 |
plus p3 |
| 35 |
Remove |
| 36 |
endfor |
| 37 |
select m |
| 38 |
plus p |
| 39 |
Remove |
| 40 |
endfor |
| 41 |
|
| 42 |
printline test_Polygon_simplify OK |
| 43 |
|
| 44 |
|
| 45 |
|