[GRASS-dev] Building a vector topology (and failing)

Hey all, I’ve been trying to get my topology to build for a while now in my module, and I’m not getting anywhere. I currently have it to the point where I’m simply trying to draw a triangle with corners (0,0), (0,100), & (100,0). It calls Vect_append_point() three times, then Vect_write_line(,GV_BOUNDARY,) to create the polygon. When building the topology, it fails to create an area with “WARNING: Number of incorrect boundaries: 1”.

I’m used to raster programming, but I would think that this would work. You can see in the debug that the error shouldn’t happen. There aren’t duplicate angles. I’m using a recent SVN of GRASS 7.0. Anyone have any idea what I’m doing wrong? Below is the relevant debug output.
Thanks,
Seth

[…]

Registering primitives…
D3/3: Vect_read_next_line()
D3/3: V1_read_next_line_nat()
D3/3: Vect__Read_line_nat: offset = 18
D3/3: type = 4, do_cats = 1 dead = 0
D3/3: n_cats = 1
D3/3: n_points = 3
D3/3: off = 107
D3/3: Register line: offset = 18
D3/3: dig_spidx_add_line(): line = 1
D3/3: Register node: type = 4, 589971.509972,5300028.490028
D3/3: dig_find_node()
D3/3: node = 0
D3/3: dig_add_node(): n_nodes = 0, alloc_nodes = 0
D3/3: dig_spidx_add_node(): node = 1, x,y,z = 589971.509972, 5300028.490028, 0.000000
D3/3: new node = 1, n_nodes = 1, alloc_nodes = 1000
D3/3: Add new node: 1
D3/3: dig_node_add_line(): node = 1 line = 1
D3/3: dig_node_alloc_line(): add = 1
D3/3: angle = -1.570796
D3/3: dig_node_add_line(): line 1 added position 0 n_lines: 1 angle -1.570796
D3/3: Register node 591396.011396,5300028.490028
D3/3: dig_find_node()
D3/3: node = 0
D3/3: dig_add_node(): n_nodes = 1, alloc_nodes = 1000
D3/3: dig_spidx_add_node(): node = 2, x,y,z = 591396.011396, 5300028.490028, 0.000000
D3/3: new node = 2, n_nodes = 2, alloc_nodes = 1000
D3/3: Add new node: 2
D3/3: dig_node_add_line(): node = 2 line = -1
D3/3: dig_node_alloc_line(): add = 1
D3/3: angle = -2.356194
D3/3: dig_node_add_line(): line -1 added position 0 n_lines: 1 angle -2.356194
D3/3: dig_cidx_add_cat(): field = 4 cat = 1 line = 1 type = 4
D3/3: Vect_read_next_line()
D3/3: V1_read_next_line_nat()
D3/3: Vect__Read_line_nat: offset = 107
1 primitives registered
3 vertices registered
Building areas…
100%
D3/3: Build area for line = 1, side = 1
D3/3: Vect_build_line_area() line = 1, side = 1
D3/3: dig_line_get_area(): line = 1, side = 1 (left), area = 0
D3/3: dig_build_area_with_line(): first_line = 1, side = 1
D3/3: dig_node_line_angle: node = 1 line = 1
D3/3: dig__angle_next_line: line = 1, side = 2, type = 4
D3/3: node = 1
D3/3: n_lines = 1
D3/3: i = 0 line = 1 angle = -1.570796
D3/3: current position = 0
D3/3: next = 0 line = 1 angle = -1.570796
D3/3: this one
D3/3: next_line = 1
D3/3: dig_node_angle_check: line = 1, type = 4
D3/3: dig_node_line_angle: node = 1 line = 1
D3/3: dig__angle_next_line: line = 1, side = 2, type = 4
D3/3: node = 1
D3/3: n_lines = 1
D3/3: i = 0 line = 1 angle = -1.570796
D3/3: current position = 0
D3/3: next = 0 line = 1 angle = -1.570796
D3/3: this one
D3/3: dig_node_line_angle: node = 1 line = 1
D3/3: The line to the right has the same angle: node = 1, line = 1
D3/3: Cannot build area, a neighbour of the line 1 has the same angle at the node
D3/3: n_lines = 0
D3/3: Build area for line = 1, side = 2
D3/3: Vect_build_line_area() line = 1, side = 2
D3/3: dig_line_get_area(): line = 1, side = 2 (right), area = 0
D3/3: dig_build_area_with_line(): first_line = 1, side = 2
D3/3: dig_node_line_angle: node = 1 line = 1
D3/3: dig__angle_next_line: line = -1, side = 2, type = 4
D3/3: node = 2
D3/3: n_lines = 1
D3/3: i = 0 line = -1 angle = -2.356194
D3/3: current position = 0
D3/3: next = 0 line = -1 angle = -2.356194
D3/3: this one
D3/3: next_line = -1
D3/3: dig_node_angle_check: line = -1, type = 4
D3/3: dig_node_line_angle: node = 2 line = -1
D3/3: dig__angle_next_line: line = -1, side = 2, type = 4
D3/3: node = 2
D3/3: n_lines = 1
D3/3: i = 0 line = -1 angle = -2.356194
D3/3: current position = 0
D3/3: next = 0 line = -1 angle = -2.356194
D3/3: this one
D3/3: dig_node_line_angle: node = 2 line = -1
D3/3: The line to the right has the same angle: node = 2, line = -1
D3/3: Cannot build area, a neighbour of the line -1 has the same angle at the node
D3/3: n_lines = 0
0 areas built
0 isles built

[…]

2012/3/12 Seth Price <seth@pricepages.org>:

Hey all, I've been trying to get my topology to build for a while now in my
module, and I'm not getting anywhere. I currently have it to the point where
I'm simply trying to draw a triangle with corners (0,0), (0,100), & (100,0).
It calls Vect_append_point() three times,

a valid area is defined by a closed boundary or by (closed) chain of
boundaries. In this case simply add the last point at 0,0.

then Vect_write_line(,GV_BOUNDARY,) to create the polygon. When building
the topology, it fails to create an area with "WARNING: Number of incorrect
boundaries: 1".

yes, there is one boundary which cannot form an area (it's not closed).

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa