Hi again,
I'm writing a small package that builds on graph-tool, but not on its graphics capabilities (also because I have to represent other things rather than the graph itself). Still I could use some of the functions "under the hood" for my purposes. I have a question about gt.draw.get_hierarchy_control_points(): the function returns the Bézier spline control points for edges in a given graph, but I'm having difficulties in understanding how this information is encoded. For a single edge in graph, I have dozens of values as control points (half dozens + 2), hence I suspect all splines going from node A to the root of a hierarchy and back to node B are encoded there, and control points should be taken 6 by 6 (3x2 by 3x2 coordinates?). How (x,y) for control points are encoded then: (x, x, x, y, y, y) or (x, y, x, y, x, y)? What are the 2 additiona values I have for each vector? Also, are values absolute or relative to one node in particular (A, B or root...)?
Thanks
The documentation of graph_draw() for "edge_control_points" says:
Control points of a Bézier spline used to draw the edge. Each spline
segment requires 6 values corresponding to the (x,y) coordinates of the
two intermediary control points and the final point.
Hi Tiago,
Sure the documentation states that there should be 6 points, but in my case
the length of the map is variable, so I think that either the documentation
is outdated, or the format of the map is not correct. Sometimes I have a
length of 40 for the vector, sometimes 50 or so.
Thanks,
A.
Ok, that seems right, but still, there is something that I do not understand.
I followed the piece of code of the documentation of
graph_tool.draw.get_hierarchy_control_points
<https://graph-tool.skewed.de/static/doc/draw.html?highlight=get_hierarchy_control_points#graph_tool.draw.get_hierarchy_control_points>
, and when I print the length of the map /cts/ I get value that are not
divisible by 6 (86,50,38,62...), so there is one more point coming out of
the function /get_hierarchy_control_points/ and used in /graph_draw/.
But thanks for the clarification of the several spline segments. I didn't
get that.
Yes, this is because of a boundary condition: The last point does not
need to be specified, just as the first one. If it's given, it's
ignored. The function get_hierarchy_control_points generates the final
point because it's slightly easier in the code.
Ok, but then I should be able to find the edge's target position in the
points generated by the the function get_hierarchy_control_points right? If
it is not the last two components of the vector (boundary condition?) it
should at the position [-4:-3]?
If I understand correctly what you said, from the function
get_hierarchy_control_points I should get n*(6 components) I got n*(6
components)+2. The last two are not used because there are boundary
conditions (I do not get this but I need to read the paper you are citing,
and I cannot access it right now because I cannot reach sci hub...). The 6
components are from the 3 points, 2 intermediates, 1 finale. The finale is
the target right? So for get_hierarchy_control_points each [6n+4:6n+5]
coordinates are coordinates of a target in the hierarchical graph. But the
very last coordinates is the edge's target, isn't it?
control_points: Control points of a Bézier spline used to draw the
edge. Each spline segment requires 6 values corresponding to the
(x,y) coordinates of the two intermediary control points and the
final point.
In the coordinate system, (0,0) is the start of the edge, and (1, 0) is
the end of the edge. The last point at (1,0) is always assumed, even if
not given.
(Note that the get_hierarchy_control_points() is wasteful, since it
includes duplicated points in the beginning and end. This is an outcome
of the translation between B-splines, used internally, and the Bezier
splines that are used for drawing. This is something I intended to fix,
but it seems I forgot.)