Giter Site home page Giter Site logo

opensiv3d_graphdrawsample's People

Contributors

agehama avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

opensiv3d_graphdrawsample's Issues

ForceDirectedの配置不具合

以下のコードで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);
	}
}

2022-0227 実装会レビュー

  • MTX フォーマットについて再確認

  • サンプルでの Reseed の使用は非推奨

    • DefaultRNG{ 123456789ull } を入れる
  • const FilePath& pathFilePathView path

  • それぞれのクラス、関数をどうファイル分割するか(計画をください)。以下例

    • GraphDrawing/Common.hpp
      • XX クラス
    • GraphDrawing/MTX.hpp
      • XX 関数
    • GraphDrawing/~~Layout.hpp
  • クラスの依存関係を .hpp / .ipp 分割でうまく回避

    • Siv3D の 2DShapes.hpp の構成が参考になる
    • Siv3D/GraphDrawing/ にも 2DShapes.hpp 的な役割をするヘッダが必要になる
  • ゲーム感を感じるサンプル

    • @Reputeless アイデア: 町の座標固定、その間のフィールドのポイントと道を自動生成
    • マップがあって、そこに町を建てて、それぞれの町どうしの交易をグラフビューで表示する的なサンプル?
  • 単純な実装のも入れて良いのでは

  • ForceDirectedConfig のサンプルとしてマインドマップ

  • ユーザが .mtx を生成する手段 / ツールのサンプル提供(現状だと、サンプル動かして終わりなので、実際に使ってもらうため)

    • Web API / 手動でグラフ作る / 実世界データ
  • アート / エフェクトとしてのグラフ(自動生成)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.