Skip to content

Commit

Permalink
refactor(geom-resample): update type usage
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 19, 2024
1 parent 7f59e91 commit 28c96bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/geom-resample/src/sampler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Maybe } from "@thi.ng/api";
import {
closestPointPolyline,
closestPointSegment,
Expand Down Expand Up @@ -32,7 +33,7 @@ export class Sampler {
return idx ? idx[idx.length - 1] : 0;
}

pointAt(t: number): Vec | undefined {
pointAt(t: number): Maybe<Vec> {
const pts = this.points;
const n = pts.length - 1;
if (n < 0) {
Expand Down Expand Up @@ -87,7 +88,7 @@ export class Sampler {
: undefined;
}

segmentAt(t: number): VecPair | undefined {
segmentAt(t: number): Maybe<VecPair> {
let i = this.indexAt(t);
if (i === undefined) {
return;
Expand All @@ -101,7 +102,7 @@ export class Sampler {
return seg ? normalize(null, sub([], seg[1], seg[0]), n) : undefined;
}

splitAt(t: number): Vec[][] | undefined {
splitAt(t: number): Maybe<Vec[][]> {
if (t <= 0 || t >= 1) {
return [this.points];
}
Expand Down Expand Up @@ -142,7 +143,7 @@ export class Sampler {
* @param start
* @param end
*/
extractRange(start: number, end: number): Vec[] | undefined {
extractRange(start: number, end: number): Maybe<Vec[]> {
if (start > end) {
const t = start;
start = end;
Expand Down

0 comments on commit 28c96bb

Please sign in to comment.