algorithm for outputing current connection, with angles etc. used for exporting json file.