Мне нужна логика/алгоритм для объединения соединяющихся стен . Я пробовал выпуклую/вогнутую оболочку и ее варианты, но, похоже, ничего не работает так, как мне нужно.
[img]https://i.sstatic .net/BHPbBfyz.jpg[/img]
Здесь слева у нас стены, которые я рисую полигонами, а справа то, что мне нужно.
Код: Выделить всё
export type Location = {
x: number;
y: number;
};
export type Size = {
length: number;
thickness: number;
};
export type Corners = { // corner 1, 2, 3, 4 are the polygon locations for the wall
c1: Location;
c2: Location;
c3: Location;
c4: Location;
c5: number;
c6?: Location;
};
export type PlanObject = { // wall
index: number;
toolType: number; // tooltype
wallType?: number;
text?: string;
orientation: number; // will always be angle
corners: Corners;
location: Location;
size: Size;
internal: boolean;
};
Любой, кто мог бы указать мне правильный путь, был бы великолепен.
Подробнее здесь: https://stackoverflow.com/questions/793 ... -1-polygon
Мобильная версия