kctekn / obsidian-TagsRoutes

This is a plugin for obsidian, to visualize files and tags as nodes in 3D graph.
MIT License
41 stars 4 forks source link

"Gravity" and fixed points function #30

Open ckirin opened 2 weeks ago

ckirin commented 2 weeks ago

Hello there! The most problem when applying the 3D graph is actully "too flexiable " to the 3D graph, here is what I think to solve this.

This approach would allow for stable visualization of "grounded" (highly cited) nodes and flexible, floating arrangement of "airborne" (less significant) nodes. This could be useful for visualizing hierarchical structures or networks with different levels of importance or relevance.

  1. Gravity System for Weighted Nodes The concept of gravity would organize nodes by weight (importance), essentially "dropping" more heavily weighted nodes closer to a designated "ground plane" in 3D space. Here's how this can work:

Define Node Weighting:

Assign weights to nodes based on citation count or relevance. For example, more highly cited nodes will have higher weights, while less cited nodes have lower weights. Set a threshold weight; nodes above this threshold are considered "heavy" and should be subject to gravity, while those below remain "light." Gravity Force Application:

Use a gravity force function to move nodes toward the ground plane. Gravity should only apply to nodes with weight above the threshold, while lighter nodes can float. Calculate the gravitational pull based on weight so that more significant nodes are closer to the ground, while less significant nodes float higher up in the 3D space. Ground Plane Constraints:

Define a horizontal plane as the "ground" level. Heavily weighted nodes fall and settle on or near this plane unless repositioned manually. Implement a collision detection that prevents nodes from dropping below the ground plane, creating a stable layout on the ground for easier reading and manipulation. Floating Nodes:

Nodes below the weight threshold ("air nodes") are not affected by gravity and remain floating. Implement a damping effect to prevent them from drifting too far off the visible space but allow them to adjust within their 3D space as other nodes shift.

  1. Fixed Points Mechanism For better control of the nodes' stability and layout, this mechanism allows nodes to be either fixed or floating:

Setting Fixed Points:

Introduce a property that allows each node to be marked as either "fixed" or "floating." When a node is fixed, it retains its position even when gravity or other forces would typically apply. This is essential for stable visualization, especially for "ground" nodes that you want to keep in place after adjustment. Interactivity for Position Locking:

Add an interface for users to toggle nodes between fixed and floating manually. This interface could include a checkbox or toggle button in the graph interface, allowing each node’s position to be locked or freed. By fixing certain nodes on the ground, users can stabilize key nodes (like hubs or anchor points), allowing floating nodes to move around them without affecting the overall structure. Flexible Adjustment for Floating Nodes:

Floating nodes should respond to user manipulation, allowing users to adjust their positions freely. Once positioned, users can choose to fix these nodes if they want to prevent further automatic adjustments.

ckirin commented 2 weeks ago

The main concept is to make this 3D network to a kind of "plasticine" like rather than a "water or air" like. I think we have to constraint this graph to avoid "way too flexible".Otherwise, which is just a beatuy thing rather than a useful thing. And I have to mention that this feature is just a "simple concept" and need to be thought throughoutlly!

kctekn commented 2 weeks ago

Good point! I think what you're getting at is allowing the scene to remain static, rather than always rotating. Actually, I've given this some thought and am currently working on a solution for this.