This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _noop from "lodash/noop"; | |
import SparseBitmask from "./SparseBitmask"; | |
import { OrderedSet, OrderedMap } from "./OrderedCollections"; | |
interface RunNode { | |
currState: OrderedSet<number>; | |
diff: Set<number>; | |
pending: Set<number>; | |
newFlag: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SparseBitmask, { | |
unionRunEnds, | |
intersectionRunEnds, | |
subtractionRunEnds, | |
} from "./SparseBitmask"; | |
import Bitmask from "./Bitmask"; | |
import { memoized, numberHasher } from "./memo"; | |
import { OrderedSet } from "./OrderedCollections"; | |
interface TransformedPolygon { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
iterFilter, | |
iterFilterIndex, | |
ArrayConstructor, | |
ArrayLike, | |
} from "./base"; | |
import { OrderedSet } from "./OrderedCollections"; | |
export default class SparseBitmask { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class OrderedSet<T> { | |
private heap: T[] = []; | |
private sorted: T[] = []; | |
private heapIndex = new Map<T, number>(); | |
private comparator: (item: T) => any; | |
constructor(comparator: (item: T) => any = item => item) { | |
this.comparator = comparator; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Stack } from './common.js'; | |
export function decodeBitmask( | |
encoded: Uint8Array, | |
maxIndex: number | |
): Iterable<number> { | |
return { | |
*[Symbol.iterator]() { | |
const n = maxIndex + 1; | |
const depth = Math.ceil(Math.log2(n)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAX_LEVEL = 30; | |
const STACK = new Float32Array((7 * MAX_LEVEL + 1) * 4); | |
interface OctreeHeader { | |
version: number; | |
precision: number; | |
maxLevel: number; | |
nodeCounts: number[]; | |
leafCount: number; | |
dataStartOffset: number; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MinHeap { | |
constructor (comparator = (a, b) => a - b) { | |
this._data = [] | |
this._comparator = comparator | |
} | |
push (...values) { | |
for (const v of values) { | |
let cIndex = this._data.push(v) - 1 | |
while (cIndex > 0) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.filter = function (iterable, filterer, options = {}) { | |
let concurrency = options.concurrency || Infinity | |
let index = 0 | |
const results = [] | |
const predicates = [] | |
const pending = [] | |
const iterator = iterable[Symbol.iterator]() | |
while (concurrency-- > 0) { |
NewerOlder