Tuesday, August 26, 2014

Drawing a self reference directed edge in graph

I come across a requirement to draw a self-reference edge in my graph on Raphael Graph.

The edge from inDirect to Direct is drawn using Bezier curve,
For the selef refernce edge as welli used the same Bazier curve,

Here P1 & P4 can be easily calculated as center point of each sides. and P2 & P3 are assumed to be the part of a square,
other wise we can get better value using angle and two point mathematical calculation in Geometry.

Hope it will help you draw better graphs and edges using Raphael and Mathematics.