display
This commit is contained in:
parent
af5f436604
commit
e351a15d75
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -10,3 +10,9 @@
|
||||
[submodule "4-LaplacianSmoothing/c++/deps/geometry-central"]
|
||||
path = 4-LaplacianSmoothing/c++/deps/geometry-central
|
||||
url = https://github.com/nmwsharp/geometry-central.git
|
||||
[submodule "5-GeomProcessing/deps/polyscope"]
|
||||
path = 5-GeomProcessing/deps/polyscope
|
||||
url = https://github.com/nmwsharp/polyscope.git
|
||||
[submodule "5-GeomProcessing/deps/geometry-central"]
|
||||
path = 5-GeomProcessing/deps/geometry-central
|
||||
url = https://github.com/nmwsharp/geometry-central.git
|
||||
|
67
5-GeomProcessing/CMakeLists.txt
Normal file
67
5-GeomProcessing/CMakeLists.txt
Normal file
@ -0,0 +1,67 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
project(CGDI-4)
|
||||
|
||||
|
||||
# Print the build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release" FORCE)
|
||||
endif()
|
||||
message(STATUS "cmake build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
### Configure the compiler
|
||||
# This is a basic, decent setup that should do something sane on most compilers
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
|
||||
# using Clang (linux or apple) or GCC
|
||||
message("Using clang/gcc compiler flags")
|
||||
SET(BASE_CXX_FLAGS "-std=c++11 -Wall -Wextra")
|
||||
SET(DISABLED_WARNINGS " -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations -Wno-missing-braces -Wno-unused-private-field")
|
||||
SET(TRACE_INCLUDES " -H -Wno-error=unused-command-line-argument")
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
message("Setting clang-specific options")
|
||||
SET(BASE_CXX_FLAGS "${BASE_CXX_FLAGS} -ferror-limit=3 -fcolor-diagnostics")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "-g3 -fsanitize=address -fno-limit-debug-info")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
message("Setting gcc-specific options")
|
||||
SET(BASE_CXX_FLAGS "${BASE_CXX_FLAGS} -fmax-errors=5")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "-g3")
|
||||
SET(DISABLED_WARNINGS "${DISABLED_WARNINGS} -Wno-maybe-uninitialized -Wno-format-zero-length -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
|
||||
endif()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${BASE_CXX_FLAGS} ${DISABLED_WARNINGS}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG")
|
||||
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
message("Using Visual Studio compiler flags")
|
||||
set(BASE_CXX_FLAGS "${BASE_CXX_FLAGS} /W4")
|
||||
set(BASE_CXX_FLAGS "${BASE_CXX_FLAGS} /MP") # parallel build
|
||||
SET(DISABLED_WARNINGS "${DISABLED_WARNINGS} /wd\"4267\"") # ignore conversion to smaller type (fires more aggressively than the gcc version, which is annoying)
|
||||
SET(DISABLED_WARNINGS "${DISABLED_WARNINGS} /wd\"4244\"") # ignore conversion to smaller type (fires more aggressively than the gcc version, which is annoying)
|
||||
SET(DISABLED_WARNINGS "${DISABLED_WARNINGS} /wd\"4305\"") # ignore truncation on initialization
|
||||
SET(CMAKE_CXX_FLAGS "${BASE_CXX_FLAGS} ${DISABLED_WARNINGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
|
||||
|
||||
add_definitions(/D "_CRT_SECURE_NO_WARNINGS")
|
||||
add_definitions(-DNOMINMAX)
|
||||
add_definitions(-D_USE_MATH_DEFINES)
|
||||
else()
|
||||
# unrecognized
|
||||
message( FATAL_ERROR "Unrecognized compiler [${CMAKE_CXX_COMPILER_ID}]" )
|
||||
endif()
|
||||
|
||||
|
||||
# == Deps
|
||||
add_subdirectory(deps/geometry-central)
|
||||
add_subdirectory(deps/polyscope)
|
||||
|
||||
# == Build our project stuff
|
||||
|
||||
|
||||
add_executable(displayOBJ displayOBJ)
|
||||
target_link_libraries(displayOBJ polyscope geometry-central)
|
||||
|
1
5-GeomProcessing/deps/geometry-central
Submodule
1
5-GeomProcessing/deps/geometry-central
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 8b20898f6c7be1eab827a9f720c8fd45e58ae63c
|
1
5-GeomProcessing/deps/polyscope
Submodule
1
5-GeomProcessing/deps/polyscope
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e477e6b35ec9f4f27e01a5916acc310520aa1262
|
34
5-GeomProcessing/displayOBJ.cpp
Normal file
34
5-GeomProcessing/displayOBJ.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "geometrycentral/surface/manifold_surface_mesh.h"
|
||||
#include "geometrycentral/surface/meshio.h"
|
||||
#include "geometrycentral/surface/vertex_position_geometry.h"
|
||||
|
||||
#include "polyscope/polyscope.h"
|
||||
#include "polyscope/surface_mesh.h"
|
||||
#include "polyscope/point_cloud.h"
|
||||
|
||||
using namespace geometrycentral;
|
||||
using namespace geometrycentral::surface;
|
||||
|
||||
// == Geometry-central data
|
||||
std::unique_ptr<ManifoldSurfaceMesh> mesh;
|
||||
std::unique_ptr<VertexPositionGeometry> geometry;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
// Initialize polyscope
|
||||
polyscope::init();
|
||||
|
||||
// Load mesh
|
||||
std::tie(mesh, geometry) = readManifoldSurfaceMesh(argv[1]);
|
||||
|
||||
// Register the mesh with polyscope
|
||||
polyscope::registerSurfaceMesh("Input obj",
|
||||
geometry->inputVertexPositions,
|
||||
mesh->getFaceVertexList(),
|
||||
polyscopePermutations(*mesh));
|
||||
|
||||
// Give control to the polyscope gui
|
||||
polyscope::show();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
31
5-GeomProcessing/python/testPyGEL.py
Normal file
31
5-GeomProcessing/python/testPyGEL.py
Normal file
@ -0,0 +1,31 @@
|
||||
import polyscope
|
||||
import numpy as np
|
||||
from pygel3d import hmesh
|
||||
|
||||
m = hmesh.load("../cube.obj")
|
||||
print(m.positions())
|
||||
|
||||
faces = m.faces()
|
||||
|
||||
## Old school
|
||||
allfaces=[]
|
||||
for f in faces:
|
||||
face=[]
|
||||
for v in m.circulate_face(f):
|
||||
face.append(v)
|
||||
allfaces = allfaces + [face]
|
||||
|
||||
## Fancy version
|
||||
allfaces2 = [[v for v in m.circulate_face(f)] for f in faces]
|
||||
|
||||
polyscope.init()
|
||||
|
||||
#Display the vertices as point cloud
|
||||
polyscope.register_point_cloud("data", m.positions())
|
||||
|
||||
#Display the vertices as mesh
|
||||
polyscope.register_surface_mesh("data mesh", m.positions(), allfaces)
|
||||
#Display the vertices as mesh
|
||||
polyscope.register_surface_mesh("data mesh2", m.positions(), allfaces2)
|
||||
|
||||
polyscope.show()
|
Loading…
x
Reference in New Issue
Block a user