Skip to content

Commit 3b91102

Browse files
authored
Merge pull request #5306 from ag-grid/AG-12944-sankey
AG-12944 Update sankey algorithm
2 parents 044ffd8 + 4363338 commit 3b91102

File tree

33 files changed

+439
-399
lines changed

33 files changed

+439
-399
lines changed

packages/ag-charts-community/src/util/vector.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,15 @@ function lengthSquared(a: Vec2) {
9191
* Get the distance between two vectors.
9292
*/
9393
function distance(a: Vec2, b: Vec2) {
94-
const d = sub(a, b);
95-
return Math.sqrt(d.x * d.x + d.y * d.y);
94+
return length(sub(a, b));
9695
}
9796

9897
/**
9998
* Get the squared distance between two vectors. This method is faster than `distance(a, b)` and is useful when making
10099
* comparisons where the precise distance does not matter.
101100
*/
102101
function distanceSquared(a: Vec2, b: Vec2) {
103-
const d = sub(a, b);
104-
return d.x * d.x + d.y * d.y;
102+
return lengthSquared(sub(a, b));
105103
}
106104

107105
/**
571 Bytes
Loading
2.61 KB
Loading
985 Bytes
Loading
877 Bytes
Loading
1.38 KB
Loading
659 Bytes
Loading
-2.37 KB
Loading
71.4 KB
Loading
77.6 KB
Loading

0 commit comments

Comments
 (0)