Skip to content

Commit

Permalink
fix(geom): arg order pointAt() impl (RAY/RAY3)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Oct 2, 2020
1 parent 142515f commit 6ec9b46
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/geom/src/ops/point-at.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { IObjectOf } from "@thi.ng/api";
import { defmulti, Implementation2 } from "@thi.ng/defmulti";
import { IShape, Type } from "@thi.ng/geom-api";
import { Sampler } from "@thi.ng/geom-resample";
Expand All @@ -8,7 +9,8 @@ import {
mixCubic,
mixN2,
mixQuadratic,
pointAtOnRay,
pointOnRay2,
pointOnRay3,
Vec,
} from "@thi.ng/vectors";
import { Arc } from "../api/arc";
Expand All @@ -22,7 +24,6 @@ import { Ray } from "../api/ray";
import { Rect } from "../api/rect";
import { dispatch } from "../internal/dispatch";
import { vertices } from "./vertices";
import type { IObjectOf } from "@thi.ng/api";

export const pointAt = defmulti<IShape, number, Vec>(dispatch);

Expand All @@ -45,7 +46,9 @@ pointAt.addAll(<IObjectOf<Implementation2<unknown, number, Vec>>>{
[Type.QUADRATIC]: ({ points }: Quadratic, t) =>
mixQuadratic([], points[0], points[1], points[2], t),

[Type.RAY]: ($: Ray, t) => pointAtOnRay([], $.dir, t, $.pos),
[Type.RAY]: ($: Ray, t) => pointOnRay2([], $.pos, $.dir, t),

[Type.RAY3]: ($: Ray, t) => pointOnRay3([], $.pos, $.dir, t),

[Type.RECT]: ($: Rect, t) => new Sampler(vertices($), true).pointAt(t),
});
Expand Down

0 comments on commit 6ec9b46

Please sign in to comment.