-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathroom3DFromHyp.m
executable file
·32 lines (26 loc) · 980 Bytes
/
room3DFromHyp.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [ objects] = room3DFromHyp( points, floor_height )
%ROOM3DFROMHYP Popup room layout hypothesis to 3D
% points: room corner in sequence in room layout
% floor_height: assumed floor height, e.g. -160
% uv = xyz2uvN(points);
% high_height = floor_height * tan(uv(1:4,2))./tan(uv(5:8,2));
% ceil_height = mean(high_height);
%
% point3D = zeros(8,3);
% for i = 5:8
% point3D(i,:) = LineFaceIntersection([0 0 floor_height], [0 0 1], [0 0 0], points(i,:));
% end
COUNTER_CLOCKWISE = true;
FITTINGRULES;
[pt I] = sortXYZ(points(1:4,:));
pd = points(5:8,:); pd = pd(I,:);
sort_points = [pd;pt];
ann_points = sort_points(POINTMAPPING{3},:);
objects = struct('out_points_w',[],'name',[],'type',[],'points',[],'x_w',[]);
[ out_point, x, fval, succ ] = initial_cuboid_3D( ann_points, 3, floor_height, 3, true );
objects.points = ann_points;
objects.type = 3;
objects.name = 'room';
objects.out_points_w = out_point;
objects.x_w = x;
end