Take node penwidth into account when doing the clipping of the 'star'
shape. This causes the clipping to occur at the visible node outline
instead of at the "ideal" bounding box which does not take node
penwidth into account.
For the star shape, this fixes the second part of arrow not respecting
penwidth. Similar fixes need to be applied to fix the second part for
other node shapes.
The test_max_edge_node_overlap_node_shapes test case now succeeds, so
the expectancy that it should fail is removed.
Towards https://gitlab.com/graphviz/graphviz/-/issues/372.
vertex = poly->vertices;
sides = poly->sides;
- /* index to outer-periphery */
- outp = (poly->peripheries - 1) * sides;
- if (outp < 0)
- outp = 0;
+ const double penwidth = late_int(n, N_penwidth, DEFAULT_NODEPENWIDTH, MIN_NODEPENWIDTH);
+ if (poly->peripheries >= 1 && penwidth > 0) {
+ /* index to outline, i.e., the outer-periphery with penwidth taken into account */
+ outp = (poly->peripheries + 1 - 1) * sides;
+ } else {
+ /* index to outer-periphery */
+ outp = (poly->peripheries - 1) * sides;
+ if (outp < 0)
+ outp = 0;
+ }
lastn = n;
}
#include "test_edge_node_overlap_utilities.h"
#include "test_utilities.h"
-TEST_CASE(
- "Maximum edge and node overlap for polygon node shapes",
- "[!shouldfail] Test that an edge connected to a polygon based node does "
- "not overlap that node, regardless of the node shape") {
+TEST_CASE("Maximum edge and node overlap for polygon node shapes",
+ "Test that an edge connected to a polygon based node does not "
+ "overlap that node, regardless of the node shape") {
const auto shape = GENERATE(from_range(node_shapes_consisting_of_polygon));
INFO("Node shape: " << shape);