Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic configuration of graph layout forces through blueprints #8299

Merged
merged 52 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3f2f267
Add sketch of `ForcePositionX`
grtlr Dec 3, 2024
916502b
Add sketch of `ForcePositionY`
grtlr Dec 3, 2024
20705ed
Run `pixi run codegen`
grtlr Dec 3, 2024
56de022
Add `ForceCenter` and `ForceCollideRadius`
grtlr Dec 3, 2024
77c3e75
Finish initial version of forces
grtlr Dec 3, 2024
71af443
Add `ForceLayoutSimulation`
grtlr Dec 3, 2024
4bba076
Remove unnecessary `derives`
grtlr Dec 3, 2024
891292a
Experiment with `re_component`
grtlr Dec 4, 2024
89e0d37
Revert previous design
grtlr Dec 5, 2024
6e885ee
Add `ForceLink`
grtlr Dec 5, 2024
3e906ab
Add force-related entries to registry
grtlr Dec 5, 2024
8b4214c
Remove dups
grtlr Dec 5, 2024
21304c7
Minor cleanup
grtlr Dec 5, 2024
a2aa9bd
WIP
grtlr Dec 5, 2024
b8a3082
Stash
grtlr Dec 5, 2024
5644d31
Fix `ForceLink` archetype
abey79 Dec 5, 2024
f5cbe55
Fail codegen when archetype fields don't have one of the required att…
abey79 Dec 5, 2024
50701ff
WIP
grtlr Dec 6, 2024
db56814
Helper functions
grtlr Dec 6, 2024
112d8c6
Helper functions
grtlr Dec 6, 2024
4c0be0c
Remove `node_index`
grtlr Dec 6, 2024
428510a
Implement `zip` on positions
grtlr Dec 6, 2024
e9546b3
Avoid allocation
grtlr Dec 6, 2024
3508f89
Merge branch 'grtlr/remove-node-index' into grtlr/force-blueprints
grtlr Dec 6, 2024
15bedd4
Adaptive blueprints
grtlr Dec 6, 2024
700be13
Add additional blueprints
grtlr Dec 6, 2024
8398b53
Bubble charts working
grtlr Dec 6, 2024
c1d0700
Highlight selection on circles
grtlr Dec 6, 2024
81a158f
Re-enable iterations
grtlr Dec 9, 2024
1f445e4
Improve selection ui
grtlr Dec 9, 2024
67a04e1
Add `singleline_edit_position2d`
grtlr Dec 9, 2024
ae9fd7d
Add `singleline_edit_position2d`
grtlr Dec 9, 2024
23386cc
Merge branch 'main' into grtlr/force-blueprints
grtlr Dec 9, 2024
78488da
Small cleanup
grtlr Dec 9, 2024
2b2fb45
Trigger CI
grtlr Dec 9, 2024
af2db60
Merge branch 'main' into grtlr/force-blueprints
grtlr Dec 9, 2024
f36ef0b
Missing files
grtlr Dec 9, 2024
098cb3c
Cleanup
grtlr Dec 9, 2024
5651f59
Add `ForceIterations`
grtlr Dec 9, 2024
c2ef1d6
Merge branch 'grtlr/position2d-single-line-edit' into grtlr/force-blu…
grtlr Dec 9, 2024
f9fb7e0
Merge branch 'main' into grtlr/force-blueprints
grtlr Dec 9, 2024
88249c1
Better documentation of forces
grtlr Dec 9, 2024
a780955
Merge branch 'main' into grtlr/force-blueprints
grtlr Dec 9, 2024
08d3dd8
Merge branch 'main' into grtlr/force-blueprints
grtlr Dec 9, 2024
319e697
Not needed anymore
grtlr Dec 9, 2024
93ed4e6
Address feedback
grtlr Dec 10, 2024
a55181c
Merge branch 'main' into grtlr/force-blueprints
grtlr Dec 10, 2024
a0f1a0b
Merge remains
grtlr Dec 10, 2024
927a0e4
Rerun codegen
grtlr Dec 10, 2024
8dfa3da
Format
grtlr Dec 10, 2024
e231cb2
Typo
grtlr Dec 10, 2024
b79e16f
Typo again
grtlr Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2455,9 +2455,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"

[[package]]
name = "fjadra"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccc0416b27f53bba6c9bd564260f27d4784c5f430926eb16a519356be7d66bbc"
checksum = "d8d17b174735bd1464bc491c49570fc824466e9140617c371de9a6d86ebd33ec"

[[package]]
name = "flatbuffers"
Expand Down Expand Up @@ -5999,7 +5999,6 @@ dependencies = [
"bytemuck",
"clean-path",
"criterion",
"crossbeam",
"document-features",
"fixed",
"half",
Expand Down Expand Up @@ -6393,6 +6392,7 @@ dependencies = [
"re_data_ui",
"re_entity_db",
"re_format",
"re_log",
"re_log_types",
"re_query",
"re_renderer",
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ enumset = "1.0.12"
env_logger = { version = "0.10", default-features = false }
ffmpeg-sidecar = { version = "2.0.2", default-features = false }
fixed = { version = "1.28", default-features = false }
fjadra = "0.1"
fjadra = "0.2"
flatbuffers = "23.0"
futures-channel = "0.3"
futures-util = { version = "0.3", default-features = false }
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace rerun.blueprint.archetypes;

/// Tries to move the center of mass of the graph to the origin.
struct ForceCenter (
"attr.rerun.scope": "blueprint"
) {
/// Whether the force is enabled.
enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100);

/// The strength of the force.
strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace rerun.blueprint.archetypes;

/// Resolves collisions between the bounding spheres, according to the radius of the nodes.
struct ForceCollisionRadius (
"attr.rerun.scope": "blueprint"
) {
/// Whether the force is enabled.
enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100);

/// The strength of the force.
strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200);

/// Specifies how often this force should be applied per iteration.
///
/// Increasing this parameter can lead to better results at the cost of longer computation time.
iterations: rerun.blueprint.components.ForceIterations ("attr.rerun.component_optional", nullable, order: 300);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace rerun.blueprint.archetypes;

/// Aims to achieve a target distance between two nodes that are connected by an edge.
struct ForceLink (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be named ForceEdge then? We don't use this "link" terminology anywhere else do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the terminology from d3 here (which is a bit weird), but that way we can point users to the d3 documentation, which is quite good.

It also helps with reproducing some of the d3 examples.

"attr.rerun.scope": "blueprint"
) {
/// Whether the force is enabled.
enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100);

/// The target distance between two nodes.
distance: rerun.blueprint.components.ForceDistance ("attr.rerun.component_optional", nullable, order: 200);

/// Specifies how often this force should be applied per iteration.
///
/// Increasing this parameter can lead to better results at the cost of longer computation time.
iterations: rerun.blueprint.components.ForceIterations ("attr.rerun.component_optional", nullable, order: 300);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace rerun.blueprint.archetypes;

/// A force between each pair of nodes that ressembles an electrical charge.
///
/// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together.
struct ForceManyBody (
"attr.rerun.scope": "blueprint"
) {
/// Whether the force is enabled.
enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100);

/// The strength of the force.
grtlr marked this conversation as resolved.
Show resolved Hide resolved
///
/// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together.
strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace rerun.blueprint.archetypes;

/// Similar to gravity, this force pulls nodes towards a specific position.
struct ForcePosition (
"attr.rerun.scope": "blueprint"
) {
/// Whether the force is enabled.
enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100);

/// The strength of the force.
strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200);

/// The position where the nodes should be pulled towards.
position: rerun.components.Position2D ("attr.rerun.component_optional", nullable, order: 300);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace rerun.blueprint.components;

// ---

/// Whether a procedure is enabled.
struct Enabled (
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "bool",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
) {
visible: rerun.datatypes.Bool (order: 100);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

namespace rerun.blueprint.components;

/// The target distance between two nodes.
///
/// This is helpful to scale the layout, for example if long labels are involved.
struct ForceDistance (
"attr.arrow.transparent",
"attr.rust.derive": "Default, Copy, PartialEq",
"attr.rust.repr": "transparent",
"attr.rerun.scope": "blueprint"
) {
distance: rerun.datatypes.Float64 (order: 100);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

namespace rerun.blueprint.components;

/// Specifies how often this force should be applied per iteration.
///
/// Increasing this parameter can lead to better results at the cost of longer computation time.
struct ForceIterations (
"attr.arrow.transparent",
"attr.rust.derive": "Default, Copy, PartialEq, Eq",
"attr.rust.repr": "transparent",
"attr.rerun.scope": "blueprint"
) {
distance: rerun.datatypes.UInt64 (order: 100);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

namespace rerun.blueprint.components;

/// The strength of a given force.
///
/// Allows to assign different weights to the individual forces, prioritizing one over the other.
struct ForceStrength (
"attr.arrow.transparent",
"attr.rust.derive": "Default, Copy, PartialEq",
"attr.rust.repr": "transparent",
"attr.rerun.scope": "blueprint"
) {
distance: rerun.datatypes.Float64 (order: 100);
}
15 changes: 15 additions & 0 deletions crates/store/re_types/definitions/rerun/blueprint/views/graph.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,19 @@ table GraphView (
///
/// Somethings outside of these bounds may also be visible due to letterboxing.
visual_bounds: rerun.blueprint.archetypes.VisualBounds2D (order: 1000);

/// Allows to control the interaction between two nodes connected by an edge.
force_link: rerun.blueprint.archetypes.ForceLink (order: 2000);

/// A force between each pair of nodes that ressembles an electrical charge.
force_many_body: rerun.blueprint.archetypes.ForceManyBody (order: 3000);

/// Similar to gravity, this force pulls nodes towards a specific position.
force_position: rerun.blueprint.archetypes.ForcePosition (order: 4000);

/// Resolves collisions between the bounding spheres, according to the radius of the nodes.
force_collision_radius: rerun.blueprint.archetypes.ForceCollisionRadius (order: 5000);

/// Tries to move the center of mass of the graph to the origin.
force_center: rerun.blueprint.archetypes.ForceCenter (order: 6000);
}
5 changes: 5 additions & 0 deletions crates/store/re_types/src/blueprint/archetypes/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading