Skip to content

Commit

Permalink
refactor(geom-poly-utils): update type usage
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 19, 2024
1 parent a1dbad0 commit 7f59e91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/geom-poly-utils/src/circumcenter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Maybe } from "@thi.ng/api";
import { EPS } from "@thi.ng/math/api";
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
import { add3 } from "@thi.ng/vectors/add";
Expand All @@ -22,7 +23,7 @@ export const circumCenter2 = (
b: ReadonlyVec,
c: ReadonlyVec,
eps = EPS
): Vec | undefined => {
): Maybe<Vec> => {
const ax = a[0],
ay = a[1];
const bx = b[0],
Expand Down Expand Up @@ -87,7 +88,7 @@ export const circumCenter3 = (
b: ReadonlyVec,
c: ReadonlyVec,
eps = EPS
): Vec | undefined => {
): Maybe<Vec> => {
const ab = sub3([], b, a);
const ac = sub3([], c, a);
const d = cross3([], ab, ac);
Expand Down
5 changes: 3 additions & 2 deletions packages/geom-poly-utils/src/tangent.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Maybe } from "@thi.ng/api";
import { EPS } from "@thi.ng/math/api";
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
import { addmN } from "@thi.ng/vectors/addmn";
Expand Down Expand Up @@ -64,8 +65,8 @@ export const smoothTangents = (
const res: Vec[] = [];
const n = pts.length - 1;
if (n < 1) return res;
let prev: Vec | undefined;
let plen: number | undefined;
let prev: Maybe<Vec>;
let plen: Maybe<number>;
if (close) {
prev = sub([], pts[0], pts[n]);
plen = mag(prev!);
Expand Down

0 comments on commit 7f59e91

Please sign in to comment.