merged with main
This commit is contained in:
@@ -19,6 +19,7 @@ export const createProject = async (projectUuid: string, userId: string, thumbna
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log('result: ', result);
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
|
||||
@@ -20,6 +20,7 @@ export const recentlyViewed = async (organization: string, userId: string) => {
|
||||
}
|
||||
|
||||
|
||||
console.log('response: ', response);
|
||||
return await response.json();
|
||||
} catch (error: any) {
|
||||
console.error("Failed to get project");
|
||||
|
||||
@@ -8,9 +8,9 @@ export const restoreTrash = async (organization: string, projectId: string) => {
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||
"Content-Type": "application/json",
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export const restoreTrash = async (organization: string, projectId: string) => {
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log('restore: ', data);
|
||||
console.log("restore: ", response);
|
||||
return data;
|
||||
} catch (error: any) {
|
||||
console.error("Failed to fetch trash data:", error);
|
||||
|
||||
40
app/src/services/simulation/webWorkers/collisionWorker.ts
Normal file
40
app/src/services/simulation/webWorkers/collisionWorker.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
onmessage = function (e) {
|
||||
const { materials, positions, sizes } = e.data;
|
||||
const collisions = [];
|
||||
const allPairs = [];
|
||||
|
||||
for (let i = 0; i < materials.length; i++) {
|
||||
for (let j = i + 1; j < materials.length; j++) {
|
||||
const mat1 = materials[i];
|
||||
const mat2 = materials[j];
|
||||
const pos1 = positions[mat1.materialId];
|
||||
const pos2 = positions[mat2.materialId];
|
||||
|
||||
if (!pos1 || !pos2) continue;
|
||||
|
||||
const size1 = sizes[mat1.materialId] || 0.2;
|
||||
const size2 = sizes[mat2.materialId] || 0.2;
|
||||
|
||||
const distance = Math.sqrt(
|
||||
Math.pow(pos1.x - pos2.x, 2) +
|
||||
Math.pow(pos1.y - pos2.y, 2) +
|
||||
Math.pow(pos1.z - pos2.z, 2)
|
||||
);
|
||||
|
||||
allPairs.push({
|
||||
materialId1: mat1.materialId,
|
||||
materialId2: mat2.materialId
|
||||
});
|
||||
|
||||
if (distance < (size1 + size2)) {
|
||||
collisions.push({
|
||||
materialId1: mat1.materialId,
|
||||
materialId2: mat2.materialId,
|
||||
distance: distance
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
postMessage({ collisions, allPairs });
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
|
||||
type Side = "top" | "bottom" | "left" | "right";
|
||||
|
||||
export const panelData = async (
|
||||
|
||||
Reference in New Issue
Block a user