Skip to content

Commit

Permalink
refactor(geom): minor update clippedLine()
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jan 29, 2019
1 parent 084883e commit 4b85288
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/geom/src/ctors/line.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Attribs } from "@thi.ng/geom-api";
import { liangBarsky } from "@thi.ng/geom-clip";
import { liangBarsky2 } from "@thi.ng/geom-clip";
import { Vec, VecPair } from "@thi.ng/vectors";
import { Line, Rect } from "../api";
import { argAttribs } from "../internal/args";
Expand All @@ -14,8 +14,8 @@ export function line(...args: any[]) {
export const clippedLine =
(l: Line, bounds: VecPair | Rect) => {
const res = bounds instanceof Rect ?
liangBarsky(l.points[0], l.points[1], bounds.pos, bounds.max()) :
liangBarsky(l.points[0], l.points[1], bounds[0], bounds[1]);
liangBarsky2(l.points[0], l.points[1], bounds.pos, bounds.max()) :
liangBarsky2(l.points[0], l.points[1], bounds[0], bounds[1]);
if (res) {
return new Line([res[0], res[1]], { ...l.attribs });
}
Expand Down

0 comments on commit 4b85288

Please sign in to comment.