-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProblem.m
66 lines (54 loc) · 2.58 KB
/
Problem.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% Code implementing the paper "Injective and Bounded Mappings in 3D".
% Disclaimer: The code is provided as-is and without any guarantees. Please contact the author to report any bugs.
% Written by Noam Aigerman, http://www.wisdom.weizmann.ac.il/~noamaig/
classdef Problem <handle
%class representing the problem at hand.
properties
%K;
TD;%target dim
SD;%source dim
%PRE CALCULATED VARIABLES
LIN_N;%ELEMENTS IN LINEAR PART OF MAP ON FACE
AFF_N;%ELEMENTS IN LINEAR + translation PART OF MAP ON FACE
NODES_IN_PRIMITIVE; %HOW MANY VERTICES in A FACE\TET
%INITIAL_GUESS; %INITIAL GUESS OF FRAMES
INDS_TO_DEFINE_TRANSFORMATION_ELEMENT; %HOW MANY pos. VARIABLES TO DEFINE ONE TRANFORMATION ELEMENT
N; % # OF VERTICES
SOURCE_POS; %INITIAL POSITION OF VERTICES (THE SOURCE MESH)
INITIAL_TARGET_POS; %INITIAL TARGET POSITION
SOL_LENGTH; %LENGTH OF SOLUTION
TRI; %the triangulation\tetrahedration of the mesh
CONSTRAINTS={};
MESH_VOLUME;
INITIAL_GLOBAL_A={};
FACES=[];
end
methods
function PROBLEM=Problem(TD,SD,initialSourcePos,initialTargetPos,tri,constraints,ALG,faces)
vol=0;
for i=1:length(faces)
vol=vol+faces{i}.volume;
PROBLEM.INITIAL_GLOBAL_A{i}=faces{i}.tframe*faces{i}.A*faces{i}.sframe';
end
%PROBLEM.K=K;
PROBLEM.TD=TD;%target dim
PROBLEM.SD=SD;%source dim
PROBLEM.LIN_N=PROBLEM.SD*PROBLEM.TD;
PROBLEM.AFF_N=PROBLEM.LIN_N+PROBLEM.TD;
PROBLEM.NODES_IN_PRIMITIVE=PROBLEM.SD+1;
%PROBLEM.INITIAL_GUESS=initialGuessFrames;
PROBLEM.INDS_TO_DEFINE_TRANSFORMATION_ELEMENT=PROBLEM.TD*PROBLEM.NODES_IN_PRIMITIVE;
PROBLEM.INITIAL_TARGET_POS=initialTargetPos;
PROBLEM.N=size(initialSourcePos,1);
PROBLEM.SOURCE_POS=initialSourcePos;
PROBLEM.SOL_LENGTH=PROBLEM.N*PROBLEM.TD;
PROBLEM.TRI=tri;
% PROBLEM.CONSTRAINTS.ANCHORS=anchors; %indexes of vertices that are anchored
% PROBLEM.CONSTRAINTS.ANCHOR_COORDS=anchor_coords; %the coordinates to move the vertices to
%PROBLEM.CONSTRAINTS=PosConstraints(anchors,anchor_coords,TD,PROBLEM.SOL_LENGTH,initialSourcePos);
PROBLEM.CONSTRAINTS=constraints;
PROBLEM.MESH_VOLUME=vol;
PROBLEM.FACES=faces;
end
end
end