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; |
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) { |
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) { |
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.map = function (iterable, mapper, options = {}) { | |
let concurrency = options.concurrency || Infinity | |
let index = 0 | |
const results = [] | |
const pending = [] | |
const iterator = iterable[Symbol.iterator]() | |
while (concurrency-- > 0) { | |
const thread = wrappedMapper() |
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
function delay (invoke, ms) { | |
return (...args) => new Promise(resolve => { | |
setTimeout(resolve, ms) | |
}).then(() => invoke.apply(...args)) | |
} | |
function delay2 (invoke, ms) { | |
return (...args) => new Promise(resolve => { | |
setTimeout(resolve, ms, invoke(...args)) | |
}) |
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.waterfall = function (array, invoke) { | |
let pending = Promise.resolve() | |
const results = [] | |
for (const item of array) { | |
pending = pending | |
.then(() => invoke(item, i)) | |
.then(result => results.push(result)) | |
} | |
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
<template> | |
<div class="tooltip" :style="style"> | |
<slot></slot> | |
</div> | |
</template> | |
<script> | |
export default { | |
props: { | |
target: { |
NewerOlder