chore: install prettier
This commit is contained in:
@@ -10,22 +10,22 @@ export class GeometryCallback {
|
||||
let pt2 = new THREE.Vector3().set(x2, y2, 0).applyMatrix4(this.vpXform);
|
||||
|
||||
this.lines.push({
|
||||
x1: pt1.x,
|
||||
x1: pt1.x,
|
||||
y1: pt1.y,
|
||||
x2: pt2.x,
|
||||
y2: pt2.y
|
||||
x2: pt2.x,
|
||||
y2: pt2.y,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function getBounds(dbId, frags) {
|
||||
let fragIds = frags.fragments.dbId2fragId[dbId];
|
||||
if (typeof fragIds === 'number') {
|
||||
let fragIds = frags.fragments.dbId2fragId[dbId];
|
||||
if (typeof fragIds === "number") {
|
||||
fragIds = [fragIds];
|
||||
};
|
||||
}
|
||||
|
||||
const bounds = fragIds.map(fId => {
|
||||
const bound = new THREE.Box3();
|
||||
const bounds = fragIds.map((fId) => {
|
||||
const bound = new THREE.Box3();
|
||||
const boundsCallback = new Autodesk.Viewing.Private.BoundsCallback(bound);
|
||||
const mesh = frags.getVizmesh(fId);
|
||||
const vbr = new Autodesk.Viewing.Private.VertexBufferReader(mesh.geometry, viewer.impl.use2dInstancing);
|
||||
@@ -33,7 +33,7 @@ export function getBounds(dbId, frags) {
|
||||
return bound;
|
||||
});
|
||||
|
||||
return bounds;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
export function extractPoints(lines) {
|
||||
@@ -50,8 +50,10 @@ export function extractPoints(lines) {
|
||||
|
||||
for (let i = 0; i < allPoints.length; i++) {
|
||||
const element = allPoints[i];
|
||||
|
||||
const notFound = !pointsDeduped.find(pt => Math.abs(pt.x - element.x) < tolerance && Math.abs(pt.y - element.y) < tolerance);
|
||||
|
||||
const notFound = !pointsDeduped.find(
|
||||
(pt) => Math.abs(pt.x - element.x) < tolerance && Math.abs(pt.y - element.y) < tolerance,
|
||||
);
|
||||
if (notFound) pointsDeduped.push(element);
|
||||
}
|
||||
|
||||
@@ -61,9 +63,9 @@ export function extractPoints(lines) {
|
||||
export function sortByAngle(points) {
|
||||
// Calculate centroid
|
||||
const centroid = new THREE.Vector3();
|
||||
points.forEach(v => centroid.add(v));
|
||||
points.forEach((v) => centroid.add(v));
|
||||
centroid.divideScalar(points.length);
|
||||
|
||||
|
||||
// Sort by angle around centroid
|
||||
return points.slice().sort((a, b) => {
|
||||
const angleA = Math.atan2(a.y - centroid.y, a.x - centroid.x);
|
||||
@@ -73,23 +75,15 @@ export function sortByAngle(points) {
|
||||
}
|
||||
|
||||
export function getColorByIndex(i) {
|
||||
const colors = [
|
||||
'magenta',
|
||||
'red',
|
||||
'orange',
|
||||
'yellow',
|
||||
'chartreuse',
|
||||
'green',
|
||||
'blue',
|
||||
]
|
||||
if (i === 0) return 'black';
|
||||
const colors = ["magenta", "red", "orange", "yellow", "chartreuse", "green", "blue"];
|
||||
if (i === 0) return "black";
|
||||
return colors[i % 7];
|
||||
}
|
||||
|
||||
/**
|
||||
* - THREE.Color: `{ r: number, g: number, b: number }`
|
||||
* - THREE.Vector4: `{ x: number, y: number, z: number, w: number }`
|
||||
*
|
||||
*
|
||||
* @param {string} colorStr e.g. `'#ff0000'`, `'white'`, `'hotpink'`
|
||||
* @returns A Vector4 object
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user