This repository was archived by the owner on Jul 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +26
-20
lines changed
featureMatching/descriptors Expand file tree Collapse file tree 5 files changed +26
-20
lines changed Original file line number Diff line number Diff line change 1
1
root : true
2
- extends : [cheminfo-typescript, cheminfo-typescript/jsdoc]
3
- plugins : [jest]
2
+ extends :
3
+ - cheminfo-typescript
4
+ - cheminfo-typescript/jsdoc
5
+ - cheminfo-typescript/unicorn
6
+ plugins :
7
+ - jest
4
8
rules :
5
9
' @typescript-eslint/restrict-template-expressions ' : off
6
10
' jest/no-focused-tests ' : ' error'
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ export function getBriefDescriptors(
94
94
let patch : Image ;
95
95
try {
96
96
patch = getKeypointPatch ( smoothed , keypoint , { patchSize } ) ;
97
- } catch ( err ) {
97
+ } catch {
98
98
continue ;
99
99
}
100
100
if ( patch === null ) continue ;
Original file line number Diff line number Diff line change @@ -237,8 +237,8 @@ export class Roi {
237
237
let two = 0 ;
238
238
let three = 0 ;
239
239
let four = 0 ;
240
- let externalIDs = this . externalBorders . map (
241
- ( element ) => element . connectedID ,
240
+ let externalIDs = new Set (
241
+ this . externalBorders . map ( ( element ) => element . connectedID ) ,
242
242
) ;
243
243
for ( let column = 0 ; column < this . width ; column ++ ) {
244
244
for ( let row = 0 ; row < this . height ; row ++ ) {
@@ -247,25 +247,25 @@ export class Roi {
247
247
let nbAround = 0 ;
248
248
if ( column === 0 ) {
249
249
nbAround ++ ;
250
- } else if ( externalIDs . includes ( data [ target - 1 ] ) ) {
250
+ } else if ( externalIDs . has ( data [ target - 1 ] ) ) {
251
251
nbAround ++ ;
252
252
}
253
253
254
254
if ( column === roiMap . width - 1 ) {
255
255
nbAround ++ ;
256
- } else if ( externalIDs . includes ( data [ target + 1 ] ) ) {
256
+ } else if ( externalIDs . has ( data [ target + 1 ] ) ) {
257
257
nbAround ++ ;
258
258
}
259
259
260
260
if ( row === 0 ) {
261
261
nbAround ++ ;
262
- } else if ( externalIDs . includes ( data [ target - roiMap . width ] ) ) {
262
+ } else if ( externalIDs . has ( data [ target - roiMap . width ] ) ) {
263
263
nbAround ++ ;
264
264
}
265
265
266
266
if ( row === roiMap . height - 1 ) {
267
267
nbAround ++ ;
268
- } else if ( externalIDs . includes ( data [ target + roiMap . width ] ) ) {
268
+ } else if ( externalIDs . has ( data [ target + roiMap . width ] ) ) {
269
269
nbAround ++ ;
270
270
}
271
271
switch ( nbAround ) {
Original file line number Diff line number Diff line change @@ -14,21 +14,21 @@ test('ellipse on a small figure 3x3', () => {
14
14
center : { column : 1 , row : 1 } ,
15
15
majorAxis : {
16
16
points : [
17
- { column : NaN , row : Infinity } ,
18
- { column : NaN , row : - Infinity } ,
17
+ { column : Number . NaN , row : Number . POSITIVE_INFINITY } ,
18
+ { column : Number . NaN , row : Number . NEGATIVE_INFINITY } ,
19
19
] ,
20
- length : Infinity ,
21
- angle : NaN ,
20
+ length : Number . POSITIVE_INFINITY ,
21
+ angle : Number . NaN ,
22
22
} ,
23
23
minorAxis : {
24
24
points : [
25
- { column : NaN , row : NaN } ,
26
- { column : NaN , row : NaN } ,
25
+ { column : Number . NaN , row : Number . NaN } ,
26
+ { column : Number . NaN , row : Number . NaN } ,
27
27
] ,
28
- length : NaN ,
29
- angle : NaN ,
28
+ length : Number . NaN ,
29
+ angle : Number . NaN ,
30
30
} ,
31
- surface : NaN ,
31
+ surface : Number . NaN ,
32
32
} ) ;
33
33
} ) ;
34
34
test ( 'ellipse on a small figure 3x3' , ( ) => {
Original file line number Diff line number Diff line change @@ -33,16 +33,18 @@ export function getCirclePoints(radius: number): Point[] {
33
33
return firstQuarter . concat ( secondQuarter , thirdQuarter , fourthQuarter ) ;
34
34
}
35
35
36
+ const zeroPoint : Point = { row : 0 , column : 0 } ;
37
+
36
38
/**
37
39
* Get the coordinates of the points in a circle of given radius. The points are sorted by column then row.
38
40
*
39
41
* @param radius - Radius of the circle.
40
- * @param center - Center of the cirlce .
42
+ * @param center - Center of the circle .
41
43
* @returns The coordinates of the points in a circle of given radius.
42
44
*/
43
45
export function getFilledCirclePoints (
44
46
radius : number ,
45
- center : Point = { column : 0 , row : 0 } ,
47
+ center : Point = zeroPoint ,
46
48
) : Point [ ] {
47
49
let circlePoints : Point [ ] = [ ] ;
48
50
You can’t perform that action at this time.
0 commit comments