Two programs are provided with RTGraph3D. The first one, rtg_cli.py is a command line interface that will take commands from the user and transmit them through the D-Bus bus to the RTGraph3D program. The second one hydra.py is an example on how to use signals. It will register a handler on the shift-click that will add 4 nodes to every shift-clicked node.
RTGraph3D uses a physics engine that provides the cinematics of nodes. All nodes are submited to a fluid friction force (proportional to speed). They all repulse each other with a 1/r^4 force. The repulsion force is topped to avoid problem on singularities. Additionnaly, two nodes linked by an edge are attracted one by each other with a linear force (proportional to the edge's length, equivalent of a spring with null length when still.)
The physics engine is written in C with x86 SSE assembly code. If no x86 SSE compatible CPU is found, a C version is also available which also has a pretty decent speed. In case PyInline is not found or not able to compile the C code, a Python version is also available, but considerably slower (displaying 1000 nodes is comfortable with the C+SSE version while the Python one begins to be slow at 50 nodes).
Warning: This program is not safe to be spoken to by untrusted sources. Giving the possibility to submit commands is equivalent to giving a shell.
$ ./rtgraph3d.py INFO : Detected SSE compatible CPU INFO : Using C+SSE physics engine INFO : Entering main loop INFO : Cinematic thread startedThen we will use the CLI to issue commands:
$ ./rtg_cli.py RTG> help Undocumented commands: ====================== dotty glow remote_dump rotate set_attraction unglow edge help remote_load rotate_stop set_repulsion update find quit reset set_ambient toggleFor example, to create a tetrahedron with nodes Node1, Node2, Node3, Node4, you'll have to issue:
RTG> edge Node1 Node2 RTG> edge Node3 Node4 Node1 Node3 Node2 Node4You will get the following result:
Clicking on nodes will toggle an information box with the node's name.
RTG> edge Node1 Node5 Node6
RTG> reset RTG> remote_load rtg/c60.rtg