node-labeling 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node_labeling-1.0.1 → node_labeling-1.0.2}/PKG-INFO +1 -1
- {node_labeling-1.0.1 → node_labeling-1.0.2}/pyproject.toml +1 -1
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/__init__.py +1 -1
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/forces/forces.py +12 -4
- {node_labeling-1.0.1 → node_labeling-1.0.2}/LICENSE +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/README.md +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/cli.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/filter/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/filter/filter.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/filter/matching.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/filter/rules.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/forces/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/label/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/label/formatter.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/label/generate_candidates.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/label/generate_overflow.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/models/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/models/anchor.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/models/label_candidate.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/models/label_type.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/overflow/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/overflow/bounded.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/overflow/grid.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/overflow/hungarian.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/overflow/unbounded.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/topology/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/topology/faces.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/topology/planarize.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/__init__.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/config.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/constants.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/geometry.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/graph_lattice.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/normalize.py +0 -0
- {node_labeling-1.0.1 → node_labeling-1.0.2}/src/node_labeling/utils/visualize.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "node-labeling"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.2"
|
|
8
8
|
description = "Node labeling: a two-phase algorithm for labeling line diagrams of ordered sets"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "marcelnoehre", email = "noehre@cs.uni-kassel.de" }
|
|
@@ -12,6 +12,14 @@ from node_labeling.models.label_candidate import LabelCandidate
|
|
|
12
12
|
from node_labeling.utils.geometry import *
|
|
13
13
|
from node_labeling.utils.config import Config
|
|
14
14
|
|
|
15
|
+
def cross2d(a: np.ndarray, b: np.ndarray) -> float:
|
|
16
|
+
'''
|
|
17
|
+
Z-component of the 3D cross product of two 2D vectors.
|
|
18
|
+
|
|
19
|
+
numpy>=2.0 dropped support for 2D x 2D inputs to np.cross.
|
|
20
|
+
'''
|
|
21
|
+
return a[0] * b[1] - a[1] * b[0]
|
|
22
|
+
|
|
15
23
|
def optimize_overflow_labels(
|
|
16
24
|
G: nx.Graph,
|
|
17
25
|
label_candidates: Dict[int, List[LabelCandidate]],
|
|
@@ -89,7 +97,7 @@ def optimize_overflow_labels(
|
|
|
89
97
|
|
|
90
98
|
ink_center = np.array([ink.centroid.x, ink.centroid.y])
|
|
91
99
|
vec_to_ink = ink_center - drawing_centroid
|
|
92
|
-
side =
|
|
100
|
+
side = cross2d(radial_unit, vec_to_ink / (np.linalg.norm(vec_to_ink) + 1e-6))
|
|
93
101
|
slide_dir = tangent_vec if side < 0 else -tangent_vec
|
|
94
102
|
|
|
95
103
|
mag = (threshold - dist_to_ink) * cfg.w_inner_proximity
|
|
@@ -110,7 +118,7 @@ def optimize_overflow_labels(
|
|
|
110
118
|
tangent_vec = np.array([-radial_unit[1], radial_unit[0]])
|
|
111
119
|
|
|
112
120
|
vec_to_other = np.array(o_ol.center) - drawing_centroid
|
|
113
|
-
side =
|
|
121
|
+
side = cross2d(radial_unit, vec_to_other / (np.linalg.norm(vec_to_other) + 1e-6))
|
|
114
122
|
slide_dir = tangent_vec if side < 0 else -tangent_vec
|
|
115
123
|
|
|
116
124
|
mag = (threshold - dist) * cfg.w_global_proximity
|
|
@@ -169,7 +177,7 @@ def optimize_overflow_labels(
|
|
|
169
177
|
if dist_binder < binder_threshold:
|
|
170
178
|
obs_center = np.array([obstacle_centroid_pt.x, obstacle_centroid_pt.y])
|
|
171
179
|
vec_to_obs = obs_center - drawing_centroid
|
|
172
|
-
side =
|
|
180
|
+
side = cross2d(radial_unit, vec_to_obs / (np.linalg.norm(vec_to_obs) + 1e-6))
|
|
173
181
|
slide_dir = tangent_vec if side < 0 else -tangent_vec
|
|
174
182
|
mag = (binder_threshold - dist_binder) * cfg.w_binder_dodge
|
|
175
183
|
force_vector += slide_dir * mag
|
|
@@ -190,7 +198,7 @@ def optimize_overflow_labels(
|
|
|
190
198
|
is_violating = (ol.label_type == LabelType.INTENT and min_y < node_pos[1]) or (ol.label_type == LabelType.EXTENT and max_y > node_pos[1])
|
|
191
199
|
if is_violating:
|
|
192
200
|
up_vec = np.array([0.0, 1.0])
|
|
193
|
-
side =
|
|
201
|
+
side = cross2d(radial_unit, up_vec)
|
|
194
202
|
direction_multiplier = 1.0 if ol.label_type == LabelType.INTENT else -1.0
|
|
195
203
|
slide_dir = tangent_vec if (side * direction_multiplier) > 0 else -tangent_vec
|
|
196
204
|
infringement = (node_pos[1] - min_y) if ol.label_type == LabelType.INTENT else (max_y - node_pos[1])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|