Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 2d28350

Browse files
committed
refactor: rename getMathAngle and fix docs
1 parent 8052336 commit 2d28350

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/featureMatching/keypoints/getOrientedFastKeypoints.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Image } from '../../Image';
2-
import { getMathAngle } from '../../maskAnalysis/utils/getAngle';
2+
import { getClockwiseAngle } from '../../maskAnalysis/utils/getAngle';
33
import { toDegrees } from '../../utils/geometry/angles';
44
import { getRadius } from '../../utils/getRadius';
55
import { checkBorderDistance } from '../utils/checkBorderDistance';
@@ -62,7 +62,7 @@ export function getOrientedFastKeypoints(
6262
center: keypoint.origin,
6363
radius,
6464
})[0];
65-
const angle = toDegrees(getMathAngle({ column: 0, row: 0 }, centroid));
65+
const angle = toDegrees(getClockwiseAngle({ column: 0, row: 0 }, centroid));
6666
orientedFastKeypoints.push({ ...keypoint, angle });
6767
}
6868
return orientedFastKeypoints;

src/maskAnalysis/utils/__tests__/getAngle.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { toBeDeepCloseTo } from 'jest-matcher-deep-close-to';
22

3-
import { getAngle, getMathAngle } from '../getAngle';
3+
import { getAngle, getClockwiseAngle } from '../getAngle';
44

55
expect.extend({ toBeDeepCloseTo });
66

@@ -82,6 +82,6 @@ test.each([
8282
Math.PI / 4,
8383
],
8484
])('getMathAngle (%s)', (_, point1, point2, expectedAngle) => {
85-
const result = getMathAngle(point1, point2);
85+
const result = getClockwiseAngle(point1, point2);
8686
expect(result).toBeCloseTo(expectedAngle);
8787
});

src/maskAnalysis/utils/getAngle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export function getAngle(p1: Point, p2: Point): number {
1919
}
2020

2121
/**
22-
* Compute the mathematical angle in radians of the segment p1-p2.
22+
* Compute the clockwise angle in radians between the x-axis and the segment p1-p2.
2323
*
2424
* @param p1 - First point.
2525
* @param p2 - Second point.
26-
* @returns The angle of the segment in radians.
26+
* @returns Clockwise angle between x-axis and the segment.
2727
*/
28-
export function getMathAngle(p1: Point, p2: Point): number {
28+
export function getClockwiseAngle(p1: Point, p2: Point): number {
2929
const diff = difference(p2, p1);
3030
const vector = normalize(diff);
3131
const atan = -Math.atan(vector.row / vector.column);

0 commit comments

Comments
 (0)