-
Notifications
You must be signed in to change notification settings - Fork 1
/
Testing.cpp
68 lines (50 loc) · 1.75 KB
/
Testing.cpp
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
66
67
68
#include <iostream>
#include <filesystem>
#include "cage_deform_gc_2D_3D.h"
#include <fstream>
using namespace std;
using namespace GreenCoordinates;
int main(int argc, char* argv[])
{
if (argc != 3) {
cerr << "usage: " << argv[0] << " model.obj cage.2d\n";
return __LINE__;
}
// Create an instance of the "green_coords_2d" class
green_coords_2d def;
// Load the model points from the provided file
def.load_model_points(argv[1]);
// Load the cage from the provided file
def.load_cage(argv[2]);
// Save the original cage to a obj file
def.saveToFile_cage("./green/cage_origin.obj");
// Calculate the Green Coordinates for the loaded model and cage
def.calculate_green_coords();
{
// Move the third vertex of the cage to a specified position
const double pos[2] = { -0.1, 1.1 };
def.move_cage(3, pos, false);
}
{
// Move the fourth vertex of the cage to a specified position
const double pos[2] = { 0.9, 1.1 };
def.move_cage(4, pos, false);
}
{
// Move the fifth vertex of the cage to a specified position
const double pos[2] = { 0.9, -0.1 };
def.move_cage(5, pos, false);
}
// Save the model with the original cage to a obj file
def.saveToFile("./green/origin.obj");
// Perform the deformation
def.deform();
// Save the deformed mesh to a obj file
def.saveToFile("./green/mesh.obj");
// Save the modified cage to a obj file
def.saveToFile_cage("./green/cage.obj");
// Save the normals of the modified cage to a obj file
def.saveToFile_normal("./green/cage_normal.obj");
cout << "done\n";
return 0;
}