From bfdc1e9381e4b726f521585be5b1e2f8631d975e Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 8 Oct 2024 19:46:10 -0700 Subject: [PATCH] avoid error when esModuleInterop enabled --- src/vector.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vector.ts b/src/vector.ts index 6d55504..bef52fe 100644 --- a/src/vector.ts +++ b/src/vector.ts @@ -1,8 +1,8 @@ -import BigNumber from "bignumber.js"; +import * as bn from "bignumber.js"; export interface Vector { - x: BigNumber; - y: BigNumber; + x: bn.BigNumber; + y: bn.BigNumber; } /* Cross Product of two vectors with first point at origin */ @@ -30,7 +30,7 @@ export const cosineOfAngle = (pShared: Vector, pBase: Vector, pAngle: Vector) => /* Get the x coordinate where the given line (defined by a point and vector) * crosses the horizontal line with the given y coordiante. * In the case of parrallel lines (including overlapping ones) returns null. */ -export const horizontalIntersection = (pt: Vector, v: Vector, y: BigNumber) => { +export const horizontalIntersection = (pt: Vector, v: Vector, y: bn.BigNumber) => { if (v.y.isZero()) return null return { x: pt.x.plus((v.x.div(v.y)).times(y.minus(pt.y))), y: y } } @@ -38,7 +38,7 @@ export const horizontalIntersection = (pt: Vector, v: Vector, y: BigNumber) => { /* Get the y coordinate where the given line (defined by a point and vector) * crosses the vertical line with the given x coordiante. * In the case of parrallel lines (including overlapping ones) returns null. */ -export const verticalIntersection = (pt: Vector, v: Vector, x: BigNumber) => { +export const verticalIntersection = (pt: Vector, v: Vector, x: bn.BigNumber) => { if (v.x.isZero()) return null return { x: x, y: pt.y.plus((v.y.div(v.x)).times(x.minus(pt.x))) } }