[graph-tool] Re: get_hierarchy_control_points return values

2021-04-20 Thread Tiago de Paula Peixoto

Am 19.04.21 um 21:42 schrieb messias.phys...@gmail.com:

I have the same question as Davide Cittaro.

I'm trying to create the same plot got from  minimize_nested_blockmodel_dl and 
draw_hyerarch, but using the threejs
(https://threejs.org/docs/?q=curve#api/in/extras/curves/Quadratic Bezier Curve)

I'm using this code to extract the control points

```
state = gt.inference.minimize.minimize_nested_blockmodel_dl(g)

pos, t, tpos = state.draw(**options)
cts = gt.draw.get_hierarchy_control_points(g, t, tpos)
```
However I couldn't get how the control points are enconded in the cts ds.

For example, a  sinlge instance of cts object I have this

print(list(cts)[100] )
[0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.03 0.09
  0.05 0.18 0.11 0.36 0.17 0.48 0.23 0.61 0.3  0.69 0.36 0.84 0.42 0.99
  0.46 1.21 0.5  1.23 0.55 1.25 0.6  1.06 0.65 0.87 0.7  0.69 0.75 0.5
  0.81 0.35 0.87 0.21 0.93 0.1  0.97 0.05 1.   0.   1.   0.   1.   0.
  1.   0.   1.   0.   1.   0.  ]

What's the meaning of the first 12 elements?  How (x,y) for control points are 
encoded?


From the documentation of graph_draw():

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


Best,
Tiago

--
Tiago de Paula Peixoto 
___
graph-tool mailing list -- graph-tool@skewed.de
To unsubscribe send an email to graph-tool-le...@skewed.de


[graph-tool] Re: get_hierarchy_control_points return values

2021-04-19 Thread messias . physics
I have the same question as Davide Cittaro. 

I'm trying to create the same plot got from  minimize_nested_blockmodel_dl and 
draw_hyerarch, but using the threejs
(https://threejs.org/docs/?q=curve#api/in/extras/curves/Quadratic Bezier Curve)

I'm using this code to extract the control points

```
state = gt.inference.minimize.minimize_nested_blockmodel_dl(g)

pos, t, tpos = state.draw(**options)
cts = gt.draw.get_hierarchy_control_points(g, t, tpos) 
```
However I couldn't get how the control points are enconded in the cts ds. 

For example, a  sinlge instance of cts object I have this

print(list(cts)[100] )
[0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.03 0.09
 0.05 0.18 0.11 0.36 0.17 0.48 0.23 0.61 0.3  0.69 0.36 0.84 0.42 0.99
 0.46 1.21 0.5  1.23 0.55 1.25 0.6  1.06 0.65 0.87 0.7  0.69 0.75 0.5
 0.81 0.35 0.87 0.21 0.93 0.1  0.97 0.05 1.   0.   1.   0.   1.   0.
 1.   0.   1.   0.   1.   0.  ]

What's the meaning of the first 12 elements?  How (x,y) for control points are 
encoded?

Best regards
___
graph-tool mailing list -- graph-tool@skewed.de
To unsubscribe send an email to graph-tool-le...@skewed.de