From 0a7e413f87780e31459e5d352ba166e7342443ee Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 29 Mar 2020 15:14:48 +0200 Subject: [PATCH] rogueviz:: fullnet as separate file --- rogueviz/fullnet.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++ rogueviz/rogueviz.cpp | 37 +---------------------- 2 files changed, 71 insertions(+), 36 deletions(-) create mode 100644 rogueviz/fullnet.cpp diff --git a/rogueviz/fullnet.cpp b/rogueviz/fullnet.cpp new file mode 100644 index 00000000..b4836e64 --- /dev/null +++ b/rogueviz/fullnet.cpp @@ -0,0 +1,70 @@ +// Hyperbolic Rogue +// Copyright (C) 2011-2016 Zeno Rogue, see 'hyper.cpp' for details + +// Hyperbolic geometry is a good tool to visualize data, +// especially trees and scale-free networks. This file +// uses HyperRogue to browse such vizualizations. + +// Since it is not of use for general HyperRogue players, +// it is disabled by default -- compile with the ROGUEVIZ flag to enable this. + +// How to use: + +// hyper -embed -- visualize a social network +// embedded into hyperbolic plane, see: +// https://bitbucket.org/HaiZhung/hyperbolic-embedder/overview +// (it uses the same format) + +// hyper -tess -- visualize a horocyclic tesselation, + +#include "rogueviz.h" + +namespace rogueviz { + +namespace fullnet { + +int fullnet_id; + +void drawExtra() { + + if(vizid == &fullnet_id) { + for(map::iterator it = gmatrix.begin(); it != gmatrix.end(); it++) { + cell *c = it->first; + c->wall = waChasm; + } + int index = 0; + + for(map::iterator it = gmatrix.begin(); it != gmatrix.end(); it++) { + cell *c = it->first; + bool draw = true; + for(int i=0; isecond, dftcolor, false, NULL, index++); + // queuepolyat(it->second, shDisk, dftcolor., PPR::LINE); + } + + for(int i=0; i::iterator it = gmatrix.begin(); it != gmatrix.end(); it++) { - cell *c = it->first; - c->wall = waChasm; - } - int index = 0; - - for(map::iterator it = gmatrix.begin(); it != gmatrix.end(); it++) { - cell *c = it->first; - bool draw = true; - for(int i=0; isecond, dftcolor, false, NULL, index++); - // queuepolyat(it->second, shDisk, dftcolor., PPR::LINE); - } - - for(int i=0; i *hooks_readcolor; void readcolor(const string& cfname) { @@ -1081,14 +1054,6 @@ int readArgs() { spiral::place(N, mul); } - else if(argis("-net")) { - PHASE(3); - init(); kind = kFullNet; - linepatterns::patTriTree.color = 0x30; - linepatterns::patTriOther.color = 0x10; - linepatterns::patTriRings.color = 0xFF; - } - else if(argis("-spiraledge")) { PHASE(3); ld shft = 1; @@ -1449,7 +1414,6 @@ named_functionality o_key() { } auto hooks = - addHook(hooks_frame, 0, drawExtra) + #if CAP_COMMANDLINE addHook(hooks_args, 100, readArgs) + #endif @@ -1513,3 +1477,4 @@ auto hooks = #include "sag.cpp" #include "collatz.cpp" #include "tree.cpp" +#include "fullnet.cpp"