Logo
Explore Help
Sign In
Dwinzo-Beta/Dwinzo_Demo
4
0
Fork 0
You've already forked Dwinzo_Demo
Code Issues Pull Requests Packages Projects Releases Wiki Activity
Files
23e7ba39e86f77bfd076b1b6e7b994a663680797
Dwinzo_Demo/app/src/modules/builder/functions/getArea.ts

11 lines
309 B
TypeScript
Raw Normal View History

Refactor builder module and remove unused components - Removed CalculateAreaGroup and computeArea function as they were no longer needed. - Updated Floor2DInstance and Zone2DInstance to calculate area and centroid using new utility functions. - Refactored WallInstances to include Floor2D rendering and improved area display. - Cleaned up imports and ensured consistent formatting across files. - Enhanced performance by memoizing calculations for area and centroid. - Removed deprecated state management for rooms and version history visibility.
2025-09-08 13:46:47 +05:30
import { Vector2 } from "three";
export default function getArea(points: Vector2[]): number {
let sum = 0;
for (let i = 0; i < points.length; i++) {
const j = (i + 1) % points.length;
sum += points[i].x * points[j].y - points[j].x * points[i].y;
}
return Math.abs(sum / 2);
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.1 Page: 900ms Template: 8ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API