fix example inflection-1
This commit is contained in:
parent
7bef5ba36a
commit
07dd8011d3
@ -16,7 +16,7 @@ create table figures (name text, way geometry);
|
|||||||
insert into figures (name, way) values ('fig3',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0,60 0)'));
|
insert into figures (name, way) values ('fig3',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0,60 0)'));
|
||||||
insert into figures (name, way) values ('fig3-1',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0)'));
|
insert into figures (name, way) values ('fig3-1',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0)'));
|
||||||
insert into figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39,19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45,63 15,91 0,91 0)'));
|
insert into figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39,19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45,63 15,91 0,91 0)'));
|
||||||
insert into figures (name, way) values ('inflection-1',ST_GeomFromText('LINESTRING(129 45,131 56,130 82,128 99,147 104,149 89,147 68,141 52)'));
|
insert into figures (name, way) values ('inflection-1',ST_GeomFromText('LINESTRING(100 14,114 20,133 20,145 15,145 0,136 5,123 7,114 7,111 2)'));
|
||||||
|
|
||||||
drop table if exists bends;
|
drop table if exists bends;
|
||||||
create table bends (way geometry);
|
create table bends (way geometry);
|
||||||
@ -35,7 +35,6 @@ begin
|
|||||||
perform assert_equals('LINESTRING(20 2,20 0,32 0,33 10)', st_astext(bends[3]));
|
perform assert_equals('LINESTRING(20 2,20 0,32 0,33 10)', st_astext(bends[3]));
|
||||||
perform assert_equals('LINESTRING(32 0,33 10,38 16,43 15,44 10,44 0)', st_astext(bends[4]));
|
perform assert_equals('LINESTRING(32 0,33 10,38 16,43 15,44 10,44 0)', st_astext(bends[4]));
|
||||||
|
|
||||||
|
|
||||||
perform assert_equals(4, array_length(detect_bends((select way from figures where name='fig3-1')), 1));
|
perform assert_equals(4, array_length(detect_bends((select way from figures where name='fig3-1')), 1));
|
||||||
|
|
||||||
select detect_bends((select way from figures where name='fig5')) into bends;
|
select detect_bends((select way from figures where name='fig5')) into bends;
|
||||||
|
19
IV/wm.sql
19
IV/wm.sql
@ -99,18 +99,21 @@ begin
|
|||||||
-- Then edges (A,B) and (E,F) are shared with the neighboring bends.
|
-- Then edges (A,B) and (E,F) are shared with the neighboring bends.
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- Assume this curve:
|
-- Assume this curve (figure `inflection-1`):
|
||||||
--
|
--
|
||||||
-- A______B
|
-- A______B
|
||||||
-- ---' `---.___. E
|
-- ---' `-------. C
|
||||||
-- C D |
|
-- |
|
||||||
-- _I |
|
-- G___ F |
|
||||||
-- '---.________ |
|
-- / `-----.____+ D
|
||||||
-- H G'---+ F
|
-- E
|
||||||
--
|
--
|
||||||
-- After processing the curve following the definition of a bend, the bend
|
-- After processing the curve following the definition of a bend, the bend
|
||||||
-- [A-G] would be detected. Assuming inflection point G and H are "small",
|
-- [A-E] would be detected. Assuming inflection point E and F are "small",
|
||||||
-- the bend would be extended by two edges to [A,I].
|
-- the bend needs to be extended by two edges to [A,G].
|
||||||
|
--
|
||||||
|
-- Assuming the direction in this example is clock-wise, the first set of
|
||||||
|
-- `p` variables will be: p1=C, p2=B, p3=A.
|
||||||
for p in (select geom from st_dumppoints(prev_bend) order by path[1] desc) loop
|
for p in (select geom from st_dumppoints(prev_bend) order by path[1] desc) loop
|
||||||
p3 = p2;
|
p3 = p2;
|
||||||
p2 = p1;
|
p2 = p1;
|
||||||
|
Loading…
Reference in New Issue
Block a user