Skip to content

Commit

Permalink
refactor(geom-isec): replace MultiISecOp type w/ MultiVecOpImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Dec 17, 2019
1 parent 5520968 commit 40c384c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions packages/geom-isec/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { IntersectionResult, IntersectionType } from "@thi.ng/geom-api";
import { MultiVecOp } from "@thi.ng/vectors";

export type MultiIsecOp<T> = MultiVecOp<T> & T;

export const NONE: IntersectionResult = Object.freeze({
type: IntersectionType.NONE
Expand Down
6 changes: 3 additions & 3 deletions packages/geom-isec/src/point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
distSq,
magSq,
mixN,
MultiVecOpImpl,
ReadonlyVec,
signedArea2,
vop
} from "@thi.ng/vectors";
import { MultiIsecOp } from "./api";

export const pointInSegment = (
p: ReadonlyVec,
Expand Down Expand Up @@ -106,7 +106,7 @@ export const classifyPointPolyPair = (
? inside ^ (ax + ((py - ay) / (by - ay)) * (bx - ax) < px ? 1 : 0)
: inside;

export const pointInBox: MultiIsecOp<Fn3<
export const pointInBox: MultiVecOpImpl<Fn3<
ReadonlyVec,
ReadonlyVec,
ReadonlyVec,
Expand Down Expand Up @@ -142,7 +142,7 @@ pointInBox.default((p, boxMin, boxSize) => {
return true;
});

export const pointInCenteredBox: MultiIsecOp<Fn3<
export const pointInCenteredBox: MultiVecOpImpl<Fn3<
ReadonlyVec,
ReadonlyVec,
ReadonlyVec,
Expand Down
5 changes: 2 additions & 3 deletions packages/geom-isec/src/rect-circle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Fn4 } from "@thi.ng/api";
import { ReadonlyVec, vop } from "@thi.ng/vectors";
import { MultiIsecOp } from "./api";
import { MultiVecOpImpl, ReadonlyVec, vop } from "@thi.ng/vectors";

/**
* Returns true if given 2D rect defined by `rectMinPos` and `rectSize`
Expand Down Expand Up @@ -42,7 +41,7 @@ export const testAABBSphere = (
* @param spherePos
* @param r
*/
export const testCenteredBoxSphere: MultiIsecOp<Fn4<
export const testCenteredBoxSphere: MultiVecOpImpl<Fn4<
ReadonlyVec,
ReadonlyVec,
ReadonlyVec,
Expand Down

0 comments on commit 40c384c

Please sign in to comment.