Revision ad8e9d4f15917a78050e26fb7a846e17f90636e6 authored by Merve Asiler on 03 July 2024, 20:45:15 UTC, committed by GitHub on 03 July 2024, 20:45:15 UTC
1 parent ba0ff13
Raw File
Main.cpp
// @author Merve Asiler

#include "KernelComputation.h"
#include <iostream>
#include <string>

using namespace std;

/***********************************/
/***** Defined in Parameters.h *****/
extern void SetParameters();
/***********************************/

int main()
{

	string command_type = "", input_path = "", output_path = "", input_folder = "", output_folder = "";

	/* Example:
	command_type = "approx_ker";
	input_path = "D:/VS_Workspace/3D_Databases/DB-Star-shaped-meshes/data/star.off";
	output_path = "D:/VS_Workspace/3D_Databases/DB-Star-shaped-meshes/data/star" or "d";
	input_folder = "D:/VS_Workspace/3D_Databases/DB-Thingi/data";
	output_folder = "D:/VS_Workspace/3D_Databases/DB-Thingi/KernelResults-";
	*/

	// Command type
	cout << "Enter the command type: ";			cin >> command_type;		cout << endl;;

	// Single Execution
	if (command_type == "approx_ker" ||							// the proposed algorithm
		command_type == "kernel_by_cgal" ||						// CGAL's kernel computation algorithm
		command_type == "compare_algos") {						// compares the proposed algorithm with CGAL's

		cout << "Enter the input path (.off/.obj): ";		cin >> input_path;		cout << endl;

		if (command_type == "approx_ker" || command_type == "kernel_by_cgal") {
			cout << "Enter the output path : ";		cin >> output_path;		cout << endl;
		}
	}

	// Batch Execution
	else if (command_type == "batch_approx_ker" ||
		command_type == "batch_kernel_by_cgal") {

		cout << "Enter the input folder: ";			cin >> input_folder;		cout << endl;
		cout << "Enter the output folder: ";		cin >> output_folder;		cout << endl;
	}

	// Undefined Operation
	else
		cout << "Undefined Operation!" << endl;


	// Define parameter values for the proposed approximate kernel algorithm
	if (command_type == "approx_ker" || command_type == "batch_approx_ker" || command_type == "compare_algos")
		SetParameters();


	cout << "Processing..." << endl << endl;


	// COMPUTE KERNEL BY <"KERNEL APPROXIMATION"  OR  "CGAL">
	if (command_type == "approx_ker" || command_type == "kernel_by_cgal")
		ComputeKernel(input_path, output_path, command_type);

	// COMPUTE KERNEL BY <"KERNEL APPROXIMATION"  OR  "CGAL"> FOR ALL MESH FILES IN THE GIVEN FOLDER
	else if (command_type == "batch_approx_ker" || command_type == "batch_kernel_by_cgal")
		ComputeBatchKernel(input_folder, output_folder, command_type);

	// COMPARE KERNEL RESULTS for "CGAL"  AND  "KERNEL APPROXIMATION"
	else // if (command_type == "compare_algos")
		CompareAlgos(input_path);


	// Finalize
	cout << "Completed." << endl;

	// Quit
	while (true) {
		cout << "Press \'q\' to terminate!" << endl;
		cin >> command_type;
		if (command_type == "q" || command_type == "Q")
			break;
	}

	return 0;

}
back to top