get_hierarchy_control_points return values

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

get_hierarchy_control_points return values

dawe
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

d
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

AntoineR
Hi,
I have the same question, except that in my case I do not have always the
same number of points.... Did you find any information on that?

A.



--
Sent from: https://nabble.skewed.de/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

Tiago Peixoto
Administrator
In reply to this post by dawe
Am 25.11.20 um 18:38 schrieb AntoineR:
> Hi,
> I would like to know also how the info are formatted... In my case the
> length of the property is not the same across the edges...

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.

Bézier splines are defined as such:

https://en.wikipedia.org/wiki/B%C3%A9zier_curve

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

OpenPGP_0x612DEFB798507F25.asc (40K) Download Attachment
OpenPGP_signature (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

AntoineR
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.



--
Sent from: https://nabble.skewed.de/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

Tiago Peixoto
Administrator
Am 30.11.20 um 18:38 schrieb AntoineR:
> 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.

The documentation clearly states that it's 6 values *per spline
segment*, of which there can be an arbitrary amount.

--
Tiago de Paula Peixoto <[hidden email]>

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

OpenPGP_0x612DEFB798507F25.asc (40K) Download Attachment
OpenPGP_signature (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

AntoineR
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.

A




--
Sent from: https://nabble.skewed.de/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

Tiago Peixoto
Administrator
Am 30.11.20 um 19:08 schrieb AntoineR:
> 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/.


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.

--
Tiago de Paula Peixoto <[hidden email]>

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

OpenPGP_0x612DEFB798507F25.asc (40K) Download Attachment
OpenPGP_signature (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: get_hierarchy_control_points return values

AntoineR
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?



--
Sent from: https://nabble.skewed.de/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool