Skip to content

Commit

Permalink
Add Line.trim
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Feb 21, 2024
1 parent 4511f03 commit cbc0b72
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ export namespace Line {
return [...xAxis, ...yAxis, ...p]
}

export function trim(
line: SimpleSegmentL,
start: SegmentLocation,
end: SegmentLocation
): SegmentL {
const startTime = toTime(line, start)
const endTime = toTime(line, end)

const newStart = point(line, startTime)
const newEnd = point(line, endTime)

return {start: newStart, point: newEnd, command: 'L'}
}

export function divideAtTimes(
line: SimpleSegmentL,
times: number[]
Expand Down

0 comments on commit cbc0b72

Please sign in to comment.