Skip to content

Commit

Permalink
Merge pull request #16 from cmurphy23/main
Browse files Browse the repository at this point in the history
avoid error when esModuleInterop enabled
  • Loading branch information
luizbarboza authored Oct 15, 2024
2 parents ea8a468 + bfdc1e9 commit 09ffd30
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/vector.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down Expand Up @@ -30,15 +30,15 @@ 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 }
}

/* 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))) }
}
Expand Down

0 comments on commit 09ffd30

Please sign in to comment.