Skip to content

Commit

Permalink
clean code; prepare for next step test
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Nov 19, 2024
1 parent f38ef81 commit 1d5cc67
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ add_subdirectory(model)
add_subdirectory(renderer)


add_subdirectory(Example)
add_subdirectory(PolyFit)
add_subdirectory(polyfit)


2 changes: 1 addition & 1 deletion code/basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set(basic_SOURCES
)


add_library(${PROJECT_NAME} SHARED ${basic_SOURCES} ${basic_HEADERS})
add_library(${PROJECT_NAME} STATIC ${basic_SOURCES} ${basic_HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES
FOLDER "PolyFit")

Expand Down
2 changes: 1 addition & 1 deletion code/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(math_SOURCES
)


add_library(${PROJECT_NAME} SHARED ${math_SOURCES} ${math_HEADERS})
add_library(${PROJECT_NAME} STATIC ${math_SOURCES} ${math_HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES
FOLDER "PolyFit")

Expand Down
2 changes: 1 addition & 1 deletion code/method/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set(method_SOURCES
)


add_library(${PROJECT_NAME} SHARED ${method_SOURCES} ${method_HEADERS})
add_library(${PROJECT_NAME} STATIC ${method_SOURCES} ${method_HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES
FOLDER "PolyFit")

Expand Down
2 changes: 1 addition & 1 deletion code/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ set(model_SOURCES
kdtree/kdTree.cpp
)

add_library(${PROJECT_NAME} SHARED ${model_SOURCES} ${model_HEADERS})
add_library(${PROJECT_NAME} STATIC ${model_SOURCES} ${model_HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES
FOLDER "PolyFit")

Expand Down
File renamed without changes.
22 changes: 18 additions & 4 deletions code/Example/main.cpp → code/polyfit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


#include "../basic/logger.h"
#include "../basic/file_utils.h"
#include "../model/point_set.h"
#include "../model/map.h"
#include "../method/method_global.h"
Expand All @@ -33,10 +34,23 @@ int main(int argc, char **argv)
// initialize the logger (this is not optional)
Logger::initialize();

// input point cloud file name
const std::string input_file = (argc > 1) ? argv[1] : std::string(POLYFIT_CODE_DIR) + "/../data/toy_data.bvg";
// output mesh file name
const std::string output_file = (argc > 2) ? argv[2] : std::string(POLYFIT_CODE_DIR) + "/../data/toy_data-result.obj";
if (argc != 3) {
std::cerr << "Usage:" << std::endl
<< "\t./polyfit <input_file.[vg] or [bvg]> <output_file.obj>" << std::endl
<< "Example:" << std::endl
<< "\t./polyfit sphere.bvg sphere-result.obj" << std::endl;
return EXIT_FAILURE;
}
const std::string input_file = argv[1];
if (!FileUtils::is_file(input_file)) {
std::cerr << "file '" << input_file << "' does not exist. Please check and make sure the path is correct" << std::endl;
return EXIT_FAILURE;
}
const std::string output_file = argv[2];
if (FileUtils::extension(output_file) != "obj") {
std::cerr << "the output file is expected to have 'obj' as file extension" << std::endl;
return EXIT_FAILURE;
}

// below are the default parameters (change these when necessary)
Method::lambda_data_fitting = 0.43;
Expand Down
2 changes: 1 addition & 1 deletion code/renderer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(renderer_SOURCES
)


add_library(${PROJECT_NAME} SHARED ${renderer_SOURCES} ${renderer_HEADERS})
add_library(${PROJECT_NAME} STATIC ${renderer_SOURCES} ${renderer_HEADERS})
set_target_properties(${PROJECT_NAME} PROPERTIES
FOLDER "PolyFit")

Expand Down

0 comments on commit 1d5cc67

Please sign in to comment.