old dwinzo files updated

This commit is contained in:
2025-03-22 18:33:02 +05:30
parent 111a2e6581
commit 6987e38750
186 changed files with 19940 additions and 389 deletions

View File

@@ -0,0 +1,26 @@
import * as THREE from 'three';
import * as Types from "../../world/worldTypes";
function getClosestIntersection(
intersects: Types.Vector3Array,
point: Types.Vector3
): Types.Vector3 | null {
////////// A function that finds which point is closest from the intersects points that is given, Used in finding which point in a line is closest when clicked on a line during drawing //////////
let closestNewPoint: THREE.Vector3 | null = null;
let minDistance = Infinity;
for (const intersect of intersects) {
const distance = point.distanceTo(intersect);
if (distance < minDistance) {
minDistance = distance;
closestNewPoint = intersect;
}
}
return closestNewPoint;
}
export default getClosestIntersection;