agehama / opensiv3d_graphdrawsample Goto Github PK
View Code? Open in Web Editor NEWLicense: The Unlicense
License: The Unlicense
以下のコードで0番目と2番目のノードが重なって配置される
#include <Siv3D.hpp> // OpenSiv3D v0.6
#include "GraphDrawing.hpp"
class LabelGraphVisualizer : public BasicGraphVisualizer
{
public:
explicit LabelGraphVisualizer(const Font& font)
: BasicGraphVisualizer{}
, m_labelFont(font)
{}
virtual ~LabelGraphVisualizer() = default;
virtual void drawNode(const Vec2& pos, GraphEdge::IndexType nodeIndex) const override
{
m_labelFont(nodeIndex).drawAt(pos);
}
Font m_labelFont;
};
void Main()
{
const ConnectedGraph graph = { {
{0, 1},
{1, 2},
{2, 0},
{1, 3},
{3, 4},
} };
const LayoutForceDirected layout{ graph, ForceDirectedConfig{.startImmediately = StartImmediately::Yes } };
LabelGraphVisualizer visualizer{ Font{ 24 } };
while (System::Update())
{
layout.draw(visualizer);
}
}
MTX フォーマットについて再確認
サンプルでの Reseed の使用は非推奨
DefaultRNG{ 123456789ull }
を入れるconst FilePath& path
→ FilePathView path
それぞれのクラス、関数をどうファイル分割するか(計画をください)。以下例
クラスの依存関係を .hpp / .ipp 分割でうまく回避
Siv3D/GraphDrawing/
にも 2DShapes.hpp 的な役割をするヘッダが必要になるゲーム感を感じるサンプル
単純な実装のも入れて良いのでは
ForceDirectedConfig のサンプルとしてマインドマップ
ユーザが .mtx を生成する手段 / ツールのサンプル提供(現状だと、サンプル動かして終わりなので、実際に使ってもらうため)
アート / エフェクトとしてのグラフ(自動生成)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.