Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid error when esModuleInterop enabled #16

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading