Merge branch 'master' into obj_load_fix
This commit is contained in:
+11
-5
@@ -1,22 +1,28 @@
|
||||
version: 1.0.{build}
|
||||
os: Visual Studio 2015
|
||||
os: Visual Studio 2017
|
||||
test: off
|
||||
clone_folder: C:\projects\libigl
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- alecjacobson
|
||||
- cmake
|
||||
- cgal
|
||||
install:
|
||||
- git submodule update --init --recursive
|
||||
- cinstall: python
|
||||
build_script:
|
||||
- echo Running cmake...
|
||||
- cd c:\projects\libigl\tutorial
|
||||
- cd c:\projects\libigl
|
||||
- cd external
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -D "LIBIGL_USE_STATIC_LIBRARY=ON" -G "Visual Studio 14 2015 Win64" ../
|
||||
# - cmake -G "Visual Studio 14 2015 Win64" ../
|
||||
- cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" ..
|
||||
- msbuild %MSBuildOptions% libigl_external.sln
|
||||
- cd ../../tutorial
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -D "LIBIGL_USE_STATIC_LIBRARY=ON" -D "LIBIGL_WITH_ANTTWEAKBAR=OFF" -D "BOOST_ROOT=../external/boost/" -G "Visual Studio 15 2017 Win64" ../
|
||||
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
# - set MSBuildOptions=/v:m /p:Configuration=Release /logger:%MSBuildLogger%
|
||||
- set MSBuildOptions=/v:m /p:Configuration=Debug /logger:%MSBuildLogger%
|
||||
- msbuild %MSBuildOptions% libigl_tutorials.sln
|
||||
|
||||
@@ -98,3 +98,5 @@ python/builddebug
|
||||
tutorial/.idea
|
||||
python/buildstatic
|
||||
tutorial/cmake-build-debug
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
+12
-5
@@ -1,8 +1,3 @@
|
||||
[submodule "external/nanogui"]
|
||||
path = external/nanogui
|
||||
url=https://github.com/libigl/nanogui.git
|
||||
fetchRecursiveSubmodules = true
|
||||
ignore = dirty
|
||||
[submodule "external/embree"]
|
||||
path = external/embree
|
||||
url = https://github.com/embree/embree.git
|
||||
@@ -24,3 +19,15 @@ url=https://github.com/libigl/nanogui.git
|
||||
[submodule "external/cork"]
|
||||
path = external/cork
|
||||
url = https://github.com/libigl/cork.git
|
||||
[submodule "external/imgui"]
|
||||
path = external/imgui/imgui
|
||||
url = https://github.com/ocornut/imgui.git
|
||||
[submodule "external/glfw"]
|
||||
path = external/glfw
|
||||
url = https://github.com/glfw/glfw.git
|
||||
[submodule "external/eigen"]
|
||||
path = external/eigen
|
||||
url = https://github.com/eigenteam/eigen-git-mirror.git
|
||||
[submodule "external/pybind11"]
|
||||
path = external/pybind11
|
||||
url = https://github.com/pybind/pybind11
|
||||
|
||||
+5
-4
@@ -1,25 +1,26 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
dist: precise
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
compiler: gcc-4.8.1
|
||||
script:
|
||||
- git submodule update --init --recursive
|
||||
- mkdir external/nanogui/ext/glfw/include/GL
|
||||
- wget --no-check-certificate -P external/nanogui/ext/glfw/include/GL http://www.opengl.org/registry/api/GL/glcorearb.h
|
||||
- mkdir external/glfw/include/GL
|
||||
- wget --no-check-certificate -P external/glfw/include/GL http://www.opengl.org/registry/api/GL/glcorearb.h
|
||||
- cd python
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON ../
|
||||
- make -j 2
|
||||
- cd ../tutorial
|
||||
- python 101_FileIO.py || { cd ../; mkdir build2; cd build2; cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON - DCHECK_UNDEFINED=ON; make -j 2; }
|
||||
- python3 101_FileIO.py || { cd ../; mkdir build2; cd build2; cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF -DLIBIGL_USE_STATIC_LIBRARY=ON - DCHECK_UNDEFINED=ON ../; make -j 2; }
|
||||
- cd ../../
|
||||
- cd tutorial
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 ../
|
||||
- cmake -DLIBIGL_USE_STATIC_LIBRARY=ON -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_C_COMPILER=gcc-4.8 -DLIBIGL_WITH_EMBREE=OFF ../
|
||||
- make -j 2
|
||||
addons:
|
||||
apt:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Before opening an issue on creating a pull request, please check the following:
|
||||
|
||||
## Compilation Issues
|
||||
|
||||
- If you are on Windows, did you select the **x64** version of the Visual Studio compiler?
|
||||
|
||||
- If you have a **CMake issue**, make sure you follow the same approach as the [libigl-example-project](https://github.com/libigl/libigl-example-project) to build libigl with your project, and make sure that you can compile the example project.
|
||||
|
||||
- If you have an issue with a **submodule**, check if your submodules are up to date. If you have a doubt about a submodule, delete its folder and run `git submodule update --init --recursive` in the libigl directory.
|
||||
|
||||
- If you have an issue with a missing **template issue**, check if your code compile with the *header-only* option of libigl activated. Turn **`OFF`** the CMake option `LIBIGL_USE_STATIC_LIBRARY`: either modify your `CMakeCache.txt` via CMake GUI or ccmake, or delete your `CMakeCache.txt` and re-run `cmake -DLIBIGL_USE_STATIC_LIBRARY=OFF ..` in your build folder.
|
||||
|
||||
- Make sure your read the [**FAQ**](https://github.com/libigl/libigl/wiki/FAQ) before asking a new question, and search [**existing issues**](https://github.com/libigl/libigl/issues?q=is%3Aissue+is%3Aclosed) for a problem similar to yours.
|
||||
|
||||
- Make sure you read the informations contained in the libigl [homepage](https://github.com/libigl/libigl) as well as the [tutorials](http://libigl.github.io/libigl/tutorial/tutorial.html).
|
||||
|
||||
- If none of these solve your problem, then please report your issue in the bug tracker!
|
||||
@@ -1,7 +0,0 @@
|
||||
Libigl is primarily licensed under MPL2
|
||||
- http://www.mozilla.org/MPL/2.0/
|
||||
- http://www.mozilla.org/MPL/2.0/FAQ.html
|
||||
|
||||
Some files contain third-party code under other licenses:
|
||||
|
||||
- tga.h/tga.cpp GNU GPL
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
Libigl is primarily licensed under MPL2
|
||||
- http://www.mozilla.org/MPL/2.0/
|
||||
- http://www.mozilla.org/MPL/2.0/FAQ.html
|
||||
|
||||
All `.h` and `.cpp` _files_ directly in `include/igl` (but not necessarily in
|
||||
sub-directories) are subject only to the terms of the MPL2; they should not
|
||||
include any code that is covered by other/less-permissive licenses.
|
||||
|
||||
The `.h` and `.cpp` _files_ in sub-directories of `include/igl` allow libigl to
|
||||
integrate with external third-party libraries (e.g., those in `external/`) and
|
||||
are subject to the MPL2, _**and**_ also the terms of licenses of the
|
||||
corresponding external library. The licenses used by these libraries fall under
|
||||
three categories:
|
||||
|
||||
- common "free, non-copyleft licenses" (such as zlib, BSD, MIT, and public
|
||||
domain)
|
||||
- `include/igl/anttweakbar`
|
||||
- `include/igl/embree`
|
||||
- `include/igl/opengl`
|
||||
- `include/igl/opengl/glfw`
|
||||
- `include/igl/opengl2`
|
||||
- `include/igl/png`
|
||||
- `include/igl/viewer`
|
||||
- `include/igl/xml`
|
||||
- common "copyleft" licences (such as GPL, LGPL, and AGPL)
|
||||
- `include/igl/copyleft`
|
||||
- `include/igl/copyleft/cgal`
|
||||
- `include/igl/copyleft/comiso`
|
||||
- `include/igl/copyleft/cork`
|
||||
- `include/igl/copyleft/tetgen`
|
||||
- other "uncommon" licenses or commercial software
|
||||
- `include/igl/lim`
|
||||
- `include/igl/matlab`
|
||||
- `include/igl/mosek`
|
||||
- `include/igl/triangle`
|
||||
|
||||
The Libigl code that interfaces with "copyleft" libraries is in
|
||||
`include/igl/copyleft`. Only include these headers if you are accept the
|
||||
licensing terms of the corresponding external library. For example, using
|
||||
`include/igl/copyleft/tetgen` requires that you accept the terms of the AGPLv3.
|
||||
@@ -193,7 +193,7 @@ BibTeX entry:
|
||||
title = {{libigl}: A simple {C++} geometry processing library},
|
||||
author = {Alec Jacobson and Daniele Panozzo and others},
|
||||
note = {http://libigl.github.io/libigl/},
|
||||
year = {2016},
|
||||
year = {2017},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -262,8 +262,6 @@ If you find bugs or have problems please use our [github issue tracking
|
||||
page](https://github.com/libigl/libigl/issues).
|
||||
|
||||
## Copyright
|
||||
2017 Alec Jacobson, Daniele Panozzo, Christian Schüller, Olga Diamanti, Qingnan
|
||||
Zhou, Sebastian Koch, Amir Vaxman, Nico Pietroni, Stefan Brugger, Kenshi Takayama, Wenzel Jakob, Nikolas De
|
||||
Giorgis, Luigi Rocca, Leonardo Sacht, Kevin Walliman, Olga Sorkine-Hornung, and others.
|
||||
2017 Alec Jacobson, Daniele Panozzo, Christian Schüller, Olga Diamanti, Qingnan Zhou, Sebastian Koch, Jeremie Dumas, Amir Vaxman, Nico Pietroni, Stefan Brugger, Kenshi Takayama, Wenzel Jakob, Nikolas De Giorgis, Luigi Rocca, Leonardo Sacht, Kevin Walliman, Olga Sorkine-Hornung, and others.
|
||||
|
||||
Please see individual files for appropriate copyright notices.
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ Version | Short description
|
||||
0.3.1 | Linearly dependent constraints in min_quad_with_fixed, SparseQR buggy
|
||||
0.3.0 | Better active set method support
|
||||
0.2.3 | More explicits, active set method, opengl/anttweakbar guards
|
||||
0.2.2 | More explicit instanciations, faster sorts and uniques
|
||||
0.2.2 | More explicit instantiations, faster sorts and uniques
|
||||
0.2.1 | Bug fixes in barycenter and doublearea found by Martin Bisson
|
||||
0.2.0 | XML serializer more stable and fixed bug in remove_duplicate_vertices
|
||||
0.1.8 | Embree and xml (windows only) extras
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>libigl</title>
|
||||
<meta name="author" content="Alec Jacobson and Daniele Panozzo and others"/>
|
||||
<link type="text/css" rel="stylesheet" href="../tutorial/style.css"/>
|
||||
<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
|
||||
<link rel='stylesheet' href='http://yandex.st/highlightjs/7.3/styles/default.min.css'>
|
||||
<script src='http://yandex.st/highlightjs/7.3/highlight.min.js'></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
<script type='text/javascript' src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> <link rel='stylesheet' href='http://yandex.st/highlightjs/7.3/styles/default.min.css'> <script src='http://yandex.st/highlightjs/7.3/highlight.min.js'></script> <script>hljs.initHighlightingOnLoad();</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -60,3 +57,4 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
add_library(AntTweakBar STATIC
|
||||
# C source files
|
||||
src/TwEventGLFW.c
|
||||
src/TwEventGLUT.c
|
||||
src/TwEventSDL.c
|
||||
src/TwEventSDL12.c
|
||||
src/TwEventSDL13.c
|
||||
|
||||
# C++ source files
|
||||
src/LoadOGL.cpp
|
||||
src/LoadOGLCore.cpp
|
||||
src/TwBar.cpp
|
||||
src/TwColors.cpp
|
||||
src/TwEventSFML.cpp
|
||||
src/TwFonts.cpp
|
||||
src/TwMgr.cpp
|
||||
src/TwOpenGL.cpp
|
||||
src/TwOpenGLCore.cpp
|
||||
src/TwPrecomp.cpp
|
||||
)
|
||||
|
||||
# These are probably needed for windows/Linux, should append if windows/Linux
|
||||
# src/TwEventWin.c
|
||||
# src/TwEventX11.c
|
||||
# src/TwDirect3D10.cpp
|
||||
# src/TwDirect3D11.cpp
|
||||
# src/TwDirect3D9.cpp
|
||||
|
||||
target_include_directories(AntTweakBar PUBLIC include)
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(
|
||||
AntTweakBar
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS
|
||||
"-fPIC -fno-strict-aliasing -x objective-c++")
|
||||
target_compile_definitions(
|
||||
AntTweakBar PUBLIC _MACOSX __PLACEMENT_NEW_INLINE)
|
||||
endif()
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
// GLFW: http://www.glfw.org
|
||||
//
|
||||
//
|
||||
// This example draws a simple scene that can be re-tesselated
|
||||
// This example draws a simple scene that can be re-tessellated
|
||||
// interactively, and illuminated dynamically by an adjustable
|
||||
// number of moving lights.
|
||||
//
|
||||
@@ -175,7 +175,7 @@ void Scene::Init(bool changeLights)
|
||||
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
|
||||
|
||||
// Create objects display list using the current Subdiv parameter to control the tesselation
|
||||
// Create objects display list using the current Subdiv parameter to control the tessellation
|
||||
if( objList>0 )
|
||||
glDeleteLists(objList, 1); // delete previously created display list
|
||||
objList = glGenLists(1);
|
||||
|
||||
Vendored
+1
-1
@@ -1623,7 +1623,7 @@ void CQuaternionExt::MouseLeaveCB(void *structExtValue, void *clientData, TwBar
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Convertion between VC++ Debug/Release std::string
|
||||
// Conversion between VC++ Debug/Release std::string
|
||||
// (Needed because VC++ adds some extra info to std::string in Debug mode!)
|
||||
// And resolve binary std::string incompatibility between VS2010 and other VS versions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Vendored
+2
-2
@@ -246,7 +246,7 @@ struct CTwMgr
|
||||
static void ANT_CALL GetCB(void *_Value, void *_ClientData);
|
||||
};
|
||||
std::list<CCDStdString> m_CDStdStrings;
|
||||
struct CClientStdString // Convertion between VC++ Debug/Release std::string
|
||||
struct CClientStdString // Conversion between VC++ Debug/Release std::string
|
||||
{
|
||||
CClientStdString();
|
||||
void FromLib(const char *libStr);
|
||||
@@ -255,7 +255,7 @@ struct CTwMgr
|
||||
char m_Data[sizeof(std::string)+2*sizeof(void *)];
|
||||
std::string m_LibStr;
|
||||
};
|
||||
struct CLibStdString // Convertion between VC++ Debug/Release std::string
|
||||
struct CLibStdString // Conversion between VC++ Debug/Release std::string
|
||||
{
|
||||
CLibStdString();
|
||||
void FromClient(const std::string& clientStr);
|
||||
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(libigl_external)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if(WIN32)
|
||||
# Note: It IS important to download different files on different OS's:
|
||||
# on Unix-like systems, we need the file persmissions (only available in the .tar.gz),
|
||||
# while on Windows, we need CR/LF line feeds (only available in the .zip)
|
||||
|
||||
# Boost 1.65 is problematic because of https://github.com/boostorg/build/issues/230
|
||||
# Boost 1.66 is problematic because of https://github.com/boostorg/build/issues/273
|
||||
if(UNIX)
|
||||
set(BOOST_URL "https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz")
|
||||
set(BOOST_HASH SHA256=a13de2c8fbad635e6ba9c8f8714a0e6b4264b60a29b964b940a22554705b6b60)
|
||||
set(BOOST_BOOTSTRAP_COMMAND ./bootstrap.sh)
|
||||
set(BOOST_B2_COMMAND ./b2)
|
||||
elseif(WIN32)
|
||||
set(BOOST_URL "https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.zip")
|
||||
set(BOOST_HASH SHA256=d1775aef807bd6a14077b450cce2950d8eacd86aaf51015f79e712917f8cc3c2)
|
||||
set(BOOST_BOOTSTRAP_COMMAND cmd /C bootstrap.bat msvc)
|
||||
set(BOOST_B2_COMMAND b2.exe)
|
||||
endif()
|
||||
|
||||
# We only support x64 builds
|
||||
set(BOOST_ADDRESS_MODEL 64)
|
||||
|
||||
if(MSVC_VERSION EQUAL 1500) #VS2008
|
||||
set(BOOST_TOOLSET "--toolset=msvc-9.0")
|
||||
elseif(MSVC_VERSION EQUAL 1600) #VS2010
|
||||
set(BOOST_TOOLSET "--toolset=msvc-10.0")
|
||||
elseif(MSVC_VERSION EQUAL 1700) #VS2012
|
||||
set(BOOST_TOOLSET "--toolset=msvc-11.0")
|
||||
elseif(MSVC_VERSION EQUAL 1800) #VS2013
|
||||
set(BOOST_TOOLSET "--toolset=msvc-12.0")
|
||||
elseif(MSVC_VERSION EQUAL 1900) #VS2015
|
||||
set(BOOST_TOOLSET "--toolset=msvc-14.0")
|
||||
elseif(NOT (MSVC_VERSION LESS 1910)) #VS2017
|
||||
set(BOOST_TOOLSET "--toolset=msvc-14.1")
|
||||
endif()
|
||||
|
||||
# Boost
|
||||
set(BOOST_DIR "${CMAKE_CURRENT_LIST_DIR}/boost")
|
||||
ExternalProject_Add(Boost_Project
|
||||
BUILD_IN_SOURCE 1
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
PREFIX "${BOOST_DIR}"
|
||||
BUILD_IN_SOURCE 1
|
||||
|
||||
URL ${BOOST_URL}
|
||||
URL_HASH ${BOOST_HASH}
|
||||
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_LIST_DIR}/os.jam" "tools/build/src/util/os.jam"
|
||||
CONFIGURE_COMMAND ${BOOST_BOOTSTRAP_COMMAND} --prefix=${BOOST_DIR}/lib
|
||||
BUILD_COMMAND ${BOOST_B2_COMMAND} install -j8 -d0 --prefix=${BOOST_DIR} --with-filesystem --with-system --with-thread --with-serialization --with-date_time address-model=${BOOST_ADDRESS_MODEL} link=static runtime-link=shared ${BOOST_TOOLSET}
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
set(CGAL_DEPENDS Boost_Project)
|
||||
endif()
|
||||
|
||||
# CGAL
|
||||
set(CGAL_DIR "${CMAKE_CURRENT_LIST_DIR}/cgal")
|
||||
ExternalProject_Add(CGAL_Project
|
||||
DEPENDS ${CGAL_DEPENDS}
|
||||
|
||||
PREFIX "${CGAL_DIR}"
|
||||
|
||||
URL "https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.11/CGAL-4.11.zip"
|
||||
URL_MD5 320d70f7fd2a98537d20e21eeaea5a25
|
||||
|
||||
UPDATE_COMMAND ""
|
||||
PATCH_COMMAND ""
|
||||
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_PREFIX_PATH=${CGAL_DIR}/auxiliary/gmp
|
||||
"-DBOOST_ROOT=${BOOST_DIR}"
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
"-DCMAKE_INSTALL_PREFIX=${CGAL_DIR}/"
|
||||
-DCMAKE_INSTALL_LIBDIR=lib
|
||||
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add_Step(
|
||||
CGAL_Project download_auxiliary
|
||||
COMMAND ${CMAKE_COMMAND} -DCGAL_DIR=${CGAL_DIR} -P ${CMAKE_CURRENT_LIST_DIR}/download.cmake
|
||||
DEPENDEES download
|
||||
DEPENDERS configure
|
||||
)
|
||||
Vendored
+1
-1
Submodule external/CoMISo updated: 29ff55f464...fea3ee0ba7
Vendored
+14
@@ -2,6 +2,7 @@ This directory contains external libraries which are either difficult to
|
||||
obtain, difficult to compile or patched for libigl.
|
||||
|
||||
## AntTweakBar
|
||||
|
||||
Patched to support copying and pasting from text fields (see
|
||||
http://www.alecjacobson.com/weblog/?p=2378)
|
||||
|
||||
@@ -20,6 +21,7 @@ then
|
||||
make
|
||||
|
||||
## TinyXML2
|
||||
|
||||
double precision bug fixes:
|
||||
|
||||
tinyxml2.h line 1286 add function:
|
||||
@@ -33,3 +35,15 @@ tinyxml2.cpp line 434 replace with:
|
||||
|
||||
TIXML_SNPRINTF( buffer, bufferSize, "%.15e", v );
|
||||
|
||||
## CGAL
|
||||
|
||||
CGAL can be built as a CMake external project thanks to the `CMakeLists.txt` provided in this folder. While this is mainly intended as a convenience for Windows users, and CI builds on AppVeyor, this should work on Linux/macOS as well. To build CGAL and Boost with the provided CMake script, build this folder as you would compile any CMake project (use CMake GUI and MSVC on Windows):
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make -j4
|
||||
```
|
||||
|
||||
Once this is done, just build the libigl tutorials, and it should properly detect CGAL and Boost.
|
||||
|
||||
Vendored
+1
-1
Submodule external/cork updated: adf814edd5...27ad8a2858
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
if(WIN32)
|
||||
set(GMP_URL https://cgal.geometryfactory.com/CGAL/precompiled_libs/auxiliary/x64/GMP/5.0.1/)
|
||||
set(GMP_NAME gmp-all-CGAL-3.9.zip)
|
||||
set(GMP_DIR "${CGAL_DIR}/auxiliary/gmp")
|
||||
set(MPFR_URL https://cgal.geometryfactory.com/CGAL/precompiled_libs/auxiliary/x64/MPFR/3.0.0/)
|
||||
set(MPFR_NAME mpfr-all-CGAL-3.9.zip)
|
||||
set(MPFR_DIR "${CGAL_DIR}/auxiliary/gmp")
|
||||
|
||||
file(DOWNLOAD "${GMP_URL}/${GMP_NAME}" ${GMP_DIR}/${GMP_NAME})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz ${GMP_DIR}/${GMP_NAME} WORKING_DIRECTORY ${GMP_DIR})
|
||||
|
||||
file(DOWNLOAD "${MPFR_URL}/${MPFR_NAME}" ${MPFR_DIR}/${MPFR_NAME})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xfz ${MPFR_DIR}/${MPFR_NAME} WORKING_DIRECTORY ${MPFR_DIR})
|
||||
endif()
|
||||
+1
Submodule external/eigen added at c50d586b9a
Vendored
+1
-1
Submodule external/embree updated: f8b4b464d6...36fd411e45
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(glad)
|
||||
|
||||
add_library(glad src/glad.c)
|
||||
target_include_directories(glad PUBLIC include)
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(glad PUBLIC ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
glad
|
||||
====
|
||||
|
||||
The files in this folder were generated using [glad](https://github.com/Dav1dde/glad).
|
||||
|
||||
### Using a different version of OpenGL
|
||||
|
||||
The files in this folder correspond to the OpenGL 3.3 Core Profile. If you need to use libigl with a different version of OpenGL, you can use this [webservice](http://glad.dav1d.de/) to generate the loader for your desired version of OpenGL. Then, in your CMake build system, simply define the target `glad` to point to your own version of glad before including libigl.
|
||||
+284
@@ -0,0 +1,284 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
Vendored
+2182
File diff suppressed because it is too large
Load Diff
Vendored
+1011
File diff suppressed because it is too large
Load Diff
+1
Submodule external/glfw added at 58cc4b2c5c
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
add_library(imgui
|
||||
imgui/imgui.cpp
|
||||
imgui/imgui_demo.cpp
|
||||
imgui/imgui_draw.cpp
|
||||
imgui_impl_glfw_gl3.cpp
|
||||
)
|
||||
|
||||
target_include_directories(imgui PRIVATE imgui)
|
||||
target_include_directories(imgui SYSTEM INTERFACE .)
|
||||
|
||||
target_link_libraries(imgui PRIVATE glad glfw)
|
||||
+1
Submodule external/imgui/imgui added at 7cc1bc7635
+2808
File diff suppressed because it is too large
Load Diff
+449
@@ -0,0 +1,449 @@
|
||||
// ImGui GLFW binding with OpenGL3 + shaders
|
||||
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||
// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Cast 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Gamepad navigation mapping. Enable with 'io.NavFlags |= ImGuiNavFlags_EnableGamepad'.
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#include <imgui.h>
|
||||
#include "imgui_impl_glfw_gl3.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef APIENTRY
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#define GLFW_EXPOSE_NATIVE_WGL
|
||||
#include <GLFW/glfw3native.h>
|
||||
#endif
|
||||
|
||||
// Data
|
||||
static GLFWwindow* g_Window = NULL;
|
||||
static double g_Time = 0.0f;
|
||||
static bool g_MouseJustPressed[3] = { false, false, false };
|
||||
static GLuint g_FontTexture = 0;
|
||||
static int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||
static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
||||
static int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0;
|
||||
static unsigned int g_VboHandle = 0, g_VaoHandle = 0, g_ElementsHandle = 0;
|
||||
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
||||
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so.
|
||||
// If text or lines are blurry when integrating ImGui in your engine: in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||
void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data)
|
||||
{
|
||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x);
|
||||
int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y);
|
||||
if (fb_width == 0 || fb_height == 0)
|
||||
return;
|
||||
draw_data->ScaleClipRects(io.DisplayFramebufferScale);
|
||||
|
||||
// Backup GL state
|
||||
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
|
||||
GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||
GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer);
|
||||
GLint last_vertex_array; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||
GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
|
||||
GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb);
|
||||
GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha);
|
||||
GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha);
|
||||
GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb);
|
||||
GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha);
|
||||
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
||||
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||
GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
||||
|
||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||
const float ortho_projection[4][4] =
|
||||
{
|
||||
{ 2.0f/io.DisplaySize.x, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 2.0f/-io.DisplaySize.y, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, -1.0f, 0.0f },
|
||||
{-1.0f, 1.0f, 0.0f, 1.0f },
|
||||
};
|
||||
glUseProgram(g_ShaderHandle);
|
||||
glUniform1i(g_AttribLocationTex, 0);
|
||||
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||
glBindVertexArray(g_VaoHandle);
|
||||
glBindSampler(0, 0); // Rely on combined texture/sampler state.
|
||||
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
const ImDrawIdx* idx_buffer_offset = 0;
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
||||
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
||||
glScissor((int)pcmd->ClipRect.x, (int)(fb_height - pcmd->ClipRect.w), (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y));
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
||||
}
|
||||
idx_buffer_offset += pcmd->ElemCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore modified GL state
|
||||
glUseProgram(last_program);
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindSampler(0, last_sampler);
|
||||
glActiveTexture(last_active_texture);
|
||||
glBindVertexArray(last_vertex_array);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
|
||||
glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
|
||||
glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha);
|
||||
if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
|
||||
if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
||||
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
||||
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, last_polygon_mode[0]);
|
||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||
}
|
||||
|
||||
static const char* ImGui_ImplGlfwGL3_GetClipboardText(void* user_data)
|
||||
{
|
||||
return glfwGetClipboardString((GLFWwindow*)user_data);
|
||||
}
|
||||
|
||||
static void ImGui_ImplGlfwGL3_SetClipboardText(void* user_data, const char* text)
|
||||
{
|
||||
glfwSetClipboardString((GLFWwindow*)user_data, text);
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
|
||||
{
|
||||
if (action == GLFW_PRESS && button >= 0 && button < 3)
|
||||
g_MouseJustPressed[button] = true;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow*, double xoffset, double yoffset)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.MouseWheelH += (float)xoffset;
|
||||
io.MouseWheel += (float)yoffset;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow*, int key, int, int action, int mods)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (action == GLFW_PRESS)
|
||||
io.KeysDown[key] = true;
|
||||
if (action == GLFW_RELEASE)
|
||||
io.KeysDown[key] = false;
|
||||
|
||||
(void)mods; // Modifiers are not reliable across systems
|
||||
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
|
||||
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
|
||||
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
|
||||
io.KeySuper = io.KeysDown[GLFW_KEY_LEFT_SUPER] || io.KeysDown[GLFW_KEY_RIGHT_SUPER];
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow*, unsigned int c)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (c > 0 && c < 0x10000)
|
||||
io.AddInputCharacter((unsigned short)c);
|
||||
}
|
||||
|
||||
bool ImGui_ImplGlfwGL3_CreateFontsTexture()
|
||||
{
|
||||
// Build texture atlas
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||
|
||||
// Upload texture to graphics system
|
||||
GLint last_texture;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
glGenTextures(1, &g_FontTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_ImplGlfwGL3_CreateDeviceObjects()
|
||||
{
|
||||
// Backup GL state
|
||||
GLint last_texture, last_array_buffer, last_vertex_array;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||
|
||||
const GLchar *vertex_shader =
|
||||
"#version 150\n"
|
||||
"uniform mat4 ProjMtx;\n"
|
||||
"in vec2 Position;\n"
|
||||
"in vec2 UV;\n"
|
||||
"in vec4 Color;\n"
|
||||
"out vec2 Frag_UV;\n"
|
||||
"out vec4 Frag_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Frag_UV = UV;\n"
|
||||
" Frag_Color = Color;\n"
|
||||
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar* fragment_shader =
|
||||
"#version 150\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"in vec2 Frag_UV;\n"
|
||||
"in vec4 Frag_Color;\n"
|
||||
"out vec4 Out_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n"
|
||||
"}\n";
|
||||
|
||||
g_ShaderHandle = glCreateProgram();
|
||||
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
||||
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(g_VertHandle, 1, &vertex_shader, 0);
|
||||
glShaderSource(g_FragHandle, 1, &fragment_shader, 0);
|
||||
glCompileShader(g_VertHandle);
|
||||
glCompileShader(g_FragHandle);
|
||||
glAttachShader(g_ShaderHandle, g_VertHandle);
|
||||
glAttachShader(g_ShaderHandle, g_FragHandle);
|
||||
glLinkProgram(g_ShaderHandle);
|
||||
|
||||
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
||||
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
||||
g_AttribLocationPosition = glGetAttribLocation(g_ShaderHandle, "Position");
|
||||
g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV");
|
||||
g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color");
|
||||
|
||||
glGenBuffers(1, &g_VboHandle);
|
||||
glGenBuffers(1, &g_ElementsHandle);
|
||||
|
||||
glGenVertexArrays(1, &g_VaoHandle);
|
||||
glBindVertexArray(g_VaoHandle);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||
glEnableVertexAttribArray(g_AttribLocationPosition);
|
||||
glEnableVertexAttribArray(g_AttribLocationUV);
|
||||
glEnableVertexAttribArray(g_AttribLocationColor);
|
||||
|
||||
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
||||
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
||||
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
||||
|
||||
ImGui_ImplGlfwGL3_CreateFontsTexture();
|
||||
|
||||
// Restore modified GL state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||
glBindVertexArray(last_vertex_array);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_InvalidateDeviceObjects()
|
||||
{
|
||||
if (g_VaoHandle) glDeleteVertexArrays(1, &g_VaoHandle);
|
||||
if (g_VboHandle) glDeleteBuffers(1, &g_VboHandle);
|
||||
if (g_ElementsHandle) glDeleteBuffers(1, &g_ElementsHandle);
|
||||
g_VaoHandle = g_VboHandle = g_ElementsHandle = 0;
|
||||
|
||||
if (g_ShaderHandle && g_VertHandle) glDetachShader(g_ShaderHandle, g_VertHandle);
|
||||
if (g_VertHandle) glDeleteShader(g_VertHandle);
|
||||
g_VertHandle = 0;
|
||||
|
||||
if (g_ShaderHandle && g_FragHandle) glDetachShader(g_ShaderHandle, g_FragHandle);
|
||||
if (g_FragHandle) glDeleteShader(g_FragHandle);
|
||||
g_FragHandle = 0;
|
||||
|
||||
if (g_ShaderHandle) glDeleteProgram(g_ShaderHandle);
|
||||
g_ShaderHandle = 0;
|
||||
|
||||
if (g_FontTexture)
|
||||
{
|
||||
glDeleteTextures(1, &g_FontTexture);
|
||||
ImGui::GetIO().Fonts->TexID = 0;
|
||||
g_FontTexture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
g_Window = window;
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
|
||||
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
|
||||
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
|
||||
io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
|
||||
io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN;
|
||||
io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP;
|
||||
io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN;
|
||||
io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME;
|
||||
io.KeyMap[ImGuiKey_End] = GLFW_KEY_END;
|
||||
io.KeyMap[ImGuiKey_Insert] = GLFW_KEY_INSERT;
|
||||
io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE;
|
||||
io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE;
|
||||
io.KeyMap[ImGuiKey_Space] = GLFW_KEY_SPACE;
|
||||
io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER;
|
||||
io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE;
|
||||
io.KeyMap[ImGuiKey_A] = GLFW_KEY_A;
|
||||
io.KeyMap[ImGuiKey_C] = GLFW_KEY_C;
|
||||
io.KeyMap[ImGuiKey_V] = GLFW_KEY_V;
|
||||
io.KeyMap[ImGuiKey_X] = GLFW_KEY_X;
|
||||
io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y;
|
||||
io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z;
|
||||
|
||||
io.RenderDrawListsFn = ImGui_ImplGlfwGL3_RenderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
|
||||
io.SetClipboardTextFn = ImGui_ImplGlfwGL3_SetClipboardText;
|
||||
io.GetClipboardTextFn = ImGui_ImplGlfwGL3_GetClipboardText;
|
||||
io.ClipboardUserData = g_Window;
|
||||
#ifdef _WIN32
|
||||
io.ImeWindowHandle = glfwGetWin32Window(g_Window);
|
||||
#endif
|
||||
|
||||
if (install_callbacks)
|
||||
{
|
||||
glfwSetMouseButtonCallback(window, ImGui_ImplGlfwGL3_MouseButtonCallback);
|
||||
glfwSetScrollCallback(window, ImGui_ImplGlfwGL3_ScrollCallback);
|
||||
glfwSetKeyCallback(window, ImGui_ImplGlfwGL3_KeyCallback);
|
||||
glfwSetCharCallback(window, ImGui_ImplGlfwGL3_CharCallback);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_Shutdown()
|
||||
{
|
||||
ImGui_ImplGlfwGL3_InvalidateDeviceObjects();
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfwGL3_NewFrame()
|
||||
{
|
||||
if (!g_FontTexture)
|
||||
ImGui_ImplGlfwGL3_CreateDeviceObjects();
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
// Setup display size (every frame to accommodate for window resizing)
|
||||
int w, h;
|
||||
int display_w, display_h;
|
||||
glfwGetWindowSize(g_Window, &w, &h);
|
||||
glfwGetFramebufferSize(g_Window, &display_w, &display_h);
|
||||
io.DisplaySize = ImVec2((float)w, (float)h);
|
||||
io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0);
|
||||
|
||||
// Setup time step
|
||||
double current_time = glfwGetTime();
|
||||
io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
|
||||
g_Time = current_time;
|
||||
|
||||
// Setup inputs
|
||||
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
|
||||
if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED))
|
||||
{
|
||||
if (io.WantMoveMouse)
|
||||
{
|
||||
glfwSetCursorPos(g_Window, (double)io.MousePos.x, (double)io.MousePos.y); // Set mouse position if requested by io.WantMoveMouse flag (used when io.NavMovesTrue is enabled by user and using directional navigation)
|
||||
}
|
||||
else
|
||||
{
|
||||
double mouse_x, mouse_y;
|
||||
glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
|
||||
io.MousePos = ImVec2((float)mouse_x, (float)mouse_y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
||||
io.MouseDown[i] = g_MouseJustPressed[i] || glfwGetMouseButton(g_Window, i) != 0;
|
||||
g_MouseJustPressed[i] = false;
|
||||
}
|
||||
|
||||
// Hide OS mouse cursor if ImGui is drawing it
|
||||
glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
|
||||
|
||||
// Gamepad navigation mapping [BETA]
|
||||
memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
||||
if (io.NavFlags & ImGuiNavFlags_EnableGamepad)
|
||||
{
|
||||
// Update gamepad inputs
|
||||
#define MAP_BUTTON(NAV_NO, BUTTON_NO) { if (buttons_count > BUTTON_NO && buttons[BUTTON_NO] == GLFW_PRESS) io.NavInputs[NAV_NO] = 1.0f; }
|
||||
#define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1) { float v = (axes_count > AXIS_NO) ? axes[AXIS_NO] : V0; v = (v - V0) / (V1 - V0); if (v > 1.0f) v = 1.0f; if (io.NavInputs[NAV_NO] < v) io.NavInputs[NAV_NO] = v; }
|
||||
int axes_count = 0, buttons_count = 0;
|
||||
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count);
|
||||
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count);
|
||||
MAP_BUTTON(ImGuiNavInput_Activate, 0); // Cross / A
|
||||
MAP_BUTTON(ImGuiNavInput_Cancel, 1); // Circle / B
|
||||
MAP_BUTTON(ImGuiNavInput_Menu, 2); // Square / X
|
||||
MAP_BUTTON(ImGuiNavInput_Input, 3); // Triangle / Y
|
||||
MAP_BUTTON(ImGuiNavInput_DpadLeft, 13); // D-Pad Left
|
||||
MAP_BUTTON(ImGuiNavInput_DpadRight, 11); // D-Pad Right
|
||||
MAP_BUTTON(ImGuiNavInput_DpadUp, 10); // D-Pad Up
|
||||
MAP_BUTTON(ImGuiNavInput_DpadDown, 12); // D-Pad Down
|
||||
MAP_BUTTON(ImGuiNavInput_FocusPrev, 4); // L1 / LB
|
||||
MAP_BUTTON(ImGuiNavInput_FocusNext, 5); // R1 / RB
|
||||
MAP_BUTTON(ImGuiNavInput_TweakSlow, 4); // L1 / LB
|
||||
MAP_BUTTON(ImGuiNavInput_TweakFast, 5); // R1 / RB
|
||||
MAP_ANALOG(ImGuiNavInput_LStickLeft, 0, -0.3f, -0.9f);
|
||||
MAP_ANALOG(ImGuiNavInput_LStickRight,0, +0.3f, +0.9f);
|
||||
MAP_ANALOG(ImGuiNavInput_LStickUp, 1, +0.3f, +0.9f);
|
||||
MAP_ANALOG(ImGuiNavInput_LStickDown, 1, -0.3f, -0.9f);
|
||||
#undef MAP_BUTTON
|
||||
#undef MAP_ANALOG
|
||||
}
|
||||
|
||||
// Start the frame. This call will update the io.WantCaptureMouse, io.WantCaptureKeyboard flag that you can use to dispatch inputs (or not) to your application.
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// ImGui GLFW binding with OpenGL3 + shaders
|
||||
// (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||
// (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] User texture binding. Cast 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
|
||||
// [X] Gamepad navigation mapping. Enable with 'io.NavFlags |= ImGuiNavFlags_EnableGamepad'.
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
|
||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
struct GLFWwindow;
|
||||
|
||||
IMGUI_API bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_Shutdown();
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_NewFrame();
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_InvalidateDeviceObjects();
|
||||
IMGUI_API bool ImGui_ImplGlfwGL3_CreateDeviceObjects();
|
||||
|
||||
// GLFW callbacks (installed by default if you enable 'install_callbacks' during initialization)
|
||||
// Provided here if you want to chain callbacks.
|
||||
// You can also handle inputs yourself and use those as a reference.
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
IMGUI_API void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow* window, unsigned int c);
|
||||
Vendored
+5
-1
@@ -24,5 +24,9 @@ add_library(lim STATIC
|
||||
UniformLaplacian_LIMSolver3D.cpp)
|
||||
|
||||
target_include_directories(lim PRIVATE
|
||||
"../nanogui/ext/eigen"
|
||||
"../eigen"
|
||||
"../../include")
|
||||
|
||||
if(TARGET igl::core)
|
||||
target_link_libraries(lim PUBLIC igl::core)
|
||||
endif()
|
||||
|
||||
Vendored
-1
Submodule external/nanogui deleted from 2c016fc9b7
Vendored
+201
@@ -0,0 +1,201 @@
|
||||
# Copyright 2001, 2002, 2003, 2005 Dave Abrahams
|
||||
# Copyright 2006 Rene Rivera
|
||||
# Copyright 2003, 2005 Vladimir Prus
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import modules ;
|
||||
import string ;
|
||||
|
||||
|
||||
# Return the value(s) of the given environment variable(s) at the time bjam was
|
||||
# invoked.
|
||||
rule environ ( variable-names + )
|
||||
{
|
||||
local result ;
|
||||
for local var-name in $(variable-names)
|
||||
{
|
||||
# We check the various cases of the var name for a value to account
|
||||
# for programs that change the casing of env vars. One such program
|
||||
# is Python that upper-cases env var names on import, and resports
|
||||
# them as upper-case instead of keeping the original case.
|
||||
local value = [ modules.peek .ENVIRON :
|
||||
$(var-name) $(var-name:U) $(var-name:L) ] ;
|
||||
result += $(value[1]) ;
|
||||
}
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
.name = [ modules.peek : OS ] ;
|
||||
.platform = [ modules.peek : OSPLAT ] ;
|
||||
.version = [ modules.peek : OSVER ] ;
|
||||
|
||||
|
||||
local rule constant ( c : os ? )
|
||||
{
|
||||
os ?= $(.name) ;
|
||||
# First look for a platform-specific name, then the general value.
|
||||
local variables = .$(c)-$(os) .$(c) ;
|
||||
local result = $($(variables)) ;
|
||||
return $(result[1]) ;
|
||||
}
|
||||
|
||||
rule get-constant ( os ? )
|
||||
{
|
||||
# Find the name of the constant being accessed, which is equal to the name
|
||||
# used to invoke us.
|
||||
local bt = [ BACKTRACE 1 ] ;
|
||||
local rulename = [ MATCH ([^.]*)$ : $(bt[4]) ] ;
|
||||
return [ constant $(rulename) : $(os) ] ;
|
||||
}
|
||||
|
||||
|
||||
# export all the common constants
|
||||
.constants = name platform version shared-library-path-variable path-separator executable-path-variable executable-suffix ;
|
||||
for local constant in $(.constants)
|
||||
{
|
||||
IMPORT $(__name__) : get-constant : $(__name__) : $(constant) ;
|
||||
}
|
||||
EXPORT $(__name__) : $(.constants) ;
|
||||
|
||||
.executable-path-variable-NT = PATH ;
|
||||
# On Windows the case and capitalization of PATH is not always predictable, so
|
||||
# let's find out what variable name was really set.
|
||||
if $(.name) = NT
|
||||
{
|
||||
for local n in [ VARNAMES .ENVIRON ]
|
||||
{
|
||||
if $(n:L) = path
|
||||
{
|
||||
.executable-path-variable-NT = $(n) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Specific constants for various platforms. There's no need to define any
|
||||
# constant whose value would be the same as the default, below.
|
||||
.shared-library-path-variable-NT = $(.executable-path-variable-NT) ;
|
||||
.path-separator-NT = ";" ;
|
||||
.expand-variable-prefix-NT = % ;
|
||||
.expand-variable-suffix-NT = % ;
|
||||
.executable-suffix-NT = .exe ;
|
||||
|
||||
.shared-library-path-variable-CYGWIN = PATH ;
|
||||
|
||||
.shared-library-path-variable-MACOSX = DYLD_LIBRARY_PATH ;
|
||||
|
||||
.shared-library-path-variable-AIX = LIBPATH ;
|
||||
|
||||
.shared-library-path-variable-HAIKU = LIBRARY_PATH ;
|
||||
|
||||
.shared-library-path-variable-VMS = PATH ;
|
||||
.path-separator-VMS = "," ;
|
||||
.expand-variable-prefix-VMS = '' ;
|
||||
.expand-variable-suffix-VMS = ' ;
|
||||
.executable-suffix-VMS = .exe ;
|
||||
|
||||
# Default constants
|
||||
.shared-library-path-variable = LD_LIBRARY_PATH ;
|
||||
.path-separator = ":" ;
|
||||
.expand-variable-prefix = $ ;
|
||||
.expand-variable-suffix = "" ;
|
||||
.executable-path-variable = PATH ;
|
||||
.executable-suffix = "" ;
|
||||
|
||||
|
||||
# Return a list of the directories in the PATH. Yes, that information is (sort
|
||||
# of) available in the global module, but jam code can change those values, and
|
||||
# it isn't always clear what case/capitalization to use when looking. This rule
|
||||
# is a more reliable way to get there.
|
||||
rule executable-path ( )
|
||||
{
|
||||
return [ string.words [ environ [ constant executable-path-variable ] ]
|
||||
: [ constant path-separator ] ] ;
|
||||
}
|
||||
|
||||
|
||||
# Initialize the list of home directories for the current user depending on the
|
||||
# OS.
|
||||
if $(.name) = NT
|
||||
{
|
||||
local home = [ environ HOMEDRIVE HOMEPATH ] ;
|
||||
.home-directories = $(home[1])$(home[2]) [ environ HOME ] [ environ USERPROFILE ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
.home-directories = [ environ HOME ] ;
|
||||
}
|
||||
|
||||
|
||||
# Can't use 'constant' mechanism because it only returns 1-element values.
|
||||
rule home-directories ( )
|
||||
{
|
||||
return $(.home-directories) ;
|
||||
}
|
||||
|
||||
|
||||
# Return the string needed to represent the expansion of the named shell
|
||||
# variable.
|
||||
rule expand-variable ( variable )
|
||||
{
|
||||
local prefix = [ constant expand-variable-prefix ] ;
|
||||
local suffix = [ constant expand-variable-suffix ] ;
|
||||
return $(prefix)$(variable)$(suffix) ;
|
||||
}
|
||||
|
||||
|
||||
# Returns true if running on windows, whether in cygwin or not.
|
||||
rule on-windows ( )
|
||||
{
|
||||
local result ;
|
||||
if [ modules.peek : NT ]
|
||||
{
|
||||
result = true ;
|
||||
}
|
||||
else if [ modules.peek : UNIX ]
|
||||
{
|
||||
switch [ modules.peek : JAMUNAME ]
|
||||
{
|
||||
case CYGWIN* :
|
||||
{
|
||||
result = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
|
||||
rule on-vms ( )
|
||||
{
|
||||
local result ;
|
||||
if [ modules.peek : VMS ]
|
||||
{
|
||||
result = true ;
|
||||
}
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
|
||||
if ! [ on-windows ] && ! [ on-vms ]
|
||||
{
|
||||
.on-unix = 1 ;
|
||||
}
|
||||
|
||||
|
||||
rule on-unix
|
||||
{
|
||||
return $(.on-unix) ;
|
||||
}
|
||||
|
||||
|
||||
rule __test__
|
||||
{
|
||||
import assert ;
|
||||
if ! ( --quiet in [ modules.peek : ARGV ] )
|
||||
{
|
||||
ECHO os: name= [ name ] ;
|
||||
ECHO os: version= [ version ] ;
|
||||
}
|
||||
assert.true name ;
|
||||
}
|
||||
+1
Submodule external/pybind11 added at 2d0507db43
Vendored
+9
-13
@@ -1,15 +1,11 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(stb_image)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(igl_stb_image)
|
||||
|
||||
option(STBI_LOAD "Compile stbi" ON)
|
||||
option(STBI_WRITE "Compile stbi_writeUse CoMiso" ON)
|
||||
add_library(${PROJECT_NAME} SHARED igl_stb_image.cpp stb_image.h stb_image_write.h)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if (STBI_LOAD)
|
||||
add_definitions(-DSTBI_LOAD)
|
||||
endif()
|
||||
|
||||
if (STBI_WRITE)
|
||||
add_definitions(-DSTBI_WRITE)
|
||||
endif()
|
||||
|
||||
add_library(stb_image STATIC stb_image.cpp stb_image.h stb_image_write.h)
|
||||
# Export interface symbols and hide internal implementation
|
||||
include(GenerateExportHeader)
|
||||
generate_export_header(${PROJECT_NAME})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
#include "igl_stb_image.h"
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "stb_image_write.h"
|
||||
|
||||
|
||||
unsigned char * igl::stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
|
||||
{
|
||||
return ::stbi_load(filename, x, y, comp, req_comp);
|
||||
}
|
||||
|
||||
void igl::stbi_image_free(void *retval_from_stbi_load)
|
||||
{
|
||||
::stbi_image_free(retval_from_stbi_load);
|
||||
}
|
||||
|
||||
int igl::stbi_write_png(
|
||||
char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes)
|
||||
{
|
||||
return ::stbi_write_png(filename, w, h, comp, data, stride_in_bytes);
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
#ifndef IGL_STB_IMAGE_H
|
||||
#define IGL_STB_IMAGE_H
|
||||
|
||||
#include <igl_stb_image_export.h>
|
||||
|
||||
namespace igl {
|
||||
IGL_STB_IMAGE_EXPORT unsigned char * stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp);
|
||||
IGL_STB_IMAGE_EXPORT void stbi_image_free(void *retval_from_stbi_load);
|
||||
IGL_STB_IMAGE_EXPORT int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);
|
||||
} // namespace igl
|
||||
|
||||
#endif
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
// dummy cpp file to compile the code in case IGL is in header only mode
|
||||
#ifdef STBI_LOAD
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
#endif
|
||||
|
||||
#ifdef STBI_WRITE
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "stb_image_write.h"
|
||||
#endif
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule external/triangle updated: 428a74fd93...d6761dd691
@@ -12,7 +12,7 @@
|
||||
<p>
|
||||
A .dmat file contains a dense matrix in column major order. It can contain
|
||||
ASCII or binary data. Note that it is uncompressed so binary only reduces the
|
||||
file size by 50%. But writing and reading binary is usualy faster. In MATLAB,
|
||||
file size by 50%. But writing and reading binary is usually faster. In MATLAB,
|
||||
binary is almost 100x faster.
|
||||
</p>
|
||||
<h2>ASCII</h2>
|
||||
@@ -33,7 +33,7 @@ Then there should be another header containing the size of the binary part:
|
||||
</p>
|
||||
<pre><code>[#cols] [#rows]</code></pre>
|
||||
<p>
|
||||
Then coefficents are written in column-major order in Little-endian 8-byte
|
||||
Then coefficients are written in column-major order in Little-endian 8-byte
|
||||
double precision IEEE floating point format.
|
||||
</p>
|
||||
<p><strong>Note:</strong> Line endings must be <code>'\n'</code> aka char(10) aka line feeds.</p>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<li><a href=http://tetgen.berlios.de/fformats.face.html
|
||||
class=missing>.face</a> TetGen's file format for simplicial facets.</li>
|
||||
<li><a href="http://www.ann.jussieu.fr/frey/publications/RT-0253.pdf#page=33">.mesh</a> Medit's triangle surface mesh + tetrahedral volume mesh file format, see page 33, section 7.2.1</li>
|
||||
<li><i>.node</i> List of points (vertices). Described indentically (upto
|
||||
<li><i>.node</i> List of points (vertices). Described identically (upto
|
||||
accepted dimensions, use of attributes and boundary markers) by <a
|
||||
href="https://www.cs.cmu.edu/~quake/triangle.node.html">Triangle</a>, <a
|
||||
href=http://tetgen.berlios.de/fformats.node.html>TetGen</a>, and <a
|
||||
@@ -37,7 +37,7 @@
|
||||
href=https://en.wikipedia.org/wiki/Portable_Network_Graphics>.png</a>
|
||||
Portable Network Graphics image file. IGLLIB (in the libiglpng extra)
|
||||
supports png image files via the <a href=https://github.com/yig/yimg>yimg</a>
|
||||
library. Alpha channels and compression are suppported.</li>
|
||||
library. Alpha channels and compression are supported.</li>
|
||||
<li><i>.poly</i> Piecewise-linear complex. This format comes in many similar but importantly different flavors:
|
||||
<a href="https://www.cs.cmu.edu/~quake/triangle.poly.html">triangle's</a>, <a href="http://tetgen.berlios.de/fformats.poly.html">tetgen's</a>, <a href="http://sparse-meshing.com/svr/0.2.1/format-poly.html">pyramid/SVR's</a></li>
|
||||
<li><a href=./rbr.html>.rbr</a> ASCII files for saving state of ReAntTweakBar</li>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<hr>
|
||||
<p>
|
||||
A .tgf file contains a graph of describing a set of control handles/structures:
|
||||
point controls, bones of a skelton and cages made of "cage edges".
|
||||
point controls, bones of a skeleton and cages made of "cage edges".
|
||||
</p>
|
||||
<p>
|
||||
The first part of the file consists of lines regarding each vertex of the graph. Each line reads:
|
||||
|
||||
@@ -31,7 +31,7 @@ STL containers: <b>std::array, std::vector, std::pair</b><br/>
|
||||
Eigen types: <b>Eigen::Matrix, Eigen::SparseMatrix</b><br/>
|
||||
User defined types: <b>XMLSerializable*.</b><br/>
|
||||
<br/>
|
||||
There can also be a hierachical structure like vector<int>, this will result in the following serialization:
|
||||
There can also be a hierarchical structure like vector<int>, this will result in the following serialization:
|
||||
</p>
|
||||
<pre><code><group>
|
||||
<vector size="3">
|
||||
|
||||
+64
-57
@@ -15,6 +15,7 @@
|
||||
#include "sort.h"
|
||||
#include "volume.h"
|
||||
#include "ray_box_intersect.h"
|
||||
#include "parallel_for.h"
|
||||
#include "ray_mesh_intersect.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@@ -27,7 +28,7 @@ template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle, typename Derivedbb_mins, typename Derivedbb_maxs, typename Derivedelements>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<Derivedbb_mins> & bb_mins,
|
||||
const Eigen::MatrixBase<Derivedbb_maxs> & bb_maxs,
|
||||
const Eigen::MatrixBase<Derivedelements> & elements,
|
||||
@@ -106,7 +107,7 @@ template <
|
||||
typename DerivedI>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::init(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedSI> & SI,
|
||||
const Eigen::MatrixBase<DerivedI> & I)
|
||||
{
|
||||
@@ -204,15 +205,15 @@ template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle, typename Derivedq>
|
||||
IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<Derivedq> & q,
|
||||
const bool first) const
|
||||
{
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
assert(q.size() == DIM &&
|
||||
assert(q.size() == DIM &&
|
||||
"Query dimension should match aabb dimension");
|
||||
assert(Ele.cols() == V.cols()+1 &&
|
||||
assert(Ele.cols() == V.cols()+1 &&
|
||||
"AABB::find only makes sense for (d+1)-simplices");
|
||||
const Scalar epsilon = igl::EPS<Scalar>();
|
||||
// Check if outside bounding box
|
||||
@@ -250,7 +251,7 @@ IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
|
||||
const Vector2S V2 = V.row(Ele(m_primitive,1));
|
||||
const Vector2S V3 = V.row(Ele(m_primitive,2));
|
||||
// Hack for now to keep templates simple. If becomes bottleneck
|
||||
// consider using std::enable_if_t
|
||||
// consider using std::enable_if_t
|
||||
const Vector2S q2 = q.head(2);
|
||||
a1 = doublearea_single(V1,V2,q2);
|
||||
a2 = doublearea_single(V2,V3,q2);
|
||||
@@ -266,9 +267,9 @@ IGL_INLINE std::vector<int> igl::AABB<DerivedV,DIM>::find(
|
||||
a3 /= sum;
|
||||
a4 /= sum;
|
||||
if(
|
||||
a1>=-epsilon &&
|
||||
a2>=-epsilon &&
|
||||
a3>=-epsilon &&
|
||||
a1>=-epsilon &&
|
||||
a2>=-epsilon &&
|
||||
a3>=-epsilon &&
|
||||
a4>=-epsilon)
|
||||
{
|
||||
return std::vector<int>(1,m_primitive);
|
||||
@@ -345,10 +346,10 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::serialize(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const
|
||||
@@ -359,10 +360,10 @@ igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
Scalar low_sqr_d,
|
||||
Scalar up_sqr_d,
|
||||
@@ -393,7 +394,7 @@ igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
{
|
||||
int i_left;
|
||||
RowVectorDIMS c_left = c;
|
||||
Scalar sqr_d_left =
|
||||
Scalar sqr_d_left =
|
||||
m_left->squared_distance(V,Ele,p,low_sqr_d,sqr_d,i_left,c_left);
|
||||
this->set_min(p,sqr_d_left,i_left,c_left,sqr_d,i,c);
|
||||
looked_left = true;
|
||||
@@ -401,8 +402,8 @@ igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
const auto & look_right = [&]()
|
||||
{
|
||||
int i_right;
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> c_right = c;
|
||||
Scalar sqr_d_right =
|
||||
RowVectorDIMS c_right = c;
|
||||
Scalar sqr_d_right =
|
||||
m_right->squared_distance(V,Ele,p,low_sqr_d,sqr_d,i_right,c_right);
|
||||
this->set_min(p,sqr_d_right,i_right,c_right,sqr_d,i,c);
|
||||
looked_right = true;
|
||||
@@ -418,9 +419,9 @@ igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
look_right();
|
||||
}
|
||||
// if haven't looked left and could be less than current min, then look
|
||||
Scalar left_up_sqr_d =
|
||||
Scalar left_up_sqr_d =
|
||||
m_left->m_box.squaredExteriorDistance(p.transpose());
|
||||
Scalar right_up_sqr_d =
|
||||
Scalar right_up_sqr_d =
|
||||
m_right->m_box.squaredExteriorDistance(p.transpose());
|
||||
if(left_up_sqr_d < right_up_sqr_d)
|
||||
{
|
||||
@@ -449,10 +450,10 @@ igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
Scalar up_sqr_d,
|
||||
int & i,
|
||||
@@ -464,13 +465,13 @@ igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
template <typename DerivedV, int DIM>
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename DerivedP,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedP,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedC>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedP> & P,
|
||||
Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
|
||||
Eigen::PlainObjectBase<DerivedI> & I,
|
||||
@@ -482,35 +483,37 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
C.resizeLike(P);
|
||||
// O( #P * log #Ele ), where log #Ele is really the depth of this AABB
|
||||
// hierarchy
|
||||
for(int p = 0;p<P.rows();p++)
|
||||
{
|
||||
RowVectorDIMS Pp = P.row(p), c;
|
||||
int Ip;
|
||||
sqrD(p) = squared_distance(V,Ele,Pp,Ip,c);
|
||||
I(p) = Ip;
|
||||
C.row(p).head(DIM) = c;
|
||||
}
|
||||
//for(int p = 0;p<P.rows();p++)
|
||||
igl::parallel_for(P.rows(),[&](int p)
|
||||
{
|
||||
RowVectorDIMS Pp = P.row(p), c;
|
||||
int Ip;
|
||||
sqrD(p) = squared_distance(V,Ele,Pp,Ip,c);
|
||||
I(p) = Ip;
|
||||
C.row(p).head(DIM) = c;
|
||||
},
|
||||
10000);
|
||||
}
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename Derivedother_V,
|
||||
typename Derivedother_Ele,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedC>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const AABB<Derivedother_V,DIM> & other,
|
||||
const Eigen::MatrixBase<Derivedother_V> & other_V,
|
||||
const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
|
||||
const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
|
||||
Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
|
||||
Eigen::PlainObjectBase<DerivedI> & I,
|
||||
Eigen::PlainObjectBase<DerivedC> & C) const
|
||||
{
|
||||
assert(other_Ele.cols() == 1 &&
|
||||
assert(other_Ele.cols() == 1 &&
|
||||
"Only implemented for other as list of points");
|
||||
assert(other_V.cols() == V.cols() && "other must match this dimension");
|
||||
sqrD.setConstant(other_Ele.rows(),1,std::numeric_limits<double>::infinity());
|
||||
@@ -528,20 +531,20 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::squared_distance(
|
||||
}
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename Derivedother_V,
|
||||
typename Derivedother_Ele,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedC>
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
igl::AABB<DerivedV,DIM>::squared_distance_helper(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const AABB<Derivedother_V,DIM> * other,
|
||||
const Eigen::MatrixBase<Derivedother_V> & other_V,
|
||||
const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
|
||||
const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
|
||||
const Scalar /*up_sqr_d*/,
|
||||
Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
|
||||
Eigen::PlainObjectBase<DerivedI> & I,
|
||||
@@ -584,7 +587,7 @@ IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
return sqr_d;
|
||||
}
|
||||
|
||||
//// Exact minimum squared distance between arbitary primitives inside this and
|
||||
//// Exact minimum squared distance between arbitrary primitives inside this and
|
||||
//// othre's bounding boxes
|
||||
//const auto & min_squared_distance = [&](
|
||||
// const AABB<DerivedV,DIM> * A,
|
||||
@@ -731,9 +734,9 @@ IGL_INLINE typename igl::AABB<DerivedV,DIM>::Scalar
|
||||
//assert(mc == mm);
|
||||
// Only look left/right in this_list if can possible decrease somebody's
|
||||
// distance in this_tree.
|
||||
const Scalar min_this_other = min_squared_distance(this_tree,other_tree);
|
||||
const Scalar min_this_other = min_squared_distance(this_tree,other_tree);
|
||||
if(
|
||||
min_this_other < sqr_d &&
|
||||
min_this_other < sqr_d &&
|
||||
min_this_other < other_tree->m_low_sqr_d)
|
||||
{
|
||||
//cout<<"before: "<<other_low_sqr_d(child)<<endl;
|
||||
@@ -764,7 +767,7 @@ template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
const Scalar low_sqr_d,
|
||||
Scalar & sqr_d,
|
||||
@@ -789,7 +792,7 @@ template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
Scalar & sqr_d,
|
||||
int & i,
|
||||
@@ -801,7 +804,7 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
|
||||
const RowVectorDIMS &
|
||||
const RowVectorDIMS &
|
||||
#ifndef NDEBUG
|
||||
p
|
||||
#endif
|
||||
@@ -831,10 +834,10 @@ IGL_INLINE void igl::AABB<DerivedV,DIM>::set_min(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE bool
|
||||
IGL_INLINE bool
|
||||
igl::AABB<DerivedV,DIM>::intersect_ray(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & origin,
|
||||
const RowVectorDIMS & dir,
|
||||
std::vector<igl::Hit> & hits) const
|
||||
@@ -874,10 +877,10 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE bool
|
||||
IGL_INLINE bool
|
||||
igl::AABB<DerivedV,DIM>::intersect_ray(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & origin,
|
||||
const RowVectorDIMS & dir,
|
||||
igl::Hit & hit) const
|
||||
@@ -932,10 +935,10 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
|
||||
|
||||
template <typename DerivedV, int DIM>
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE bool
|
||||
IGL_INLINE bool
|
||||
igl::AABB<DerivedV,DIM>::intersect_ray(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & origin,
|
||||
const RowVectorDIMS & dir,
|
||||
const Scalar _min_t,
|
||||
@@ -1001,7 +1004,7 @@ igl::AABB<DerivedV,DIM>::intersect_ray(
|
||||
|
||||
// This is a bullshit template because AABB annoyingly needs templates for bad
|
||||
// combinations of 3D V with DIM=2 AABB
|
||||
//
|
||||
//
|
||||
// _Define_ as a no-op rather than monkeying around with the proper code above
|
||||
//
|
||||
// Meanwhile, GCC seems to have a bug. Let's see if GCC likes using explicit
|
||||
@@ -1022,6 +1025,10 @@ namespace igl
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template double igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::AABB<Eigen::Matrix<double, -1, 3, 1, -1, 3>, 3>::init<Eigen::Matrix<int, -1, 3, 1, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&);
|
||||
// generated by autoexplicit.sh
|
||||
// generated by autoexplicit.sh
|
||||
template float igl::AABB<Eigen::Matrix<float, -1, 3, 0, -1, 3>, 3>::squared_distance<Eigen::Matrix<int, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<float, 1, 3, 1, 1, 3> const&, float, float, int&, Eigen::PlainObjectBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> >&) const;
|
||||
// generated by autoexplicit.sh
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2017 Daniele Panozzo <daniele.panozzo@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "AtA_cached.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void igl::AtA_cached_precompute(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
igl::AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA)
|
||||
{
|
||||
// 1 Compute At (this could be avoided, but performance-wise it will not make a difference)
|
||||
std::vector<std::vector<int> > Col_RowPtr;
|
||||
std::vector<std::vector<int> > Col_IndexPtr;
|
||||
|
||||
Col_RowPtr.resize(A.cols());
|
||||
Col_IndexPtr.resize(A.cols());
|
||||
|
||||
for (unsigned k=0; k<A.outerSize(); ++k)
|
||||
{
|
||||
unsigned outer_index = *(A.outerIndexPtr()+k);
|
||||
unsigned next_outer_index = (k+1 == A.outerSize()) ? A.nonZeros() : *(A.outerIndexPtr()+k+1);
|
||||
|
||||
for (unsigned l=outer_index; l<next_outer_index; ++l)
|
||||
{
|
||||
int col = k;
|
||||
int row = *(A.innerIndexPtr()+l);
|
||||
int value_index = l;
|
||||
assert(col < A.cols());
|
||||
assert(col >= 0);
|
||||
assert(row < A.rows());
|
||||
assert(row >= 0);
|
||||
assert(value_index >= 0);
|
||||
assert(value_index < A.nonZeros());
|
||||
|
||||
Col_RowPtr[col].push_back(row);
|
||||
Col_IndexPtr[col].push_back(value_index);
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::SparseMatrix<Scalar> At = A.transpose();
|
||||
At.makeCompressed();
|
||||
AtA = At * A;
|
||||
AtA.makeCompressed();
|
||||
|
||||
assert(AtA.isCompressed());
|
||||
|
||||
// If weights are not provided, use 1
|
||||
if (data.W.size() == 0)
|
||||
data.W = Eigen::VectorXd::Ones(A.rows());
|
||||
assert(data.W.size() == A.rows());
|
||||
|
||||
data.I_outer.reserve(AtA.outerSize());
|
||||
data.I_row.reserve(2*AtA.nonZeros());
|
||||
data.I_col.reserve(2*AtA.nonZeros());
|
||||
data.I_w.reserve(2*AtA.nonZeros());
|
||||
|
||||
// 2 Construct the rules
|
||||
for (unsigned k=0; k<AtA.outerSize(); ++k)
|
||||
{
|
||||
unsigned outer_index = *(AtA.outerIndexPtr()+k);
|
||||
unsigned next_outer_index = (k+1 == AtA.outerSize()) ? AtA.nonZeros() : *(AtA.outerIndexPtr()+k+1);
|
||||
|
||||
for (unsigned l=outer_index; l<next_outer_index; ++l)
|
||||
{
|
||||
int col = k;
|
||||
int row = *(AtA.innerIndexPtr()+l);
|
||||
int value_index = l;
|
||||
assert(col < AtA.cols());
|
||||
assert(col >= 0);
|
||||
assert(row < AtA.rows());
|
||||
assert(row >= 0);
|
||||
assert(value_index >= 0);
|
||||
assert(value_index < AtA.nonZeros());
|
||||
|
||||
data.I_outer.push_back(data.I_row.size());
|
||||
|
||||
// Find correspondences
|
||||
unsigned i=0;
|
||||
unsigned j=0;
|
||||
while (i<Col_RowPtr[row].size() && j<Col_RowPtr[col].size())
|
||||
{
|
||||
if (Col_RowPtr[row][i] == Col_RowPtr[col][j])
|
||||
{
|
||||
data.I_row.push_back(Col_IndexPtr[row][i]);
|
||||
data.I_col.push_back(Col_IndexPtr[col][j]);
|
||||
data.I_w.push_back(Col_RowPtr[col][j]);
|
||||
++i;
|
||||
++j;
|
||||
} else
|
||||
if (Col_RowPtr[row][i] > Col_RowPtr[col][j])
|
||||
++j;
|
||||
else
|
||||
++i;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
data.I_outer.push_back(data.I_row.size()); // makes it more efficient to iterate later on
|
||||
|
||||
igl::AtA_cached(A,data,AtA);
|
||||
}
|
||||
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void igl::AtA_cached(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
const igl::AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA)
|
||||
{
|
||||
for (unsigned i=0; i<data.I_outer.size()-1; ++i)
|
||||
{
|
||||
*(AtA.valuePtr() + i) = 0;
|
||||
for (unsigned j=data.I_outer[i]; j<data.I_outer[i+1]; ++j)
|
||||
*(AtA.valuePtr() + i) += *(A.valuePtr() + data.I_row[j]) * data.W[data.I_w[j]] * *(A.valuePtr() + data.I_col[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
template void igl::AtA_cached<double>(Eigen::SparseMatrix<double, 0, int> const&, igl::AtA_cached_data const&, Eigen::SparseMatrix<double, 0, int>&);
|
||||
template void igl::AtA_cached_precompute<double>(Eigen::SparseMatrix<double, 0, int> const&, igl::AtA_cached_data&, Eigen::SparseMatrix<double, 0, int>&);
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2017 Daniele Panozzo <daniele.panozzo@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_ATA_CACHED_H
|
||||
#define IGL_ATA_CACHED_H
|
||||
#include "igl_inline.h"
|
||||
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Sparse>
|
||||
namespace igl
|
||||
{
|
||||
struct AtA_cached_data
|
||||
{
|
||||
// Weights
|
||||
Eigen::VectorXd W;
|
||||
|
||||
// Flatten composition rules
|
||||
std::vector<int> I_row;
|
||||
std::vector<int> I_col;
|
||||
std::vector<int> I_w;
|
||||
|
||||
// For each entry of AtA, points to the beginning
|
||||
// of the composition rules
|
||||
std::vector<int> I_outer;
|
||||
};
|
||||
|
||||
// Computes At * W * A, where A is sparse and W is diagonal. Divides the
|
||||
// construction in two phases, one
|
||||
// for fixing the sparsity pattern, and one to populate it with values. Compared to
|
||||
// evaluating it directly, this version is slower for the first time (since it requires a
|
||||
// precomputation), but faster to the subsequent evaluations.
|
||||
//
|
||||
// Input:
|
||||
// A m x n sparse matrix
|
||||
// data stores the precomputed sparsity pattern, data.W contains the optional diagonal weights (stored as a dense vector). If W is not provided, it is replaced by the identity.
|
||||
// Outputs:
|
||||
// AtA m by m matrix computed as AtA * W * A
|
||||
//
|
||||
// Example:
|
||||
// AtA_data = igl::AtA_cached_data();
|
||||
// AtA_data.W = W;
|
||||
// if (s.AtA.rows() == 0)
|
||||
// igl::AtA_cached_precompute(s.A,s.AtA_data,s.AtA);
|
||||
// else
|
||||
// igl::AtA_cached(s.A,s.AtA_data,s.AtA);
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void AtA_cached_precompute(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA
|
||||
);
|
||||
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void AtA_cached(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
const AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
#ifndef IGL_STATIC_LIBRARY
|
||||
# include "AtA_cached.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -23,7 +23,7 @@ namespace igl
|
||||
|
||||
// A simple camera class. The camera stores projection parameters (field of
|
||||
// view angle, aspect ratio, near and far clips) as well as a rigid
|
||||
// tranformation *of the camera as if it were also a scene object*. Thus, the
|
||||
// transformation *of the camera as if it were also a scene object*. Thus, the
|
||||
// **inverse** of this rigid transformation is the modelview transformation.
|
||||
class Camera
|
||||
{
|
||||
|
||||
@@ -1,375 +0,0 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2013 Olga Diamanti, 2015 Alec Jacobson
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_CONJUGATE_FF_SOLVER_DATA_H
|
||||
#define IGL_CONJUGATE_FF_SOLVER_DATA_H
|
||||
#include "igl_inline.h"
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Sparse>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
namespace igl
|
||||
{
|
||||
// Data class for the Conjugate Frame Field Solver
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
class ConjugateFFSolverData
|
||||
{
|
||||
public:
|
||||
const Eigen::PlainObjectBase<DerivedV> &V; int numV;
|
||||
const Eigen::PlainObjectBase<DerivedF> &F; int numF;
|
||||
|
||||
Eigen::MatrixXi EV; int numE;
|
||||
Eigen::MatrixXi F2E;
|
||||
Eigen::MatrixXi E2F;
|
||||
Eigen::VectorXd K;
|
||||
|
||||
Eigen::VectorXi isBorderEdge;
|
||||
int numInteriorEdges;
|
||||
Eigen::Matrix<int,Eigen::Dynamic,2> E2F_int;
|
||||
Eigen::VectorXi indInteriorToFull;
|
||||
Eigen::VectorXi indFullToInterior;
|
||||
|
||||
DerivedV B1, B2, FN;
|
||||
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic,1> kmin, kmax;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic,2> dmin, dmax;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic,3> dmin3, dmax3;
|
||||
|
||||
Eigen::VectorXd nonPlanarityMeasure;
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > planarityWeight;
|
||||
|
||||
//conjugacy matrix
|
||||
std::vector<Eigen::Matrix<typename DerivedV::Scalar, 4,4> > H;
|
||||
|
||||
//conjugacy matrix eigenvectors and (scaled) eigenvalues
|
||||
std::vector<Eigen::Matrix<typename DerivedV::Scalar, 4,4> > UH;
|
||||
std::vector<Eigen::Matrix<typename DerivedV::Scalar, 4,1> > s;
|
||||
|
||||
//laplacians
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> DDA, DDB;
|
||||
|
||||
private:
|
||||
IGL_INLINE void computeCurvatureAndPrincipals();
|
||||
IGL_INLINE void precomputeConjugacyStuff();
|
||||
IGL_INLINE void computeLaplacians();
|
||||
IGL_INLINE void computek();
|
||||
IGL_INLINE void computeCoefficientLaplacian(int n, Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &D);
|
||||
|
||||
IGL_INLINE void precomputeInteriorEdges();
|
||||
|
||||
public:
|
||||
IGL_INLINE ConjugateFFSolverData(const Eigen::PlainObjectBase<DerivedV> &_V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &_F);
|
||||
IGL_INLINE void evaluateConjugacy(const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvU,
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvV,
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &conjValues) const ;
|
||||
};
|
||||
}
|
||||
|
||||
#include <igl/colon.h>
|
||||
#include <igl/edge_topology.h>
|
||||
#include <igl/false_barycentric_subdivision.h>
|
||||
#include <igl/local_basis.h>
|
||||
#include <igl/principal_curvature.h>
|
||||
#include <igl/sparse.h>
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE igl::ConjugateFFSolverData<DerivedV, DerivedF>::
|
||||
ConjugateFFSolverData(const Eigen::PlainObjectBase<DerivedV> &_V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &_F):
|
||||
V(_V),
|
||||
numV(_V.rows()),
|
||||
F(_F),
|
||||
numF(_F.rows())
|
||||
{
|
||||
igl::edge_topology(V,F,EV,F2E,E2F);
|
||||
numE = EV.rows();
|
||||
|
||||
precomputeInteriorEdges();
|
||||
|
||||
igl::local_basis(V,F,B1,B2,FN);
|
||||
|
||||
computek();
|
||||
|
||||
computeLaplacians();
|
||||
|
||||
computeCurvatureAndPrincipals();
|
||||
precomputeConjugacyStuff();
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::computeCurvatureAndPrincipals()
|
||||
{
|
||||
Eigen::MatrixXd VCBary;
|
||||
Eigen::MatrixXi FCBary;
|
||||
|
||||
VCBary.setZero(numV+numF,3);
|
||||
FCBary.setZero(3*numF,3);
|
||||
igl::false_barycentric_subdivision(V, F, VCBary, FCBary);
|
||||
|
||||
Eigen::MatrixXd dmax3_,dmin3_;
|
||||
igl::principal_curvature(VCBary, FCBary, dmax3_, dmin3_, kmax, kmin, 5,true);
|
||||
|
||||
dmax3 = dmax3_.bottomRows(numF);
|
||||
dmin3 = dmin3_.bottomRows(numF);
|
||||
|
||||
kmax = kmax.bottomRows(numF);
|
||||
kmin = kmin.bottomRows(numF);
|
||||
|
||||
// kmax = dmax3.rowwise().norm();
|
||||
// kmin = dmin3.rowwise().norm();
|
||||
|
||||
dmin3.rowwise().normalize();
|
||||
dmax3.rowwise().normalize();
|
||||
dmax.setZero(numF,2);
|
||||
dmin.setZero(numF,2);
|
||||
for (int i= 0; i <numF; ++i)
|
||||
{
|
||||
if(kmin[i] != kmin[i] || kmax[i] != kmax[i] || (dmin3.row(i).array() != dmin3.row(i).array()).any() || (dmax3.row(i).array() != dmax3.row(i).array()).any())
|
||||
{
|
||||
kmin[i] = 0;
|
||||
kmax[i] = 0;
|
||||
dmin3.row(i) = B1.row(i);
|
||||
dmax3.row(i) = B2.row(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmax3.row(i) = (dmax3.row(i) - (dmax3.row(i).dot(FN.row(i)))*FN.row(i)).normalized();
|
||||
dmin3.row(i) = dmin3.row(i) - (dmin3.row(i).dot(FN.row(i)))*FN.row(i);
|
||||
dmin3.row(i) = (dmin3.row(i) - (dmin3.row(i).dot(dmax3.row(i)))*dmax3.row(i)).normalized();
|
||||
if ((dmin3.row(i).cross(dmax3.row(i))).dot(FN.row(i))<0)
|
||||
dmin3.row(i) = -dmin3.row(i);
|
||||
}
|
||||
dmax.row(i) << dmax3.row(i).dot(B1.row(i)), dmax3.row(i).dot(B2.row(i));
|
||||
dmax.row(i).normalize();
|
||||
dmin.row(i) << dmin3.row(i).dot(B1.row(i)), dmin3.row(i).dot(B2.row(i));
|
||||
dmin.row(i).normalize();
|
||||
|
||||
}
|
||||
|
||||
nonPlanarityMeasure = kmax.cwiseAbs().array()*kmin.cwiseAbs().array();
|
||||
typename DerivedV::Scalar minP = nonPlanarityMeasure.minCoeff();
|
||||
typename DerivedV::Scalar maxP = nonPlanarityMeasure.maxCoeff();
|
||||
nonPlanarityMeasure = (nonPlanarityMeasure.array()-minP)/(maxP-minP);
|
||||
Eigen::VectorXi I = igl::colon<typename DerivedF::Scalar>(0, numF-1);
|
||||
igl::sparse(I, I, nonPlanarityMeasure, numF, numF, planarityWeight);
|
||||
|
||||
}
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::precomputeConjugacyStuff()
|
||||
{
|
||||
H.resize(numF);
|
||||
UH.resize(numF);
|
||||
s.resize(numF);
|
||||
|
||||
for (int i = 0; i<numF; ++i)
|
||||
{
|
||||
//compute conjugacy matrix
|
||||
typename DerivedV::Scalar e1x = dmin(i,0), e1y = dmin(i,1), e2x = dmax(i,0), e2y = dmax(i,1), k1 = kmin[i], k2 = kmax[i];
|
||||
|
||||
H[i]<<
|
||||
0, 0, k1*e1x*e1x, k1*e1x*e1y,
|
||||
0, 0, k1*e1x*e1y, k1*e1y*e1y,
|
||||
k2*e2x*e2x, k2*e2x*e2y, 0, 0,
|
||||
k2*e2x*e2y, k2*e2y*e2y, 0, 0;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 4> Ht = H[i].transpose();
|
||||
H[i] = .5*(H[i]+Ht);
|
||||
|
||||
Eigen::EigenSolver<Eigen::Matrix<typename DerivedV::Scalar, 4, 4> > es(H[i]);
|
||||
s[i] = es.eigenvalues().real();//ok to do this because H symmetric
|
||||
//scale
|
||||
s[i] = s[i]/(s[i].cwiseAbs().minCoeff());
|
||||
UH[i] = es.eigenvectors().real();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::computeLaplacians()
|
||||
{
|
||||
computeCoefficientLaplacian(2, DDA);
|
||||
|
||||
computeCoefficientLaplacian(4, DDB);
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
|
||||
precomputeInteriorEdges()
|
||||
{
|
||||
// Flag border edges
|
||||
numInteriorEdges = 0;
|
||||
isBorderEdge.setZero(numE,1);
|
||||
indFullToInterior = -1*Eigen::VectorXi::Ones(numE,1);
|
||||
|
||||
for(unsigned i=0; i<numE; ++i)
|
||||
{
|
||||
if ((E2F(i,0) == -1) || ((E2F(i,1) == -1)))
|
||||
isBorderEdge[i] = 1;
|
||||
else
|
||||
{
|
||||
indFullToInterior[i] = numInteriorEdges;
|
||||
numInteriorEdges++;
|
||||
}
|
||||
}
|
||||
|
||||
E2F_int.resize(numInteriorEdges, 2);
|
||||
indInteriorToFull.setZero(numInteriorEdges,1);
|
||||
int ii = 0;
|
||||
for (int k=0; k<numE; ++k)
|
||||
{
|
||||
if (isBorderEdge[k])
|
||||
continue;
|
||||
E2F_int.row(ii) = E2F.row(k);
|
||||
indInteriorToFull[ii] = k;
|
||||
ii++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
|
||||
computeCoefficientLaplacian(int n, Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &D)
|
||||
{
|
||||
std::vector<Eigen::Triplet<std::complex<typename DerivedV::Scalar> >> tripletList;
|
||||
|
||||
// For every non-border edge
|
||||
for (unsigned eid=0; eid<numE; ++eid)
|
||||
{
|
||||
if (!isBorderEdge[eid])
|
||||
{
|
||||
int fid0 = E2F(eid,0);
|
||||
int fid1 = E2F(eid,1);
|
||||
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid0,
|
||||
fid0,
|
||||
std::complex<typename DerivedV::Scalar>(1.)));
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid1,
|
||||
fid1,
|
||||
std::complex<typename DerivedV::Scalar>(1.)));
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid0,
|
||||
fid1,
|
||||
-1.*std::polar(1.,-1.*n*K[eid])));
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid1,
|
||||
fid0,
|
||||
-1.*std::polar(1.,1.*n*K[eid])));
|
||||
|
||||
}
|
||||
}
|
||||
D.resize(numF,numF);
|
||||
D.setFromTriplets(tripletList.begin(), tripletList.end());
|
||||
|
||||
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
|
||||
computek()
|
||||
{
|
||||
K.setZero(numE);
|
||||
// For every non-border edge
|
||||
for (unsigned eid=0; eid<numE; ++eid)
|
||||
{
|
||||
if (!isBorderEdge[eid])
|
||||
{
|
||||
int fid0 = E2F(eid,0);
|
||||
int fid1 = E2F(eid,1);
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> N0 = FN.row(fid0);
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> N1 = FN.row(fid1);
|
||||
|
||||
// find common edge on triangle 0 and 1
|
||||
int fid0_vc = -1;
|
||||
int fid1_vc = -1;
|
||||
for (unsigned i=0;i<3;++i)
|
||||
{
|
||||
if (F2E(fid0,i) == eid)
|
||||
fid0_vc = i;
|
||||
if (F2E(fid1,i) == eid)
|
||||
fid1_vc = i;
|
||||
}
|
||||
assert(fid0_vc != -1);
|
||||
assert(fid1_vc != -1);
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> common_edge = V.row(F(fid0,(fid0_vc+1)%3)) - V.row(F(fid0,fid0_vc));
|
||||
common_edge.normalize();
|
||||
|
||||
// Map the two triangles in a new space where the common edge is the x axis and the N0 the z axis
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> P;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> o = V.row(F(fid0,fid0_vc));
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> tmp = -N0.cross(common_edge);
|
||||
P << common_edge, tmp, N0;
|
||||
// P.transposeInPlace();
|
||||
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> V0;
|
||||
V0.row(0) = V.row(F(fid0,0)) -o;
|
||||
V0.row(1) = V.row(F(fid0,1)) -o;
|
||||
V0.row(2) = V.row(F(fid0,2)) -o;
|
||||
|
||||
V0 = (P*V0.transpose()).transpose();
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> V1;
|
||||
V1.row(0) = V.row(F(fid1,0)) -o;
|
||||
V1.row(1) = V.row(F(fid1,1)) -o;
|
||||
V1.row(2) = V.row(F(fid1,2)) -o;
|
||||
V1 = (P*V1.transpose()).transpose();
|
||||
|
||||
// compute rotation R such that R * N1 = N0
|
||||
// i.e. map both triangles to the same plane
|
||||
double alpha = -atan2(V1((fid1_vc+2)%3,2),V1((fid1_vc+2)%3,1));
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> R;
|
||||
R << 1, 0, 0,
|
||||
0, cos(alpha), -sin(alpha) ,
|
||||
0, sin(alpha), cos(alpha);
|
||||
V1 = (R*V1.transpose()).transpose();
|
||||
|
||||
// measure the angle between the reference frames
|
||||
// k_ij is the angle between the triangle on the left and the one on the right
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> ref0 = V0.row(1) - V0.row(0);
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> ref1 = V1.row(1) - V1.row(0);
|
||||
|
||||
ref0.normalize();
|
||||
ref1.normalize();
|
||||
|
||||
double ktemp = atan2(ref1(1),ref1(0)) - atan2(ref0(1),ref0(0));
|
||||
|
||||
// just to be sure, rotate ref0 using angle ktemp...
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 2, 2> R2;
|
||||
R2 << cos(ktemp), -sin(ktemp), sin(ktemp), cos(ktemp);
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 2> tmp1 = R2*(ref0.head(2)).transpose();
|
||||
|
||||
K[eid] = ktemp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::ConjugateFFSolverData<DerivedV, DerivedF>::
|
||||
evaluateConjugacy(const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvU,
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> &pvV,
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &conjValues) const
|
||||
{
|
||||
conjValues.resize(numF,1);
|
||||
for (int j =0; j<numF; ++j)
|
||||
{
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 1> x; x<<pvU.row(j).transpose(), pvV.row(j).transpose();
|
||||
conjValues[j] = x.transpose()*H[j]*x;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -13,7 +13,7 @@
|
||||
// A: I guess the right way is to not use a macro but a proper function with
|
||||
// streams as input and output.
|
||||
|
||||
// ANSI color codes for formating iostream style output
|
||||
// ANSI color codes for formatting iostream style output
|
||||
|
||||
#ifdef IGL_REDRUM_NOOP
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace igl
|
||||
{
|
||||
// Templates:
|
||||
// T should be a matrix that implments .size(), and operator(int i)
|
||||
// T should be a matrix that implements .size(), and operator(int i)
|
||||
template <typename T>
|
||||
class SortableRow
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace igl
|
||||
MatrixXS SV;
|
||||
// Facets in this bounding volume
|
||||
MatrixXF F;
|
||||
// Tesselated boundary curve
|
||||
// Tessellated boundary curve
|
||||
MatrixXF cap;
|
||||
// Upper Bound on radius of enclosing ball
|
||||
typename DerivedV::Scalar radius;
|
||||
@@ -97,7 +97,7 @@ namespace igl
|
||||
// Same as above, but always computes winding number using exact method
|
||||
// (sum over every facet)
|
||||
inline typename DerivedV::Scalar winding_number_all(const Point & p) const;
|
||||
// Same as above, but always computes using sum over tesslated boundary
|
||||
// Same as above, but always computes using sum over tessllated boundary
|
||||
inline typename DerivedV::Scalar winding_number_boundary(const Point & p) const;
|
||||
//// Same as winding_number above, but if max_simple_abs_winding_number is
|
||||
//// less than some threshold min_max_w just return 0 (colloquially the "fast
|
||||
@@ -493,7 +493,7 @@ igl::WindingNumberTree<Point,DerivedV,DerivedF>::cached_winding_number(
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Explicit instanciation of static variable
|
||||
// Explicit instantiation of static variable
|
||||
template <
|
||||
typename Point,
|
||||
typename DerivedV,
|
||||
|
||||
@@ -23,15 +23,16 @@ IGL_INLINE void igl::adjacency_matrix(
|
||||
typedef Triplet<T> IJV;
|
||||
vector<IJV > ijv;
|
||||
ijv.reserve(F.size()*2);
|
||||
// Loop over faces
|
||||
// Loop over **simplex** (i.e., **not quad**)
|
||||
for(int i = 0;i<F.rows();i++)
|
||||
{
|
||||
// Loop over this face
|
||||
// Loop over this **simplex**
|
||||
for(int j = 0;j<F.cols();j++)
|
||||
for(int k = j+1;k<F.cols();k++)
|
||||
{
|
||||
// Get indices of edge: s --> d
|
||||
Index s = F(i,j);
|
||||
Index d = F(i,(j+1)%F.cols());
|
||||
Index d = F(i,k);
|
||||
ijv.push_back(IJV(s,d,1));
|
||||
ijv.push_back(IJV(d,s,1));
|
||||
}
|
||||
|
||||
@@ -1,759 +0,0 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2014 Olga Diamanti <olga.diam@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include <igl/angle_bound_frame_fields.h>
|
||||
#include <igl/edge_topology.h>
|
||||
#include <igl/local_basis.h>
|
||||
#include <igl/sparse.h>
|
||||
#include <igl/speye.h>
|
||||
#include <igl/slice.h>
|
||||
#include <igl/polyroots.h>
|
||||
#include <igl/colon.h>
|
||||
#include <Eigen/Sparse>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace igl {
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
class AngleBoundFFSolverData
|
||||
{
|
||||
public:
|
||||
const Eigen::PlainObjectBase<DerivedV> &V; int numV;
|
||||
const Eigen::PlainObjectBase<DerivedF> &F; int numF;
|
||||
|
||||
Eigen::MatrixXi EV; int numE;
|
||||
Eigen::MatrixXi F2E;
|
||||
Eigen::MatrixXi E2F;
|
||||
Eigen::VectorXd K;
|
||||
|
||||
Eigen::VectorXi isBorderEdge;
|
||||
int numInteriorEdges;
|
||||
Eigen::Matrix<int,Eigen::Dynamic,2> E2F_int;
|
||||
Eigen::VectorXi indInteriorToFull;
|
||||
Eigen::VectorXi indFullToInterior;
|
||||
|
||||
DerivedV B1, B2, FN;
|
||||
|
||||
//laplacians
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> DDA, DDB;
|
||||
|
||||
private:
|
||||
IGL_INLINE void computeLaplacians();
|
||||
IGL_INLINE void computek();
|
||||
IGL_INLINE void computeCoefficientLaplacian(int n, Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &D);
|
||||
IGL_INLINE void precomputeInteriorEdges();
|
||||
|
||||
public:
|
||||
IGL_INLINE AngleBoundFFSolverData(const Eigen::PlainObjectBase<DerivedV> &_V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &_F);
|
||||
};
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
class AngleBoundFFSolver
|
||||
{
|
||||
public:
|
||||
IGL_INLINE AngleBoundFFSolver(const AngleBoundFFSolverData<DerivedV, DerivedF> &_data,
|
||||
const typename DerivedV::Scalar &_thetaMin = 30,
|
||||
int _maxIter = 50,
|
||||
const typename DerivedV::Scalar &_lambdaInit = 100,
|
||||
const typename DerivedV::Scalar &_lambdaMultFactor = 1.01,
|
||||
const bool _doHardConstraints = false);
|
||||
IGL_INLINE bool solve(const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
typename DerivedV::Scalar *lambdaOut = NULL);
|
||||
|
||||
private:
|
||||
|
||||
const AngleBoundFFSolverData<DerivedV, DerivedF> &data;
|
||||
|
||||
//polyVF data
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> Acoeff, Bcoeff;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> pvU, pvV;
|
||||
typename DerivedV::Scalar lambda;
|
||||
|
||||
//parameters
|
||||
typename DerivedV::Scalar lambdaInit,lambdaMultFactor;
|
||||
int maxIter;
|
||||
typename DerivedV::Scalar thetaMin;
|
||||
bool doHardConstraints;
|
||||
|
||||
typename DerivedV::Scalar computeAngle(const std::complex<typename DerivedV::Scalar> &u,
|
||||
const std::complex<typename DerivedV::Scalar> &v);
|
||||
// IGL_INLINE void computeAngles(Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &angles);
|
||||
|
||||
IGL_INLINE int getNumOutOfBounds();
|
||||
|
||||
IGL_INLINE void rotateAroundBisector(const std::complex<typename DerivedV::Scalar> &uin,
|
||||
const std::complex<typename DerivedV::Scalar> &vin,
|
||||
const typename DerivedV::Scalar theta,
|
||||
std::complex<typename DerivedV::Scalar> &uout,
|
||||
std::complex<typename DerivedV::Scalar> &vout);
|
||||
|
||||
IGL_INLINE void localStep();
|
||||
|
||||
IGL_INLINE void globalStep(const Eigen::Matrix<int, Eigen::Dynamic, 1> &isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Ak,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Bk);
|
||||
|
||||
IGL_INLINE void minQuadWithKnownMini(const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &Q,
|
||||
const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &f,
|
||||
const Eigen::VectorXi isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &xknown,
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &x);
|
||||
IGL_INLINE void setFieldFromCoefficients();
|
||||
IGL_INLINE void setCoefficientsFromField();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//Implementation
|
||||
/***************************** Data ***********************************/
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE igl::AngleBoundFFSolverData<DerivedV, DerivedF>::
|
||||
AngleBoundFFSolverData(const Eigen::PlainObjectBase<DerivedV> &_V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &_F):
|
||||
V(_V),
|
||||
numV(_V.rows()),
|
||||
F(_F),
|
||||
numF(_F.rows())
|
||||
{
|
||||
igl::edge_topology(V,F,EV,F2E,E2F);
|
||||
numE = EV.rows();
|
||||
|
||||
precomputeInteriorEdges();
|
||||
|
||||
igl::local_basis(V,F,B1,B2,FN);
|
||||
|
||||
computek();
|
||||
|
||||
computeLaplacians();
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::AngleBoundFFSolverData<DerivedV, DerivedF>::computeLaplacians()
|
||||
{
|
||||
computeCoefficientLaplacian(2, DDA);
|
||||
|
||||
computeCoefficientLaplacian(4, DDB);
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::AngleBoundFFSolverData<DerivedV, DerivedF>::
|
||||
precomputeInteriorEdges()
|
||||
{
|
||||
// Flag border edges
|
||||
numInteriorEdges = 0;
|
||||
isBorderEdge.setZero(numE,1);
|
||||
indFullToInterior = Eigen::VectorXi::Constant(numE,-1);
|
||||
|
||||
for(unsigned i=0; i<numE; ++i)
|
||||
{
|
||||
if ((E2F(i,0) == -1) || ((E2F(i,1) == -1)))
|
||||
isBorderEdge[i] = 1;
|
||||
else
|
||||
{
|
||||
indFullToInterior[i] = numInteriorEdges;
|
||||
numInteriorEdges++;
|
||||
}
|
||||
}
|
||||
|
||||
E2F_int.resize(numInteriorEdges, 2);
|
||||
indInteriorToFull.setZero(numInteriorEdges,1);
|
||||
int ii = 0;
|
||||
for (int k=0; k<numE; ++k)
|
||||
{
|
||||
if (isBorderEdge[k])
|
||||
continue;
|
||||
E2F_int.row(ii) = E2F.row(k);
|
||||
indInteriorToFull[ii] = k;
|
||||
ii++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::AngleBoundFFSolverData<DerivedV, DerivedF>::
|
||||
computeCoefficientLaplacian(int n, Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &D)
|
||||
{
|
||||
std::vector<Eigen::Triplet<std::complex<typename DerivedV::Scalar> >> tripletList;
|
||||
|
||||
// For every non-border edge
|
||||
for (unsigned eid=0; eid<numE; ++eid)
|
||||
{
|
||||
if (!isBorderEdge[eid])
|
||||
{
|
||||
int fid0 = E2F(eid,0);
|
||||
int fid1 = E2F(eid,1);
|
||||
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid0,
|
||||
fid0,
|
||||
std::complex<typename DerivedV::Scalar>(1.)));
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid1,
|
||||
fid1,
|
||||
std::complex<typename DerivedV::Scalar>(1.)));
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid0,
|
||||
fid1,
|
||||
-1.*std::polar(1.,-1.*n*K[eid])));
|
||||
tripletList.push_back(Eigen::Triplet<std::complex<typename DerivedV::Scalar> >(fid1,
|
||||
fid0,
|
||||
-1.*std::polar(1.,1.*n*K[eid])));
|
||||
|
||||
}
|
||||
}
|
||||
D.resize(numF,numF);
|
||||
D.setFromTriplets(tripletList.begin(), tripletList.end());
|
||||
|
||||
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF>
|
||||
IGL_INLINE void igl::AngleBoundFFSolverData<DerivedV, DerivedF>::
|
||||
computek()
|
||||
{
|
||||
K.setZero(numE);
|
||||
// For every non-border edge
|
||||
for (unsigned eid=0; eid<numE; ++eid)
|
||||
{
|
||||
if (!isBorderEdge[eid])
|
||||
{
|
||||
int fid0 = E2F(eid,0);
|
||||
int fid1 = E2F(eid,1);
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> N0 = FN.row(fid0);
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> N1 = FN.row(fid1);
|
||||
|
||||
// find common edge on triangle 0 and 1
|
||||
int fid0_vc = -1;
|
||||
int fid1_vc = -1;
|
||||
for (unsigned i=0;i<3;++i)
|
||||
{
|
||||
if (F2E(fid0,i) == eid)
|
||||
fid0_vc = i;
|
||||
if (F2E(fid1,i) == eid)
|
||||
fid1_vc = i;
|
||||
}
|
||||
assert(fid0_vc != -1);
|
||||
assert(fid1_vc != -1);
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> common_edge = V.row(F(fid0,(fid0_vc+1)%3)) - V.row(F(fid0,fid0_vc));
|
||||
common_edge.normalize();
|
||||
|
||||
// Map the two triangles in a new space where the common edge is the x axis and the N0 the z axis
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> P;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> o = V.row(F(fid0,fid0_vc));
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> tmp = -N0.cross(common_edge);
|
||||
P << common_edge, tmp, N0;
|
||||
// P.transposeInPlace();
|
||||
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> V0;
|
||||
V0.row(0) = V.row(F(fid0,0)) -o;
|
||||
V0.row(1) = V.row(F(fid0,1)) -o;
|
||||
V0.row(2) = V.row(F(fid0,2)) -o;
|
||||
|
||||
V0 = (P*V0.transpose()).transpose();
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> V1;
|
||||
V1.row(0) = V.row(F(fid1,0)) -o;
|
||||
V1.row(1) = V.row(F(fid1,1)) -o;
|
||||
V1.row(2) = V.row(F(fid1,2)) -o;
|
||||
V1 = (P*V1.transpose()).transpose();
|
||||
|
||||
// compute rotation R such that R * N1 = N0
|
||||
// i.e. map both triangles to the same plane
|
||||
double alpha = -atan2(V1((fid1_vc+2)%3,2),V1((fid1_vc+2)%3,1));
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 3, 3> R;
|
||||
R << 1, 0, 0,
|
||||
0, cos(alpha), -sin(alpha) ,
|
||||
0, sin(alpha), cos(alpha);
|
||||
V1 = (R*V1.transpose()).transpose();
|
||||
|
||||
// measure the angle between the reference frames
|
||||
// k_ij is the angle between the triangle on the left and the one on the right
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> ref0 = V0.row(1) - V0.row(0);
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 3> ref1 = V1.row(1) - V1.row(0);
|
||||
|
||||
ref0.normalize();
|
||||
ref1.normalize();
|
||||
|
||||
double ktemp = atan2(ref1(1),ref1(0)) - atan2(ref0(1),ref0(0));
|
||||
|
||||
// just to be sure, rotate ref0 using angle ktemp...
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 2, 2> R2;
|
||||
R2 << cos(ktemp), -sin(ktemp), sin(ktemp), cos(ktemp);
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 1, 2> tmp1 = R2*(ref0.head(2)).transpose();
|
||||
|
||||
K[eid] = ktemp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************** Solver ***********************************/
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
AngleBoundFFSolver(const AngleBoundFFSolverData<DerivedV, DerivedF> &_data,
|
||||
const typename DerivedV::Scalar &_thetaMin,
|
||||
int _maxIter,
|
||||
const typename DerivedV::Scalar &_lambdaInit,
|
||||
const typename DerivedV::Scalar &_lambdaMultFactor,
|
||||
const bool _doHardConstraints):
|
||||
data(_data),
|
||||
lambdaInit(_lambdaInit),
|
||||
maxIter(_maxIter),
|
||||
lambdaMultFactor(_lambdaMultFactor),
|
||||
doHardConstraints(_doHardConstraints),
|
||||
thetaMin(_thetaMin)
|
||||
{
|
||||
Acoeff.resize(data.numF,1);
|
||||
Bcoeff.resize(data.numF,1);
|
||||
pvU.setZero(data.numF, 2);
|
||||
pvV.setZero(data.numF, 2);
|
||||
};
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
rotateAroundBisector(const std::complex<typename DerivedV::Scalar> &uin,
|
||||
const std::complex<typename DerivedV::Scalar> &vin,
|
||||
const typename DerivedV::Scalar diff,
|
||||
std::complex<typename DerivedV::Scalar> &uout,
|
||||
std::complex<typename DerivedV::Scalar> &vout)
|
||||
{
|
||||
//rotate 2D complex vectors u and v around their bisector so that their
|
||||
//angle is at least theta
|
||||
|
||||
uout = uin;
|
||||
vout = vin;
|
||||
typename DerivedV::Scalar au = arg(uin);
|
||||
typename DerivedV::Scalar av = arg(vin);
|
||||
if (au<av)
|
||||
{
|
||||
uout = std::polar (1.0,-.5*diff)*uin;
|
||||
vout = std::polar (1.0, .5*diff)*vin;
|
||||
}
|
||||
else
|
||||
{
|
||||
uout = std::polar (1.0, .5*diff)*uin;
|
||||
vout = std::polar (1.0,-.5*diff)*vin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
localStep()
|
||||
{
|
||||
for (int j =0; j<data.numF; ++j)
|
||||
{
|
||||
|
||||
std::complex<typename DerivedV::Scalar> u(pvU(j,0),pvU(j,1));
|
||||
std::complex<typename DerivedV::Scalar> v(pvV(j,0),pvV(j,1));
|
||||
|
||||
typename DerivedV::Scalar current_angle = computeAngle(u, v);
|
||||
if (current_angle<thetaMin*M_PI/180)
|
||||
{
|
||||
// bring all to 1st or 4th quarter plane
|
||||
if ((arg(u)>=0.5*M_PI || arg(u)<-0.5*M_PI ))
|
||||
u = -u;
|
||||
if ((arg(v)>=0.5*M_PI || arg(v)<-0.5*M_PI ))
|
||||
v = -v;
|
||||
assert(fabs(computeAngle(u, v) - current_angle)<1e-5);
|
||||
|
||||
if ( fabs(arg(u) - arg(v)) >0.5*M_PI )
|
||||
v = -v;
|
||||
assert(fabs(computeAngle(u, v) - current_angle)<1e-5);
|
||||
|
||||
std::complex<typename DerivedV::Scalar> u1, v1;
|
||||
typename DerivedV::Scalar diff = thetaMin*M_PI/180 - current_angle + 1e-6;
|
||||
rotateAroundBisector(u, v, diff, u1, v1);
|
||||
|
||||
// if (computeAngle(u1, v1)<thetaMin*M_PI/180)
|
||||
// {
|
||||
// std::cerr<<"u = ["<<real(u)<<","<<imag(u)<< "]; v= ["<<real(v)<<","<<imag(v)<<"];"<<std::endl;
|
||||
// std::cerr<<"u1 = ["<<real(u1)<<","<<imag(u1)<< "]; v1= ["<<real(v1)<<","<<imag(v1)<<"];"<<std::endl;
|
||||
// std::cerr<<"current_angle = "<<current_angle<<std::endl;
|
||||
// std::cerr<<"aout = "<<computeAngle(u1, v1)<< "; theta= "<<thetaMin*M_PI/180<<";"<<std::endl;
|
||||
// }
|
||||
// assert(computeAngle(u1, v1)>=thetaMin*M_PI/180);
|
||||
|
||||
|
||||
pvU.row(j) << real(u1),imag(u1);
|
||||
pvV.row(j) << real(v1),imag(v1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
//IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
//computeAngles(Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &angles)
|
||||
//{
|
||||
// angles.resize(data.numF,1);
|
||||
// for (int i =0; i<data.numF; ++i)
|
||||
// {
|
||||
// std::complex<typename DerivedV::Scalar> u(pvU(i,0),pvU(i,1));
|
||||
// std::complex<typename DerivedV::Scalar> v(pvV(i,0),pvV(i,1));
|
||||
// angles[i] = fabs(arg(u) - arg(v));
|
||||
// if (angles[i]>M_PI)
|
||||
// angles[i] = 2*M_PI-angles[i];
|
||||
// if (angles[i]>.5*M_PI)
|
||||
// angles[i] = M_PI-angles[i];
|
||||
// }
|
||||
//}
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE typename DerivedV::Scalar igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
computeAngle(const std::complex<typename DerivedV::Scalar> &u,
|
||||
const std::complex<typename DerivedV::Scalar> &v)
|
||||
{
|
||||
typename DerivedV::Scalar angle = std::min(fabs(arg(u*conj(v))), fabs(arg(u*conj(-v))));
|
||||
|
||||
// typename DerivedV::Scalar angle;
|
||||
// typename DerivedV::Scalar a1 = fabs(arg(u*conj(v)));
|
||||
// typename DerivedV::Scalar a2 = fabs(arg(u*conj(-v)));
|
||||
// if (a1 < a2)
|
||||
// angle = a1;
|
||||
// else
|
||||
// {
|
||||
// angle = a2; v = -v;
|
||||
// }
|
||||
|
||||
// typename DerivedV::Scalar angle = fabs(arg(u) - arg(v));
|
||||
// if (angle>M_PI)
|
||||
// {
|
||||
// u = -u;
|
||||
// angle = fabs(arg(u) - arg(v));
|
||||
// };
|
||||
//
|
||||
// if (angle>.5*M_PI)
|
||||
// {
|
||||
// v = -v;
|
||||
// angle = fabs(arg(u) - arg(v));
|
||||
// };
|
||||
//
|
||||
// assert(fabs(angle-angle1)<1e-6);
|
||||
|
||||
// if (angle>M_PI)
|
||||
// angle = 2*M_PI-angle;
|
||||
// if (angle>.5*M_PI)
|
||||
// angle = M_PI-angle;
|
||||
|
||||
// typename DerivedV::Scalar angle = fabs(arg(u) - arg(v));
|
||||
// if (angle>M_PI)
|
||||
// angle = 2*M_PI-angle;
|
||||
// if (angle>.5*M_PI)
|
||||
// angle = M_PI-angle;
|
||||
|
||||
assert(angle <= .5*M_PI && angle >0);
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE int igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
getNumOutOfBounds()
|
||||
{
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> angles;
|
||||
// computeAngles(angles);
|
||||
int numOoB = 0;
|
||||
for (int i =0; i<data.numF; ++i)
|
||||
{
|
||||
std::complex<typename DerivedV::Scalar> u(pvU(i,0),pvU(i,1));
|
||||
std::complex<typename DerivedV::Scalar> v(pvV(i,0),pvV(i,1));
|
||||
typename DerivedV::Scalar angle = computeAngle(u,v);
|
||||
// if (angles[i] <thetaMin*M_PI/180)
|
||||
if (angle <thetaMin*M_PI/180)
|
||||
numOoB ++;
|
||||
}
|
||||
return numOoB;
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
setCoefficientsFromField()
|
||||
{
|
||||
for (int i = 0; i <data.numF; ++i)
|
||||
{
|
||||
std::complex<typename DerivedV::Scalar> u(pvU(i,0),pvU(i,1));
|
||||
std::complex<typename DerivedV::Scalar> v(pvV(i,0),pvV(i,1));
|
||||
Acoeff(i) = u*u+v*v;
|
||||
Bcoeff(i) = u*u*v*v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
globalStep(const Eigen::Matrix<int, Eigen::Dynamic, 1> &isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Ak,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Bk)
|
||||
{
|
||||
setCoefficientsFromField();
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > I;
|
||||
igl::speye(data.numF, data.numF, I);
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > QA = data.DDA+lambda*I;
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > fA = (-2*lambda*Acoeff).sparseView();
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > QB = data.DDB+lambda*I;
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > fB = (-2*lambda*I*Bcoeff).sparseView();
|
||||
|
||||
if(doHardConstraints)
|
||||
{
|
||||
minQuadWithKnownMini(QA, fA, isConstrained, Ak, Acoeff);
|
||||
minQuadWithKnownMini(QB, fB, isConstrained, Bk, Bcoeff);
|
||||
}
|
||||
else
|
||||
{
|
||||
Eigen::Matrix<int, Eigen::Dynamic, 1>isknown_; isknown_.setZero(data.numF,1);
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> xknown_; xknown_.setZero(0,1);
|
||||
minQuadWithKnownMini(QA, fA, isknown_, xknown_, Acoeff);
|
||||
minQuadWithKnownMini(QB, fB, isknown_, xknown_, Bcoeff);
|
||||
}
|
||||
setFieldFromCoefficients();
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
setFieldFromCoefficients()
|
||||
{
|
||||
for (int i = 0; i <data.numF; ++i)
|
||||
{
|
||||
// poly coefficients: 1, 0, -Acoeff, 0, Bcoeff
|
||||
// matlab code from roots (given there are no trailing zeros in the polynomial coefficients)
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> polyCoeff(5,1);
|
||||
polyCoeff<<1., 0., -Acoeff(i), 0., Bcoeff(i);
|
||||
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> roots;
|
||||
polyRoots<std::complex<typename DerivedV::Scalar>>(polyCoeff,roots);
|
||||
|
||||
std::complex<typename DerivedV::Scalar> u = roots[0];
|
||||
int maxi = -1;
|
||||
float maxd = -1;
|
||||
for (int k =1; k<4; ++k)
|
||||
{
|
||||
float dist = abs(roots[k]+u);
|
||||
if (dist>maxd)
|
||||
{
|
||||
maxd = dist;
|
||||
maxi = k;
|
||||
}
|
||||
}
|
||||
std::complex<typename DerivedV::Scalar> v = roots[maxi];
|
||||
pvU(i,0) = real(u); pvU(i,1) = imag(u);
|
||||
pvV(i,0) = real(v); pvV(i,1) = imag(v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
minQuadWithKnownMini(const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &Q,
|
||||
const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &f,
|
||||
const Eigen::VectorXi isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &xknown,
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &x)
|
||||
{
|
||||
int N = Q.rows();
|
||||
|
||||
int nc = xknown.rows();
|
||||
Eigen::VectorXi known; known.setZero(nc,1);
|
||||
Eigen::VectorXi unknown; unknown.setZero(N-nc,1);
|
||||
|
||||
int indk = 0, indu = 0;
|
||||
for (int i = 0; i<N; ++i)
|
||||
if (isConstrained[i])
|
||||
{
|
||||
known[indk] = i;
|
||||
indk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
unknown[indu] = i;
|
||||
indu++;
|
||||
}
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> Quu, Quk;
|
||||
|
||||
igl::slice(Q,unknown, unknown, Quu);
|
||||
igl::slice(Q,unknown, known, Quk);
|
||||
|
||||
|
||||
std::vector<typename Eigen::Triplet<std::complex<typename DerivedV::Scalar> > > tripletList;
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > fu(N-nc,1);
|
||||
|
||||
igl::slice(f,unknown, Eigen::VectorXi::Zero(1,1), fu);
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > rhs = (Quk*xknown).sparseView()+.5*fu;
|
||||
|
||||
Eigen::SparseLU< Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>>> solver;
|
||||
solver.compute(-Quu);
|
||||
if(solver.info()!=Eigen::Success)
|
||||
{
|
||||
std::cerr<<"Decomposition failed!"<<std::endl;
|
||||
return;
|
||||
}
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> b = solver.solve(rhs);
|
||||
if(solver.info()!=Eigen::Success)
|
||||
{
|
||||
std::cerr<<"Solving failed!"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
indk = 0, indu = 0;
|
||||
x.setZero(N,1);
|
||||
for (int i = 0; i<N; ++i)
|
||||
if (isConstrained[i])
|
||||
x[i] = xknown[indk++];
|
||||
else
|
||||
x[i] = b.coeff(indu++,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE bool igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
solve(const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
typename DerivedV::Scalar *lambdaOut)
|
||||
{
|
||||
int numConstrained = isConstrained.sum();
|
||||
// coefficient values
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> Ak, Bk;
|
||||
|
||||
pvU.resize(data.numF,2);
|
||||
pvV.resize(data.numF,2);
|
||||
for (int fi = 0; fi <data.numF; ++fi)
|
||||
{
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b1 = data.B1.row(fi);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b2 = data.B2.row(fi);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &u3 = initialSolution.block(fi,0,1,3);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &v3 = initialSolution.block(fi,3,1,3);
|
||||
pvU.row(fi)<< u3.dot(b1), u3.dot(b2);
|
||||
pvV.row(fi)<< v3.dot(b1), v3.dot(b2);
|
||||
}
|
||||
setCoefficientsFromField();
|
||||
Ak.resize(numConstrained,1);
|
||||
Bk.resize(numConstrained,1);
|
||||
int ind = 0;
|
||||
for (int i = 0; i <data.numF; ++i)
|
||||
{
|
||||
if(isConstrained[i])
|
||||
{
|
||||
Ak(ind) = Acoeff[i];
|
||||
Bk(ind) = Bcoeff[i];
|
||||
ind ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
typename DerivedV::Scalar smoothnessValue;
|
||||
int oob;
|
||||
|
||||
smoothnessValue = (Acoeff.adjoint()*data.DDA*Acoeff + Bcoeff.adjoint()*data.DDB*Bcoeff).real()[0];
|
||||
printf("\n\nInitial smoothness: %.5g\n",smoothnessValue);
|
||||
oob = getNumOutOfBounds();
|
||||
printf("\n\nInitial out-of-bounds: %d\n",oob);
|
||||
printf(" %d %.5g %d\n",-1, smoothnessValue, oob);
|
||||
|
||||
lambda = lambdaInit;
|
||||
for (int iter = 0; iter<maxIter; ++iter)
|
||||
{
|
||||
printf("\n\n--- Iteration %d ---\n",iter);
|
||||
|
||||
localStep();
|
||||
globalStep(isConstrained, Ak, Bk);
|
||||
|
||||
|
||||
smoothnessValue = (Acoeff.adjoint()*data.DDA*Acoeff + Bcoeff.adjoint()*data.DDB*Bcoeff).real()[0];
|
||||
|
||||
printf("Smoothness: %.5g\n",smoothnessValue);
|
||||
|
||||
oob = getNumOutOfBounds();
|
||||
|
||||
bool stoppingCriterion = (oob == 0) ;
|
||||
if (stoppingCriterion)
|
||||
break;
|
||||
lambda = lambda*lambdaMultFactor;
|
||||
// printf(" %d %.5g %d\n",iter, smoothnessValue, oob);
|
||||
|
||||
}
|
||||
|
||||
output.setZero(data.numF,6);
|
||||
for (int fi=0; fi<data.numF; ++fi)
|
||||
{
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b1 = data.B1.row(fi);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b2 = data.B2.row(fi);
|
||||
output.block(fi,0, 1, 3) = pvU(fi,0)*b1 + pvU(fi,1)*b2;
|
||||
output.block(fi,3, 1, 3) = pvV(fi,0)*b1 + pvV(fi,1)*b2;
|
||||
}
|
||||
|
||||
if (lambdaOut)
|
||||
*lambdaOut = lambda;
|
||||
|
||||
|
||||
return (oob==0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE bool igl::angle_bound_frame_fields(const Eigen::PlainObjectBase<DerivedV> &V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &F,
|
||||
const typename DerivedV::Scalar &thetaMin,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int maxIter,
|
||||
const typename DerivedV::Scalar &lambdaInit,
|
||||
const typename DerivedV::Scalar &lambdaMultFactor,
|
||||
const bool doHardConstraints)
|
||||
{
|
||||
igl::AngleBoundFFSolverData<DerivedV, DerivedF> csdata(V, F);
|
||||
igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO> cs(csdata, thetaMin, maxIter, lambdaInit, lambdaMultFactor, doHardConstraints);
|
||||
return (cs.solve(isConstrained, initialSolution, output));
|
||||
}
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE bool igl::angle_bound_frame_fields(const igl::AngleBoundFFSolverData<DerivedV, DerivedF> &csdata,
|
||||
const typename DerivedV::Scalar &thetaMin,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int maxIter,
|
||||
const typename DerivedV::Scalar &lambdaInit,
|
||||
const typename DerivedV::Scalar &lambdaMultFactor,
|
||||
const bool doHardConstraints,
|
||||
typename DerivedV::Scalar *lambdaOut)
|
||||
{
|
||||
igl::AngleBoundFFSolver<DerivedV, DerivedF, DerivedO> cs(csdata, thetaMin, maxIter, lambdaInit, lambdaMultFactor, doHardConstraints);
|
||||
return (cs.solve(isConstrained, initialSolution, output, lambdaOut));
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
#endif
|
||||
@@ -1,61 +0,0 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2014 Olga Diamanti <olga.diam@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#ifndef IGL_ANGLE_BOUND_FRAME_FIELDS_H
|
||||
#define IGL_ANGLE_BOUND_FRAME_FIELDS_H
|
||||
#include "igl_inline.h"
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <vector>
|
||||
|
||||
namespace igl {
|
||||
//todo
|
||||
/// Given 2 vectors centered on origin calculate the rotation matrix from first to the second
|
||||
|
||||
// Inputs:
|
||||
// v0, v1 the two #3 by 1 vectors
|
||||
// normalized boolean, if false, then the vectors are normalized prior to the calculation
|
||||
// Output:
|
||||
// 3 by 3 rotation matrix that takes v0 to v1
|
||||
//
|
||||
template <typename DerivedV, typename DerivedF>
|
||||
class AngleBoundFFSolverData;
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE bool angle_bound_frame_fields(const Eigen::PlainObjectBase<DerivedV> &V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &F,
|
||||
const typename DerivedV::Scalar &thetaMin,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int _maxIter = 50,
|
||||
const typename DerivedV::Scalar &_lambdaInit = 100,
|
||||
const typename DerivedV::Scalar &_lambdaMultFactor = 1.5,
|
||||
const bool _doHardConstraints = false);
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE bool angle_bound_frame_fields(const AngleBoundFFSolverData<DerivedV, DerivedF> &csdata,
|
||||
const typename DerivedV::Scalar &thetaMin,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int _maxIter = 50,
|
||||
const typename DerivedV::Scalar &_lambdaInit = 100,
|
||||
const typename DerivedV::Scalar &_lambdaMultFactor = 1.5,
|
||||
const bool _doHardConstraints = false,
|
||||
typename DerivedV::Scalar *lambdaOut = NULL);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifndef IGL_STATIC_LIBRARY
|
||||
#include "angle_bound_frame_fields.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -34,7 +34,7 @@
|
||||
// defined if no early exit is supported, i.e., always take a fixed number of iterations
|
||||
#define IGL_ARAP_DOF_FIXED_ITERATIONS_COUNT
|
||||
|
||||
// A carefull derivation of this implementation is given in the corresponding
|
||||
// A careful derivation of this implementation is given in the corresponding
|
||||
// matlab function arap_dof.m
|
||||
template <typename LbsMatrixType, typename SSCALAR>
|
||||
IGL_INLINE bool igl::arap_dof_precomputation(
|
||||
@@ -339,7 +339,7 @@ namespace igl
|
||||
}
|
||||
|
||||
// converts CSM_M_SSCALAR[0], CSM_M_SSCALAR[1], CSM_M_SSCALAR[2] into one
|
||||
// "condensed" matrix CSM while checking we're not loosing any information by
|
||||
// "condensed" matrix CSM while checking we're not losing any information by
|
||||
// this process; specifically, returns maximal difference from scaled 3x3
|
||||
// identity blocks, which should be pretty small number
|
||||
template <typename MatrixXS>
|
||||
@@ -449,7 +449,7 @@ namespace igl
|
||||
}
|
||||
|
||||
// converts "Solve1" the "rotations" part of FullSolve matrix (the first part)
|
||||
// into one "condensed" matrix CSolve1 while checking we're not loosing any
|
||||
// into one "condensed" matrix CSolve1 while checking we're not losing any
|
||||
// information by this process; specifically, returns maximal difference from
|
||||
// scaled 3x3 identity blocks, which should be pretty small number
|
||||
template <typename MatrixXS>
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace igl
|
||||
// L0 #handles * dim * dim+1 list of initial guess transformation entries,
|
||||
// also holds fixed transformation entries for fixed handles
|
||||
// max_iters maximum number of iterations
|
||||
// tol stopping critera parameter. If variables (linear transformation
|
||||
// tol stopping criteria parameter. If variables (linear transformation
|
||||
// matrix entries) change by less than 'tol' the optimization terminates,
|
||||
// 0.75 (weak tolerance)
|
||||
// 0.0 (extreme tolerance)
|
||||
|
||||
@@ -34,6 +34,10 @@ IGL_INLINE void igl::barycenter(
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::barycenter<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<float, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::barycenter<Eigen::Matrix<float, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ namespace igl
|
||||
// Ele #Elements by simplex-size list of element indices
|
||||
// b #b boundary indices into V
|
||||
// bc #b by #W list of boundary values
|
||||
// data object containing options, intial guess --> solution and results
|
||||
// data object containing options, initial guess --> solution and results
|
||||
// Outputs:
|
||||
// W #V by #W list of *unnormalized* weights to normalize use
|
||||
// igl::normalize_row_sums(W,W);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace igl
|
||||
// bc #b by 2 list of boundary conditions corresponding to b
|
||||
// Outputs:
|
||||
// U #V by 2 list of output mesh vertex locations
|
||||
// Returns true if and only if U contains a successfull bijectie mapping
|
||||
// Returns true if and only if U contains a successful bijectie mapping
|
||||
//
|
||||
//
|
||||
template <
|
||||
@@ -46,12 +46,12 @@ namespace igl
|
||||
Eigen::PlainObjectBase<DerivedU> & U);
|
||||
//
|
||||
// Inputs:
|
||||
// min_steps mininum number of steps to take from V(b,:) to bc
|
||||
// max_steps mininum number of steps to take from V(b,:) to bc (if
|
||||
// min_steps minimum number of steps to take from V(b,:) to bc
|
||||
// max_steps minimum number of steps to take from V(b,:) to bc (if
|
||||
// max_steps == min_steps then no further number of steps will be tried)
|
||||
// num_inner_iters number of iterations of harmonic solves to run after
|
||||
// for each morph step (to try to push flips back in)
|
||||
// test_for_flips wether to check if flips occured (and trigger more
|
||||
// test_for_flips whether to check if flips occurred (and trigger more
|
||||
// steps). if test_for_flips = false then this function always returns
|
||||
// true
|
||||
//
|
||||
|
||||
@@ -146,7 +146,7 @@ IGL_INLINE bool igl::boundary_conditions(
|
||||
bc(bim[bci[i]],bcj[i]) = bcv[i];
|
||||
}
|
||||
|
||||
// Normalize accross rows so that conditions sum to one
|
||||
// Normalize across rows so that conditions sum to one
|
||||
for(i = 0;i<bc.rows();i++)
|
||||
{
|
||||
double sum = bc.row(i).sum();
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace igl
|
||||
// Template:
|
||||
// Scalar scalar data type for sparse matrices like double or int
|
||||
// Mat matrix type for all matrices (e.g. MatrixXd, SparseMatrix)
|
||||
// MatC matrix type for ouput matrix (e.g. MatrixXd) needs to support
|
||||
// MatC matrix type for output matrix (e.g. MatrixXd) needs to support
|
||||
// resize
|
||||
// Inputs:
|
||||
// A first input matrix
|
||||
|
||||
@@ -61,5 +61,6 @@ template void igl::colon<double, double, double, double>(double, double, double,
|
||||
template void igl::colon<int, int, long>(int, int, Eigen::Matrix<long, -1, 1, 0, -1, 1>&);
|
||||
#ifdef WIN32
|
||||
template void igl::colon<int, long long,long>(int, long long, class Eigen::Matrix<long,-1,1,0,-1,1> &);
|
||||
template void igl::colon<int, __int64, __int64>(int, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+1368
-1396
File diff suppressed because it is too large
Load Diff
+33
-34
@@ -13,61 +13,60 @@
|
||||
#include <Eigen/Dense>
|
||||
|
||||
namespace igl {
|
||||
// Colormap selector -- an interface to supported colormaps within igl
|
||||
|
||||
enum ColorMapType
|
||||
{
|
||||
COLOR_MAP_TYPE_INFERNO = 0,
|
||||
COLOR_MAP_TYPE_JET = 1,
|
||||
COLOR_MAP_TYPE_MAGMA = 2,
|
||||
COLOR_MAP_TYPE_PARULA = 3,
|
||||
COLOR_MAP_TYPE_PLASMA = 4,
|
||||
COLOR_MAP_TYPE_VIRIDIS = 5,
|
||||
NUM_COLOR_MAP_TYPES = 6
|
||||
};
|
||||
// Comput [r,g,b] values of the selected colormap for
|
||||
// a given factor f between 0 and 1
|
||||
//
|
||||
// Inputs:
|
||||
// m number of colors
|
||||
// cm colormap enum
|
||||
// Outputs:
|
||||
// J m by list of RGB colors between 0 and 1
|
||||
//
|
||||
// Wrapper for directly computing [r,g,b] values of the selected colormap for a given factor f between
|
||||
// 0 and 1
|
||||
//
|
||||
// Inputs:
|
||||
// f factor determining color value as if 0 was min and 1 was max
|
||||
// c colormap enum
|
||||
// f factor determining color value as if 0 was min and 1 was max
|
||||
// Outputs:
|
||||
// rgb red, green, blue value
|
||||
template <typename T>
|
||||
IGL_INLINE void colormap(const ColorMapType cm, const T f, T * rgb);
|
||||
// Outputs:
|
||||
// r red value
|
||||
// g green value
|
||||
// b blue value
|
||||
|
||||
enum ColorMapType
|
||||
{
|
||||
CM_INFERNO = 0,
|
||||
CM_JET = 1,
|
||||
CM_MAGMA = 2,
|
||||
CM_PARULA = 3,
|
||||
CM_PLASMA = 4,
|
||||
CM_VIRIDIS = 5
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
IGL_INLINE void colormap(const T f, T * rgb, ColorMapType cm);
|
||||
template <typename T>
|
||||
IGL_INLINE void colormap(const T f, T & r, T & g, T & b, ColorMapType cm);
|
||||
IGL_INLINE void colormap(const ColorMapType cm, const T f, T & r, T & g, T & b);
|
||||
// Inputs:
|
||||
// palette 256 by 3 array of color values
|
||||
template <typename T>
|
||||
IGL_INLINE void colormap(
|
||||
const double palette[256][3], const T x_in, T & r, T & g, T & b);
|
||||
// Inputs:
|
||||
// cm selected colormap palette to interpolate from
|
||||
// Z #Z list of factors
|
||||
// normalize whether to normalize Z to be tightly between [0,1]
|
||||
// cm selected colormap palette to interpolate from
|
||||
// Outputs:
|
||||
// C #C by 3 list of rgb colors
|
||||
template <typename DerivedZ, typename DerivedC>
|
||||
IGL_INLINE void colormap(
|
||||
const Eigen::PlainObjectBase<DerivedZ> & Z,
|
||||
const ColorMapType cm,
|
||||
const Eigen::MatrixBase<DerivedZ> & Z,
|
||||
const bool normalize,
|
||||
Eigen::PlainObjectBase<DerivedC> & C,
|
||||
ColorMapType cm);
|
||||
Eigen::PlainObjectBase<DerivedC> & C);
|
||||
// Inputs:
|
||||
// min_z value at black
|
||||
// max_z value at yellow
|
||||
// min_z value at "0"
|
||||
// max_z value at "1"
|
||||
template <typename DerivedZ, typename DerivedC>
|
||||
IGL_INLINE void colormap(
|
||||
const Eigen::PlainObjectBase<DerivedZ> & Z,
|
||||
const ColorMapType cm,
|
||||
const Eigen::MatrixBase<DerivedZ> & Z,
|
||||
const double min_Z,
|
||||
const double max_Z,
|
||||
Eigen::PlainObjectBase<DerivedC> & C,
|
||||
ColorMapType cm);
|
||||
Eigen::PlainObjectBase<DerivedC> & C);
|
||||
};
|
||||
|
||||
#ifndef IGL_STATIC_LIBRARY
|
||||
|
||||
+44
-10
@@ -1,25 +1,32 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "combine.h"
|
||||
#include <cassert>
|
||||
|
||||
template <
|
||||
typename DerivedVV,
|
||||
typename DerivedFF,
|
||||
typename DerivedV,
|
||||
typename DerivedF>
|
||||
typename DerivedVV,
|
||||
typename DerivedFF,
|
||||
typename DerivedV,
|
||||
typename DerivedF,
|
||||
typename DerivedVsizes,
|
||||
typename DerivedFsizes>
|
||||
IGL_INLINE void igl::combine(
|
||||
const std::vector<DerivedVV> & VV,
|
||||
const std::vector<DerivedFF> & FF,
|
||||
Eigen::PlainObjectBase<DerivedV> & V,
|
||||
Eigen::PlainObjectBase<DerivedF> & F)
|
||||
Eigen::PlainObjectBase<DerivedF> & F,
|
||||
Eigen::PlainObjectBase<DerivedVsizes> & Vsizes,
|
||||
Eigen::PlainObjectBase<DerivedFsizes> & Fsizes)
|
||||
{
|
||||
assert(VV.size() == FF.size() &&
|
||||
assert(VV.size() == FF.size() &&
|
||||
"Lists of verex lists and face lists should be same size");
|
||||
Vsizes.resize(VV.size());
|
||||
Fsizes.resize(FF.size());
|
||||
// Dimension of vertex positions
|
||||
const int dim = VV.size() > 0 ? VV[0].cols() : 0;
|
||||
// Simplex/element size
|
||||
@@ -30,8 +37,10 @@ IGL_INLINE void igl::combine(
|
||||
{
|
||||
const auto & Vi = VV[i];
|
||||
const auto & Fi = FF[i];
|
||||
Vsizes(i) = Vi.rows();
|
||||
n+=Vi.rows();
|
||||
assert(dim == Vi.cols() && "All vertex lists should have same #columns");
|
||||
Fsizes(i) = Fi.rows();
|
||||
m+=Fi.rows();
|
||||
assert(ss == Fi.cols() && "All face lists should have same #columns");
|
||||
}
|
||||
@@ -55,3 +64,28 @@ IGL_INLINE void igl::combine(
|
||||
assert(kf == F.rows());
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename DerivedVV,
|
||||
typename DerivedFF,
|
||||
typename DerivedV,
|
||||
typename DerivedF>
|
||||
IGL_INLINE void igl::combine(
|
||||
const std::vector<DerivedVV> & VV,
|
||||
const std::vector<DerivedFF> & FF,
|
||||
Eigen::PlainObjectBase<DerivedV> & V,
|
||||
Eigen::PlainObjectBase<DerivedF> & F)
|
||||
{
|
||||
Eigen::VectorXi Vsizes,Fsizes;
|
||||
return igl::combine(VV,FF,V,F,Vsizes,Fsizes);
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
template void igl::combine<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1>, Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1> >(std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1> > > const&, std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<unsigned long, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::combine<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3> >(std::vector<Eigen::Matrix<double, -1, 3, 1, -1, 3>, std::allocator<Eigen::Matrix<double, -1, 3, 1, -1, 3> > > const&, std::vector<Eigen::Matrix<int, -1, 3, 1, -1, 3>, std::allocator<Eigen::Matrix<int, -1, 3, 1, -1, 3> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&);
|
||||
#ifdef WIN32
|
||||
template void igl::combine<Eigen::Matrix<double,-1,-1,0,-1,-1>, Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> >(class std::vector<Eigen::Matrix<double,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<double,-1,-1,0,-1,-1> > > const &,class std::vector<Eigen::Matrix<int,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<int,-1,-1,0,-1,-1> > > const &,Eigen::PlainObjectBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &);
|
||||
template void igl::combine<Eigen::Matrix<double,-1,-1,0,-1,-1>, Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<int,-1,-1,0,-1,-1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1>,Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> >(class std::vector<Eigen::Matrix<double,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<double,-1,-1,0,-1,-1> > > const &,class std::vector<Eigen::Matrix<int,-1,-1,0,-1,-1>,class std::allocator<Eigen::Matrix<int,-1,-1,0,-1,-1> > > const &,Eigen::PlainObjectBase<Eigen::Matrix<double,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,-1,0,-1,-1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &,Eigen::PlainObjectBase<Eigen::Matrix<unsigned __int64,-1,1,0,-1,1> > &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+19
-2
@@ -14,8 +14,8 @@
|
||||
|
||||
namespace igl
|
||||
{
|
||||
// Combine k meshes into a single >=k connected component mesh with a single
|
||||
// vertex list and face list. Similar to Maya's Combine operation.
|
||||
// Concatenate k meshes into a single >=k connected component mesh with a
|
||||
// single vertex list and face list. Similar to Maya's Combine operation.
|
||||
//
|
||||
// Inputs:
|
||||
// VV k-long list of lists of mesh vertex positions
|
||||
@@ -26,10 +26,27 @@ namespace igl
|
||||
// vertex positions
|
||||
// F FF[0].rows()+...+FF[k-1].rows() by FF[0].cols() list of mesh faces
|
||||
// indices into V
|
||||
// Vsizes k list so that Vsizes(i) is the #vertices in the ith input
|
||||
// Fsizes k list so that Fsizes(i) is the #faces in the ith input
|
||||
// Example:
|
||||
// // Suppose you have mesh A (VA,FA) and mesh B (VB,FB)
|
||||
// igl::combine<Eigen::MatrixXd,Eigen::MatrixXi>({VA,VB},{FA,FB},V,F);
|
||||
//
|
||||
//
|
||||
template <
|
||||
typename DerivedVV,
|
||||
typename DerivedFF,
|
||||
typename DerivedV,
|
||||
typename DerivedF,
|
||||
typename DerivedVsizes,
|
||||
typename DerivedFsizes>
|
||||
IGL_INLINE void combine(
|
||||
const std::vector<DerivedVV> & VV,
|
||||
const std::vector<DerivedFF> & FF,
|
||||
Eigen::PlainObjectBase<DerivedV> & V,
|
||||
Eigen::PlainObjectBase<DerivedF> & F,
|
||||
Eigen::PlainObjectBase<DerivedVsizes> & Vsizes,
|
||||
Eigen::PlainObjectBase<DerivedFsizes> & Fsizes);
|
||||
template <
|
||||
typename DerivedVV,
|
||||
typename DerivedFF,
|
||||
|
||||
@@ -1,433 +0,0 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2014 Olga Diamanti <olga.diam@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include <igl/conjugate_frame_fields.h>
|
||||
#include <igl/speye.h>
|
||||
#include <igl/slice.h>
|
||||
#include <igl/polyroots.h>
|
||||
#include <Eigen/Sparse>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace igl {
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
class ConjugateFFSolver
|
||||
{
|
||||
public:
|
||||
IGL_INLINE ConjugateFFSolver(const ConjugateFFSolverData<DerivedV, DerivedF> &_data,
|
||||
int _maxIter = 50,
|
||||
const typename DerivedV::Scalar _lambdaOrtho = .1,
|
||||
const typename DerivedV::Scalar _lambdaInit = 100,
|
||||
const typename DerivedV::Scalar _lambdaMultFactor = 1.01,
|
||||
bool _doHardConstraints = true);
|
||||
IGL_INLINE typename DerivedV::Scalar solve(const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output);
|
||||
|
||||
private:
|
||||
|
||||
const ConjugateFFSolverData<DerivedV, DerivedF> &data;
|
||||
|
||||
//polyVF data
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> Acoeff, Bcoeff;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 2> pvU, pvV;
|
||||
typename DerivedV::Scalar lambda;
|
||||
|
||||
//parameters
|
||||
typename DerivedV::Scalar lambdaOrtho;
|
||||
typename DerivedV::Scalar lambdaInit,lambdaMultFactor;
|
||||
int maxIter;
|
||||
bool doHardConstraints;
|
||||
|
||||
IGL_INLINE void localStep();
|
||||
IGL_INLINE void getPolyCoeffsForLocalSolve(const Eigen::Matrix<typename DerivedV::Scalar, 4, 1> &s,
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 4, 1> &z,
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &polyCoeff);
|
||||
|
||||
IGL_INLINE void globalStep(const Eigen::Matrix<int, Eigen::Dynamic, 1> &isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Ak,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Bk);
|
||||
IGL_INLINE void minQuadWithKnownMini(const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &Q,
|
||||
const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &f,
|
||||
const Eigen::VectorXi isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &xknown,
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &x);
|
||||
IGL_INLINE void setFieldFromCoefficients();
|
||||
IGL_INLINE void setCoefficientsFromField();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//Implementation
|
||||
/***************************** Solver ***********************************/
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
ConjugateFFSolver(const ConjugateFFSolverData<DerivedV, DerivedF> &_data,
|
||||
int _maxIter,
|
||||
const typename DerivedV::Scalar _lambdaOrtho,
|
||||
const typename DerivedV::Scalar _lambdaInit,
|
||||
const typename DerivedV::Scalar _lambdaMultFactor,
|
||||
bool _doHardConstraints):
|
||||
data(_data),
|
||||
lambdaOrtho(_lambdaOrtho),
|
||||
lambdaInit(_lambdaInit),
|
||||
maxIter(_maxIter),
|
||||
lambdaMultFactor(_lambdaMultFactor),
|
||||
doHardConstraints(_doHardConstraints)
|
||||
{
|
||||
Acoeff.resize(data.numF,1);
|
||||
Bcoeff.resize(data.numF,1);
|
||||
pvU.setZero(data.numF, 2);
|
||||
pvV.setZero(data.numF, 2);
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
getPolyCoeffsForLocalSolve(const Eigen::Matrix<typename DerivedV::Scalar, 4, 1> &s,
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 4, 1> &z,
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> &polyCoeff)
|
||||
{
|
||||
typename DerivedV::Scalar s0 = s(0);
|
||||
typename DerivedV::Scalar s1 = s(1);
|
||||
typename DerivedV::Scalar s2 = s(2);
|
||||
typename DerivedV::Scalar s3 = s(3);
|
||||
typename DerivedV::Scalar z0 = z(0);
|
||||
typename DerivedV::Scalar z1 = z(1);
|
||||
typename DerivedV::Scalar z2 = z(2);
|
||||
typename DerivedV::Scalar z3 = z(3);
|
||||
|
||||
polyCoeff.resize(7,1);
|
||||
polyCoeff(0) = s0*s0* s1*s1* s2*s2* s3* z3*z3 + s0*s0* s1*s1* s2* s3*s3* z2*z2 + s0*s0* s1* s2*s2* s3*s3* z1*z1 + s0* s1*s1* s2*s2* s3*s3* z0*z0 ;
|
||||
polyCoeff(1) = 2* s0*s0* s1*s1* s2* s3* z2*z2 + 2* s0*s0* s1*s1* s2* s3* z3*z3 + 2* s0*s0* s1* s2*s2* s3* z1*z1 + 2* s0*s0* s1* s2*s2* s3* z3*z3 + 2* s0*s0* s1* s2* s3*s3* z1*z1 + 2* s0*s0* s1* s2* s3*s3* z2*z2 + 2* s0* s1*s1* s2*s2* s3* z0*z0 + 2* s0* s1*s1* s2*s2* s3* z3*z3 + 2* s0* s1*s1* s2* s3*s3* z0*z0 + 2* s0* s1*s1* s2* s3*s3* z2*z2 + 2* s0* s1* s2*s2* s3*s3* z0*z0 + 2* s0* s1* s2*s2* s3*s3* z1*z1 ;
|
||||
polyCoeff(2) = s0*s0* s1*s1* s2* z2*z2 + s0*s0* s1*s1* s3* z3*z3 + s0*s0* s1* s2*s2* z1*z1 + 4* s0*s0* s1* s2* s3* z1*z1 + 4* s0*s0* s1* s2* s3* z2*z2 + 4* s0*s0* s1* s2* s3* z3*z3 + s0*s0* s1* s3*s3* z1*z1 + s0*s0* s2*s2* s3* z3*z3 + s0*s0* s2* s3*s3* z2*z2 + s0* s1*s1* s2*s2* z0*z0 + 4* s0* s1*s1* s2* s3* z0*z0 + 4* s0* s1*s1* s2* s3* z2*z2 + 4* s0* s1*s1* s2* s3* z3*z3 + s0* s1*s1* s3*s3* z0*z0 + 4* s0* s1* s2*s2* s3* z0*z0 + 4* s0* s1* s2*s2* s3* z1*z1 + 4* s0* s1* s2*s2* s3* z3*z3 + 4* s0* s1* s2* s3*s3* z0*z0 + 4* s0* s1* s2* s3*s3* z1*z1 + 4* s0* s1* s2* s3*s3* z2*z2 + s0* s2*s2* s3*s3* z0*z0 + s1*s1* s2*s2* s3* z3*z3 + s1*s1* s2* s3*s3* z2*z2 + s1* s2*s2* s3*s3* z1*z1;
|
||||
polyCoeff(3) = 2* s0*s0* s1* s2* z1*z1 + 2* s0*s0* s1* s2* z2*z2 + 2* s0*s0* s1* s3* z1*z1 + 2* s0*s0* s1* s3* z3*z3 + 2* s0*s0* s2* s3* z2*z2 + 2* s0*s0* s2* s3* z3*z3 + 2* s0* s1*s1* s2* z0*z0 + 2* s0* s1*s1* s2* z2*z2 + 2* s0* s1*s1* s3* z0*z0 + 2* s0* s1*s1* s3* z3*z3 + 2* s0* s1* s2*s2* z0*z0 + 2* s0* s1* s2*s2* z1*z1 + 8* s0* s1* s2* s3* z0*z0 + 8* s0* s1* s2* s3* z1*z1 + 8* s0* s1* s2* s3* z2*z2 + 8* s0* s1* s2* s3* z3*z3 + 2* s0* s1* s3*s3* z0*z0 + 2* s0* s1* s3*s3* z1*z1 + 2* s0* s2*s2* s3* z0*z0 + 2* s0* s2*s2* s3* z3*z3 + 2* s0* s2* s3*s3* z0*z0 + 2* s0* s2* s3*s3* z2*z2 + 2* s1*s1* s2* s3* z2*z2 + 2* s1*s1* s2* s3* z3*z3 + 2* s1* s2*s2* s3* z1*z1 + 2* s1* s2*s2* s3* z3*z3 + 2* s1* s2* s3*s3* z1*z1 + 2* s1* s2* s3*s3* z2*z2 ;
|
||||
polyCoeff(4) = s0*s0* s1* z1*z1 + s0*s0* s2* z2*z2 + s0*s0* s3* z3*z3 + s0* s1*s1* z0*z0 + 4* s0* s1* s2* z0*z0 + 4* s0* s1* s2* z1*z1 + 4* s0* s1* s2* z2*z2 + 4* s0* s1* s3* z0*z0 + 4* s0* s1* s3* z1*z1 + 4* s0* s1* s3* z3*z3 + s0* s2*s2* z0*z0 + 4* s0* s2* s3* z0*z0 + 4* s0* s2* s3* z2*z2 + 4* s0* s2* s3* z3*z3 + s0* s3*s3* z0*z0 + s1*s1* s2* z2*z2 + s1*s1* s3* z3*z3 + s1* s2*s2* z1*z1 + 4* s1* s2* s3* z1*z1 + 4* s1* s2* s3* z2*z2 + 4* s1* s2* s3* z3*z3 + s1* s3*s3* z1*z1 + s2*s2* s3* z3*z3 + s2* s3*s3* z2*z2;
|
||||
polyCoeff(5) = 2* s0* s1* z0*z0 + 2* s0* s1* z1*z1 + 2* s0* s2* z0*z0 + 2* s0* s2* z2*z2 + 2* s0* s3* z0*z0 + 2* s0* s3* z3*z3 + 2* s1* s2* z1*z1 + 2* s1* s2* z2*z2 + 2* s1* s3* z1*z1 + 2* s1* s3* z3*z3 + 2* s2* s3* z2*z2 + 2* s2* s3* z3*z3 ;
|
||||
polyCoeff(6) = s0* z0*z0 + s1* z1*z1 + s2* z2*z2 + s3* z3*z3;
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
localStep()
|
||||
{
|
||||
for (int j =0; j<data.numF; ++j)
|
||||
{
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 1> xproj; xproj << pvU.row(j).transpose(),pvV.row(j).transpose();
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 1> z = data.UH[j].transpose()*xproj;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 1> x;
|
||||
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> polyCoeff;
|
||||
getPolyCoeffsForLocalSolve(data.s[j], z, polyCoeff);
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> roots;
|
||||
igl::polyRoots<typename DerivedV::Scalar, typename DerivedV::Scalar> (polyCoeff, roots );
|
||||
|
||||
// find closest real root to xproj
|
||||
typename DerivedV::Scalar minDist = 1e10;
|
||||
for (int i =0; i< 6; ++i)
|
||||
{
|
||||
if (fabs(imag(roots[i]))>1e-10)
|
||||
continue;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 4> D = ((Eigen::Matrix<typename DerivedV::Scalar, 4, 1>::Ones()+real(roots(i))*data.s[j]).array().inverse()).matrix().asDiagonal();
|
||||
Eigen::Matrix<typename DerivedV::Scalar, 4, 1> candidate = data.UH[j]*D*z;
|
||||
typename DerivedV::Scalar dist = (candidate-xproj).norm();
|
||||
if (dist<minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
x = candidate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pvU.row(j) << x(0),x(1);
|
||||
pvV.row(j) << x(2),x(3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
setCoefficientsFromField()
|
||||
{
|
||||
for (int i = 0; i <data.numF; ++i)
|
||||
{
|
||||
std::complex<typename DerivedV::Scalar> u(pvU(i,0),pvU(i,1));
|
||||
std::complex<typename DerivedV::Scalar> v(pvV(i,0),pvV(i,1));
|
||||
Acoeff(i) = u*u+v*v;
|
||||
Bcoeff(i) = u*u*v*v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
globalStep(const Eigen::Matrix<int, Eigen::Dynamic, 1> &isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Ak,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &Bk)
|
||||
{
|
||||
setCoefficientsFromField();
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > I;
|
||||
igl::speye(data.numF, data.numF, I);
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > QA = data.DDA+lambda*data.planarityWeight+lambdaOrtho*I;
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > fA = (-2*lambda*data.planarityWeight*Acoeff).sparseView();
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > QB = data.DDB+lambda*data.planarityWeight;
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > fB = (-2*lambda*data.planarityWeight*Bcoeff).sparseView();
|
||||
|
||||
if(doHardConstraints)
|
||||
{
|
||||
minQuadWithKnownMini(QA, fA, isConstrained, Ak, Acoeff);
|
||||
minQuadWithKnownMini(QB, fB, isConstrained, Bk, Bcoeff);
|
||||
}
|
||||
else
|
||||
{
|
||||
Eigen::Matrix<int, Eigen::Dynamic, 1>isknown_; isknown_.setZero(data.numF,1);
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> xknown_; xknown_.setZero(0,1);
|
||||
minQuadWithKnownMini(QA, fA, isknown_, xknown_, Acoeff);
|
||||
minQuadWithKnownMini(QB, fB, isknown_, xknown_, Bcoeff);
|
||||
}
|
||||
setFieldFromCoefficients();
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
setFieldFromCoefficients()
|
||||
{
|
||||
for (int i = 0; i <data.numF; ++i)
|
||||
{
|
||||
// poly coefficients: 1, 0, -Acoeff, 0, Bcoeff
|
||||
// matlab code from roots (given there are no trailing zeros in the polynomial coefficients)
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> polyCoeff(5,1);
|
||||
polyCoeff<<1., 0., -Acoeff(i), 0., Bcoeff(i);
|
||||
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> roots;
|
||||
polyRoots<std::complex<typename DerivedV::Scalar>>(polyCoeff,roots);
|
||||
|
||||
std::complex<typename DerivedV::Scalar> u = roots[0];
|
||||
int maxi = -1;
|
||||
float maxd = -1;
|
||||
for (int k =1; k<4; ++k)
|
||||
{
|
||||
float dist = abs(roots[k]+u);
|
||||
if (dist>maxd)
|
||||
{
|
||||
maxd = dist;
|
||||
maxi = k;
|
||||
}
|
||||
}
|
||||
std::complex<typename DerivedV::Scalar> v = roots[maxi];
|
||||
pvU(i,0) = real(u); pvU(i,1) = imag(u);
|
||||
pvV(i,0) = real(v); pvV(i,1) = imag(v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
minQuadWithKnownMini(const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &Q,
|
||||
const Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > &f,
|
||||
const Eigen::VectorXi isConstrained,
|
||||
const Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &xknown,
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> &x)
|
||||
{
|
||||
int N = Q.rows();
|
||||
|
||||
int nc = xknown.rows();
|
||||
Eigen::VectorXi known; known.setZero(nc,1);
|
||||
Eigen::VectorXi unknown; unknown.setZero(N-nc,1);
|
||||
|
||||
int indk = 0, indu = 0;
|
||||
for (int i = 0; i<N; ++i)
|
||||
if (isConstrained[i])
|
||||
{
|
||||
known[indk] = i;
|
||||
indk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
unknown[indu] = i;
|
||||
indu++;
|
||||
}
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> Quu, Quk;
|
||||
|
||||
igl::slice(Q,unknown, unknown, Quu);
|
||||
igl::slice(Q,unknown, known, Quk);
|
||||
|
||||
|
||||
std::vector<typename Eigen::Triplet<std::complex<typename DerivedV::Scalar> > > tripletList;
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > fu(N-nc,1);
|
||||
|
||||
igl::slice(f,unknown, Eigen::VectorXi::Zero(1,1), fu);
|
||||
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar> > rhs = (Quk*xknown).sparseView()+.5*fu;
|
||||
|
||||
Eigen::SparseLU< Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>>> solver;
|
||||
solver.compute(-Quu);
|
||||
if(solver.info()!=Eigen::Success)
|
||||
{
|
||||
std::cerr<<"Decomposition failed!"<<std::endl;
|
||||
return;
|
||||
}
|
||||
Eigen::SparseMatrix<std::complex<typename DerivedV::Scalar>> b = solver.solve(rhs);
|
||||
if(solver.info()!=Eigen::Success)
|
||||
{
|
||||
std::cerr<<"Solving failed!"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
indk = 0, indu = 0;
|
||||
x.setZero(N,1);
|
||||
for (int i = 0; i<N; ++i)
|
||||
if (isConstrained[i])
|
||||
x[i] = xknown[indk++];
|
||||
else
|
||||
x[i] = b.coeff(indu++,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE typename DerivedV::Scalar igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO>::
|
||||
solve(const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output)
|
||||
{
|
||||
int numConstrained = isConstrained.sum();
|
||||
// coefficient values
|
||||
Eigen::Matrix<std::complex<typename DerivedV::Scalar>, Eigen::Dynamic, 1> Ak, Bk;
|
||||
|
||||
pvU.resize(data.numF,2);
|
||||
pvV.resize(data.numF,2);
|
||||
for (int fi = 0; fi <data.numF; ++fi)
|
||||
{
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b1 = data.B1.row(fi);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b2 = data.B2.row(fi);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &u3 = initialSolution.block(fi,0,1,3);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &v3 = initialSolution.block(fi,3,1,3);
|
||||
pvU.row(fi)<< u3.dot(b1), u3.dot(b2);
|
||||
pvV.row(fi)<< v3.dot(b1), v3.dot(b2);
|
||||
}
|
||||
setCoefficientsFromField();
|
||||
Ak.resize(numConstrained,1);
|
||||
Bk.resize(numConstrained,1);
|
||||
int ind = 0;
|
||||
for (int i = 0; i <data.numF; ++i)
|
||||
{
|
||||
if(isConstrained[i])
|
||||
{
|
||||
Ak(ind) = Acoeff[i];
|
||||
Bk(ind) = Bcoeff[i];
|
||||
ind ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
typename DerivedV::Scalar smoothnessValue;
|
||||
Eigen::Matrix<typename DerivedV::Scalar, Eigen::Dynamic, 1> conjValues;
|
||||
typename DerivedV::Scalar meanConj;
|
||||
typename DerivedV::Scalar maxConj;
|
||||
|
||||
data.evaluateConjugacy(pvU, pvV, conjValues);
|
||||
meanConj = conjValues.cwiseAbs().mean();
|
||||
maxConj = conjValues.cwiseAbs().maxCoeff();
|
||||
printf("Initial max non-conjugacy: %.5g\n",maxConj);
|
||||
|
||||
smoothnessValue = (Acoeff.adjoint()*data.DDA*Acoeff + Bcoeff.adjoint()*data.DDB*Bcoeff).real()[0];
|
||||
printf("\n\nInitial smoothness: %.5g\n",smoothnessValue);
|
||||
|
||||
lambda = lambdaInit;
|
||||
|
||||
bool doit = false;
|
||||
for (int iter = 0; iter<maxIter; ++iter)
|
||||
{
|
||||
printf("\n\n--- Iteration %d ---\n",iter);
|
||||
|
||||
typename DerivedV::Scalar oldMeanConj = meanConj;
|
||||
|
||||
localStep();
|
||||
globalStep(isConstrained, Ak, Bk);
|
||||
|
||||
|
||||
smoothnessValue = (Acoeff.adjoint()*data.DDA*Acoeff + Bcoeff.adjoint()*data.DDB*Bcoeff).real()[0];
|
||||
|
||||
printf("Smoothness: %.5g\n",smoothnessValue);
|
||||
|
||||
data.evaluateConjugacy(pvU, pvV, conjValues);
|
||||
meanConj = conjValues.cwiseAbs().mean();
|
||||
maxConj = conjValues.cwiseAbs().maxCoeff();
|
||||
printf("Mean/Max non-conjugacy: %.5g, %.5g\n",meanConj,maxConj);
|
||||
typename DerivedV::Scalar diffMeanConj = fabs(oldMeanConj-meanConj);
|
||||
|
||||
if (diffMeanConj<1e-4)
|
||||
doit = true;
|
||||
|
||||
if (doit)
|
||||
lambda = lambda*lambdaMultFactor;
|
||||
printf(" %d %.5g %.5g\n",iter, smoothnessValue,maxConj);
|
||||
|
||||
}
|
||||
|
||||
output.setZero(data.numF,6);
|
||||
for (int fi=0; fi<data.numF; ++fi)
|
||||
{
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b1 = data.B1.row(fi);
|
||||
const Eigen::Matrix<typename DerivedV::Scalar, 1, 3> &b2 = data.B2.row(fi);
|
||||
output.block(fi,0, 1, 3) = pvU(fi,0)*b1 + pvU(fi,1)*b2;
|
||||
output.block(fi,3, 1, 3) = pvV(fi,0)*b1 + pvV(fi,1)*b2;
|
||||
}
|
||||
|
||||
return lambda;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void igl::conjugate_frame_fields(const Eigen::PlainObjectBase<DerivedV> &V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &F,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int maxIter,
|
||||
const typename DerivedV::Scalar lambdaOrtho,
|
||||
const typename DerivedV::Scalar lambdaInit,
|
||||
const typename DerivedV::Scalar lambdaMultFactor,
|
||||
bool doHardConstraints)
|
||||
{
|
||||
igl::ConjugateFFSolverData<DerivedV, DerivedF> csdata(V, F);
|
||||
igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO> cs(csdata, maxIter, lambdaOrtho, lambdaInit, lambdaMultFactor, doHardConstraints);
|
||||
cs.solve(isConstrained, initialSolution, output);
|
||||
}
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE typename DerivedV::Scalar igl::conjugate_frame_fields(const igl::ConjugateFFSolverData<DerivedV, DerivedF> &csdata,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int maxIter,
|
||||
const typename DerivedV::Scalar lambdaOrtho,
|
||||
const typename DerivedV::Scalar lambdaInit,
|
||||
const typename DerivedV::Scalar lambdaMultFactor,
|
||||
bool doHardConstraints)
|
||||
{
|
||||
igl::ConjugateFFSolver<DerivedV, DerivedF, DerivedO> cs(csdata, maxIter, lambdaOrtho, lambdaInit, lambdaMultFactor, doHardConstraints);
|
||||
typename DerivedV::Scalar lambdaOut = cs.solve(isConstrained, initialSolution, output);
|
||||
return lambdaOut;
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
template Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar igl::conjugate_frame_fields<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(igl::ConjugateFFSolverData<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, int, Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, Eigen::Matrix<double, -1, -1, 0, -1, -1>::Scalar, bool);
|
||||
#endif
|
||||
@@ -1,52 +0,0 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2014 Olga Diamanti <olga.diam@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#ifndef IGL_CONJUGATE_FRAME_FIELDS_H
|
||||
#define IGL_CONJUGATE_FRAME_FIELDS_H
|
||||
#include "igl_inline.h"
|
||||
#include "ConjugateFFSolverData.h"
|
||||
#include <Eigen/Core>
|
||||
#include <vector>
|
||||
|
||||
namespace igl {
|
||||
//todo
|
||||
// TODO: isConstrained should become a list of indices for consistency with
|
||||
// n_polyvector
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE void conjugate_frame_fields(const Eigen::PlainObjectBase<DerivedV> &V,
|
||||
const Eigen::PlainObjectBase<DerivedF> &F,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int _maxIter = 50,
|
||||
const typename DerivedV::Scalar _lambdaOrtho = .1,
|
||||
const typename DerivedV::Scalar _lambdaInit = 100,
|
||||
const typename DerivedV::Scalar _lambdaMultFactor = 1.01,
|
||||
bool _doHardConstraints = true);
|
||||
|
||||
template <typename DerivedV, typename DerivedF, typename DerivedO>
|
||||
IGL_INLINE typename DerivedV::Scalar conjugate_frame_fields(const ConjugateFFSolverData<DerivedV, DerivedF> &csdata,
|
||||
const Eigen::VectorXi &isConstrained,
|
||||
const Eigen::PlainObjectBase<DerivedO> &initialSolution,
|
||||
Eigen::PlainObjectBase<DerivedO> &output,
|
||||
int _maxIter = 50,
|
||||
const typename DerivedV::Scalar _lambdaOrtho = .1,
|
||||
const typename DerivedV::Scalar _lambdaInit = 100,
|
||||
const typename DerivedV::Scalar _lambdaMultFactor = 1.01,
|
||||
bool _doHardConstraints = true);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifndef IGL_STATIC_LIBRARY
|
||||
#include "conjugate_frame_fields.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <Eigen/Core>
|
||||
namespace igl
|
||||
{
|
||||
// Connect all boundary edges to a ficticious point at infinity.
|
||||
// Connect all boundary edges to a fictitious point at infinity.
|
||||
//
|
||||
// Inputs:
|
||||
// F #F by 3 list of face indices into some V
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_CGAL_INCLUDES_H
|
||||
#define IGL_CGAL_INCLUDES_H
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace igl
|
||||
// a 2-manifold.
|
||||
// A: But! It seems we could use CGAL::Triangulation_3. Though it won't be easy
|
||||
// to take advantage of functions like insert_in_facet because we want to
|
||||
// constrain segments. Hmmm. Actualy Triangulation_3 doesn't look right...
|
||||
// constrain segments. Hmmm. Actually Triangulation_3 doesn't look right...
|
||||
|
||||
// CGAL's box_self_intersection_d uses C-style function callbacks without
|
||||
// userdata. This is a leapfrog method for calling a member function. It should
|
||||
|
||||
@@ -49,6 +49,10 @@ igl::copyleft::cgal::assign(
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::assign<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<double, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::assign<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::assign<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::assign<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "assign_scalar.h"
|
||||
|
||||
@@ -97,3 +97,40 @@ IGL_INLINE void igl::copyleft::cgal::assign_scalar(
|
||||
d = next;
|
||||
} while (d < float(interval.second));
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
IGL_INLINE void igl::copyleft::cgal::assign_scalar(
|
||||
const CGAL::Simple_cartesian<mpq_class>::FT & cgal,
|
||||
CGAL::Simple_cartesian<mpq_class>::FT & d)
|
||||
{
|
||||
d = cgal;
|
||||
}
|
||||
|
||||
IGL_INLINE void igl::copyleft::cgal::assign_scalar(
|
||||
const CGAL::Simple_cartesian<mpq_class>::FT & cgal,
|
||||
double & d)
|
||||
{
|
||||
const auto interval = CGAL::to_interval(cgal);
|
||||
d = interval.first;
|
||||
do {
|
||||
const double next = nextafter(d, interval.second);
|
||||
if (CGAL::abs(cgal-d) < CGAL::abs(cgal-next)) break;
|
||||
d = next;
|
||||
} while (d < interval.second);
|
||||
}
|
||||
|
||||
IGL_INLINE void igl::copyleft::cgal::assign_scalar(
|
||||
const CGAL::Simple_cartesian<mpq_class>::FT & cgal,
|
||||
float& d)
|
||||
{
|
||||
const auto interval = CGAL::to_interval(cgal);
|
||||
d = interval.first;
|
||||
do {
|
||||
const float next = nextafter(d, float(interval.second));
|
||||
if (CGAL::abs(cgal-d) < CGAL::abs(cgal-next)) break;
|
||||
d = next;
|
||||
} while (d < float(interval.second));
|
||||
}
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_COPYLEFT_CGAL_ASSIGN_SCALAR_H
|
||||
#define IGL_COPYLEFT_CGAL_ASSIGN_SCALAR_H
|
||||
#include "../../igl_inline.h"
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
|
||||
#ifndef WIN32
|
||||
#include <CGAL/gmpxx.h>
|
||||
#endif
|
||||
|
||||
namespace igl
|
||||
{
|
||||
namespace copyleft
|
||||
@@ -38,6 +42,7 @@ namespace igl
|
||||
IGL_INLINE void assign_scalar(
|
||||
const float& c,
|
||||
double& d);
|
||||
|
||||
IGL_INLINE void assign_scalar(
|
||||
const CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt::FT & cgal,
|
||||
CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt::FT & d);
|
||||
@@ -47,6 +52,19 @@ namespace igl
|
||||
IGL_INLINE void assign_scalar(
|
||||
const CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt::FT & cgal,
|
||||
float& d);
|
||||
|
||||
#ifndef WIN32
|
||||
IGL_INLINE void assign_scalar(
|
||||
const CGAL::Simple_cartesian<mpq_class>::FT & cgal,
|
||||
CGAL::Simple_cartesian<mpq_class>::FT & d);
|
||||
IGL_INLINE void assign_scalar(
|
||||
const CGAL::Simple_cartesian<mpq_class>::FT & cgal,
|
||||
double & d);
|
||||
IGL_INLINE void assign_scalar(
|
||||
const CGAL::Simple_cartesian<mpq_class>::FT & cgal,
|
||||
float& d);
|
||||
#endif // WIN32
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,7 @@ IGL_INLINE void igl::copyleft::cgal::cell_adjacency(
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
template void igl::copyleft::cgal::cell_adjacency<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, std::vector<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> > >, std::allocator<std::set<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long>, std::less<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> >, std::allocator<std::tuple<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, bool, unsigned long> > > > >&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::cell_adjacency<class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, class std::vector<class std::set<class std::tuple<int, bool, unsigned __int64>, struct std::less<class std::tuple<int, bool, unsigned __int64>>, class std::allocator<class std::tuple<int, bool, unsigned __int64>>>, class std::allocator<class std::set<class std::tuple<int, bool, unsigned __int64>, struct std::less<class std::tuple<int, bool, unsigned __int64>>, class std::allocator<class std::tuple<int, bool, unsigned __int64>>>>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace igl
|
||||
// num_cells number of cells.
|
||||
//
|
||||
// Outputs:
|
||||
// adjacency_list #C array of list of adjcent cell informations. If
|
||||
// adjacency_list #C array of list of adjcent cell information. If
|
||||
// cell i and cell j are adjacent via patch x, where i
|
||||
// is on the positive side of x, and j is on the
|
||||
// negative side. Then,
|
||||
|
||||
@@ -124,7 +124,7 @@ IGL_INLINE void igl::copyleft::cgal::closest_facet(
|
||||
case CGAL::COPLANAR:
|
||||
// Warning:
|
||||
// This can only happen if fid contains a boundary edge.
|
||||
// Catergorized this ambiguous case as negative side.
|
||||
// Categorized this ambiguous case as negative side.
|
||||
return false;
|
||||
default:
|
||||
throw std::runtime_error("Unknown CGAL state.");
|
||||
@@ -496,4 +496,9 @@ template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Lazy_exact_
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, CGAL::Epeck, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, CGAL::AABB_tree<CGAL::AABB_traits<CGAL::Epeck, CGAL::AABB_triangle_primitive<CGAL::Epeck, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> >::iterator, CGAL::Boolean_tag<false> > > > const&, std::vector<CGAL::Epeck::Triangle_3, std::allocator<CGAL::Epeck::Triangle_3> > const&, std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::closest_facet<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::closest_facet<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class CGAL::Epeck, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class CGAL::AABB_tree<class CGAL::AABB_traits<class CGAL::Epeck, class CGAL::AABB_triangle_primitive<class CGAL::Epeck, class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class CGAL::Triangle_3<class CGAL::Epeck>>>>, struct CGAL::Boolean_tag<0>>>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epeck>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epeck>>> const &, class std::vector<bool, class std::allocator<bool>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::closest_facet<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class CGAL::Epeck, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class CGAL::AABB_tree<class CGAL::AABB_traits<class CGAL::Epeck, class CGAL::AABB_triangle_primitive<class CGAL::Epeck, class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class CGAL::Triangle_3<class CGAL::Epeck>>>>, struct CGAL::Boolean_tag<0>>>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epeck>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epeck>>> const &, class std::vector<bool, class std::allocator<bool>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::closest_facet<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class CGAL::Epeck, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class CGAL::AABB_tree<class CGAL::AABB_traits<class CGAL::Epeck, class CGAL::AABB_triangle_primitive<class CGAL::Epeck, class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class CGAL::Triangle_3<class CGAL::Epeck>>>>, struct CGAL::Boolean_tag<0>>>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epeck>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epeck>>> const &, class std::vector<bool, class std::allocator<bool>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -539,4 +539,9 @@ template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::La
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
||||
template unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
||||
#ifdef WIN32
|
||||
template unsigned __int64 igl::copyleft::cgal::extract_cells<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
|
||||
template unsigned __int64 igl::copyleft::cgal::extract_cells<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
|
||||
template unsigned __int64 igl::copyleft::cgal::extract_cells<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -113,6 +113,8 @@ IGL_INLINE void igl::copyleft::cgal::half_space_box(
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<double, -1, 3, 1, -1, 3> >(CGAL::Plane_3<CGAL::Epeck> const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<float, -1, 3, 1, -1, 3> >(CGAL::Plane_3<CGAL::Epeck> const&, Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
|
||||
template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 1, 4, 1, 1, 4>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
|
||||
template void igl::copyleft::cgal::half_space_box<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 1, 4, 1, 1, 4>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 4, 0, -1, 4> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 1, 4, 1, 1, 4> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 4, 0, -1, 4> > const&, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>&, Eigen::Matrix<int, 12, 3, 0, 12, 3>&);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2016 Alec Jacobson
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "insert_into_cdt.h"
|
||||
#include <CGAL/Point_3.h>
|
||||
@@ -22,30 +22,30 @@ IGL_INLINE void igl::copyleft::cgal::insert_into_cdt(
|
||||
CGAL::Constrained_triangulation_face_base_2< Kernel>
|
||||
>,
|
||||
CGAL::Exact_intersections_tag
|
||||
>
|
||||
>
|
||||
>
|
||||
>
|
||||
& cdt)
|
||||
{
|
||||
typedef CGAL::Point_3<Kernel> Point_3;
|
||||
typedef CGAL::Segment_3<Kernel> Segment_3;
|
||||
typedef CGAL::Triangle_3<Kernel> Triangle_3;
|
||||
typedef CGAL::Segment_3<Kernel> Segment_3;
|
||||
typedef CGAL::Triangle_3<Kernel> Triangle_3;
|
||||
|
||||
if(const Segment_3 *iseg = CGAL::object_cast<Segment_3 >(&obj))
|
||||
if(const Segment_3 *iseg = CGAL::object_cast<Segment_3 >(&obj))
|
||||
{
|
||||
// Add segment constraint
|
||||
cdt.insert_constraint( P.to_2d(iseg->vertex(0)),P.to_2d(iseg->vertex(1)));
|
||||
}else if(const Point_3 *ipoint = CGAL::object_cast<Point_3 >(&obj))
|
||||
}else if(const Point_3 *ipoint = CGAL::object_cast<Point_3 >(&obj))
|
||||
{
|
||||
// Add point
|
||||
cdt.insert(P.to_2d(*ipoint));
|
||||
} else if(const Triangle_3 *itri = CGAL::object_cast<Triangle_3 >(&obj))
|
||||
} else if(const Triangle_3 *itri = CGAL::object_cast<Triangle_3 >(&obj))
|
||||
{
|
||||
// Add 3 segment constraints
|
||||
cdt.insert_constraint( P.to_2d(itri->vertex(0)),P.to_2d(itri->vertex(1)));
|
||||
cdt.insert_constraint( P.to_2d(itri->vertex(1)),P.to_2d(itri->vertex(2)));
|
||||
cdt.insert_constraint( P.to_2d(itri->vertex(2)),P.to_2d(itri->vertex(0)));
|
||||
} else if(const std::vector<Point_3 > *polyp =
|
||||
CGAL::object_cast< std::vector<Point_3 > >(&obj))
|
||||
} else if(const std::vector<Point_3 > *polyp =
|
||||
CGAL::object_cast< std::vector<Point_3 > >(&obj))
|
||||
{
|
||||
const std::vector<Point_3 > & poly = *polyp;
|
||||
const size_t m = poly.size();
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2016 Alec Jacobson
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_COPYLEFT_CGAL_INSERT_INTO_CDT_H
|
||||
#define IGL_COPYLEFT_CGAL_INSERT_INTO_CDT_H
|
||||
#include "../../igl_inline.h"
|
||||
|
||||
#include <CGAL/double.h> // Workaround https://github.com/CGAL/cgal/issues/2182 with CGAL 4.10-1
|
||||
#include <CGAL/Plane_3.h>
|
||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Constrained_triangulation_plus_2.h>
|
||||
@@ -33,7 +34,7 @@ namespace igl
|
||||
// cdt current CDT, see output
|
||||
// Outputs:
|
||||
// cdt CDT updated to contain constraints for the given object
|
||||
//
|
||||
//
|
||||
template <typename Kernel>
|
||||
IGL_INLINE void insert_into_cdt(
|
||||
const CGAL::Object & obj,
|
||||
@@ -46,8 +47,8 @@ namespace igl
|
||||
CGAL::Constrained_triangulation_face_base_2< Kernel>
|
||||
>,
|
||||
CGAL::Exact_intersections_tag
|
||||
>
|
||||
>
|
||||
>
|
||||
>
|
||||
& cdt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,6 @@
|
||||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#ifdef MEX
|
||||
# include <mex.h>
|
||||
# include <cassert>
|
||||
# undef assert
|
||||
# define assert( isOK ) ( (isOK) ? (void)0 : (void) mexErrMsgTxt(C_STR(__FILE__<<":"<<__LINE__<<": failed assertion `"<<#isOK<<"'"<<std::endl) ) )
|
||||
#endif
|
||||
|
||||
namespace igl
|
||||
{
|
||||
namespace copyleft
|
||||
|
||||
@@ -78,6 +78,10 @@ IGL_INLINE bool igl::copyleft::cgal::intersect_with_half_space(
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::intersect_with_half_space<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::intersect_with_half_space<Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, 1, 3, 1, 1, 3> const>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<double>, Eigen::Matrix<double, 1, 3, 1, 1, 3> const> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::intersect_with_half_space<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<float, 1, 3, 1, 1, 3>, Eigen::Matrix<float, 1, 3, 1, 1, 3>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::intersect_with_half_space<Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<float, 1, 3, 1, 1, 3>, Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<float>, Eigen::Matrix<float, 1, 3, 1, 1, 3> const>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op<float>, Eigen::Matrix<float, 1, 3, 1, 1, 3> const> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "relabel_small_immersed_cells.h"
|
||||
#include "remesh_self_intersections.h"
|
||||
#include "string_to_mesh_boolean_type.h"
|
||||
#include "../../combine.h"
|
||||
#include "../../cumsum.h"
|
||||
#include "../../extract_manifold_patches.h"
|
||||
#include "../../get_seconds.h"
|
||||
@@ -137,33 +138,11 @@ IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
|
||||
Eigen::PlainObjectBase<DerivedFC > & FC,
|
||||
Eigen::PlainObjectBase<DerivedJ > & J)
|
||||
{
|
||||
assert(Flist.size() == Vlist.size() && "#Vlist and #Flist should match");
|
||||
const size_t num_inputs = Vlist.size();
|
||||
// Gather sizes
|
||||
Eigen::Matrix<size_t,Eigen::Dynamic,1> sizes(num_inputs);
|
||||
int numf = 0;
|
||||
int numv = 0;
|
||||
for(int i = 0;i<num_inputs;i++)
|
||||
{
|
||||
sizes(i) = Flist[i].rows();
|
||||
numf += Flist[i].rows();
|
||||
numv += Vlist[i].rows();
|
||||
}
|
||||
// Combined mesh
|
||||
DerivedV VV(numv,3);
|
||||
DerivedF FF(numf,3);
|
||||
{
|
||||
int fk = 0;
|
||||
int vk = 0;
|
||||
for(int i = 0;i<num_inputs;i++)
|
||||
{
|
||||
FF.block(fk,0,Flist[i].rows(),3) = Flist[i].array() + vk;
|
||||
fk += Flist[i].rows();
|
||||
VV.block(vk,0,Vlist[i].rows(),3) = Vlist[i];
|
||||
vk += Vlist[i].rows();
|
||||
}
|
||||
}
|
||||
return mesh_boolean(VV,FF,sizes,wind_num_op,keep,VC,FC,J);
|
||||
DerivedV VV;
|
||||
DerivedF FF;
|
||||
Eigen::Matrix<size_t,Eigen::Dynamic,1> Vsizes,Fsizes;
|
||||
igl::combine(Vlist,Flist,VV,FF,Vsizes,Fsizes);
|
||||
return mesh_boolean(VV,FF,Fsizes,wind_num_op,keep,VC,FC,J);
|
||||
}
|
||||
|
||||
template <
|
||||
@@ -432,6 +411,10 @@ IGL_INLINE bool igl::copyleft::cgal::mesh_boolean(
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, 12, 3, 0, 12, 3>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, 12, 3, 0, 12, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
@@ -452,4 +435,7 @@ template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_n
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, 12, 3, 0, 12, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, 12, 3, 0, 12, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
||||
template bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1> > > const&, std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1> > > const&, std::function<int (Eigen::Matrix<int, 1, -1, 1, 1, -1>)> const&, std::function<int (int, int)> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
#ifdef WIN32
|
||||
template bool igl::copyleft::cgal::mesh_boolean<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, enum igl::MeshBooleanType const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -106,6 +106,7 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
|
||||
vJ[ee].resize(vG[ee].rows(),2);
|
||||
vJ[ee].col(0) = eJ.array() + (FA.rows()+1);
|
||||
vJ[ee].col(1).setConstant(ee);
|
||||
offsets[ee+1] = offsets[ee] + vW[ee].rows();
|
||||
}
|
||||
// Combine meshes
|
||||
int n=0,m=0;
|
||||
@@ -141,7 +142,7 @@ IGL_INLINE void igl::copyleft::cgal::minkowski_sum(
|
||||
W,
|
||||
G,
|
||||
SJ);
|
||||
J = slice(DerivedJ(J),SJ,1);
|
||||
slice(DerivedJ(J),SJ,1,J);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -414,4 +414,15 @@ template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, unsigned long, std::vector<int, std::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &, bool);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &, bool);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &, bool);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 0, -1, 3>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::order_facets_around_edge<class Eigen::Matrix<double, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 0, -1, 3>> const &, unsigned __int64, unsigned __int64, class std::vector<int, class std::allocator<int>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace igl
|
||||
// V #V by 3 list of vertices.
|
||||
// F #F by 3 list of faces
|
||||
// s Index of source vertex.
|
||||
// d Index of desination vertex.
|
||||
// d Index of destination vertex.
|
||||
// adj_faces List of adjacent face signed indices.
|
||||
// Output:
|
||||
// order List of face indices that orders adjacent faces around edge
|
||||
@@ -50,7 +50,7 @@ namespace igl
|
||||
Eigen::PlainObjectBase<DerivedI>& order,
|
||||
bool debug=false);
|
||||
|
||||
// This funciton is a wrapper around the one above. Since the ordering
|
||||
// This function is a wrapper around the one above. Since the ordering
|
||||
// is circular, the pivot point is used to define a starting point. So
|
||||
// order[0] is the index into adj_face that is immediately after the
|
||||
// pivot face (s, d, pivot point) in clockwise order.
|
||||
|
||||
@@ -218,4 +218,15 @@ template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<
|
||||
template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, long, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, long&, long&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, long, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, long&, long&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::outer_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, long, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, long&, long&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<long, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<long, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, 3, 0, -1, 3>, class Eigen::Matrix<long, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<long, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<double, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<double, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 1, -1, -1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 1, -1, -1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::outer_edge<class Eigen::Matrix<double, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, 3, 0, -1, 3>, class Eigen::Matrix<long, -1, 1, 0, -1, 1>, __int64, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 0, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<long, -1, 1, 0, -1, 1>> const &, __int64 &, __int64 &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -172,4 +172,9 @@ template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Lazy_exact_nt
|
||||
template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, int&, bool&);
|
||||
template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> > const&, int&, bool&);
|
||||
template void igl::copyleft::cgal::outer_facet<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, int&, bool&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::outer_facet<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned __int64>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, unsigned __int64 &, bool &);
|
||||
template void igl::copyleft::cgal::outer_facet<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned __int64>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, unsigned __int64 &, bool &);
|
||||
template void igl::copyleft::cgal::outer_facet<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned __int64>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, unsigned __int64 &, bool &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace igl
|
||||
// See cgal::remesh_self_intersections.h for how to obtain such input.
|
||||
//
|
||||
// This function differ from igl::outer_facet() in the fact this
|
||||
// funciton is more robust because it does not rely on facet normals.
|
||||
// function is more robust because it does not rely on facet normals.
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by 3 list of vertex positions
|
||||
|
||||
@@ -81,7 +81,7 @@ IGL_INLINE void igl::copyleft::cgal::point_mesh_squared_distance_precompute(
|
||||
// accelerate_distance_queries doesn't seem actually to do _all_ of the
|
||||
// precomputation. the tree (despite being const) will still do more
|
||||
// precomputation and reorganizing on the first call of `closest_point` or
|
||||
// `closest_point_and_primitive`. Therefor, call it once here.
|
||||
// `closest_point_and_primitive`. Therefore, call it once here.
|
||||
tree.closest_point_and_primitive(Point_3(0,0,0));
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ IGL_INLINE void igl::copyleft::cgal::points_inside_component(
|
||||
inside(i,0) = determine_point_face_orientation(V, F, I, query, fid);
|
||||
break;
|
||||
default:
|
||||
throw "Unknow closest element type!";
|
||||
throw "Unknown closest element type!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2016 Alec Jacobson
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "projected_cdt.h"
|
||||
#include "insert_into_cdt.h"
|
||||
@@ -29,8 +29,8 @@ IGL_INLINE void igl::copyleft::cgal::projected_cdt(
|
||||
size_t count=0;
|
||||
for (
|
||||
auto itr = cdt.finite_vertices_begin();
|
||||
itr != cdt.finite_vertices_end();
|
||||
itr++)
|
||||
itr != cdt.finite_vertices_end();
|
||||
itr++)
|
||||
{
|
||||
vertices.push_back(P.to_3d(itr->point()));
|
||||
v2i[itr] = count;
|
||||
@@ -39,10 +39,10 @@ IGL_INLINE void igl::copyleft::cgal::projected_cdt(
|
||||
// Read off faces and store index triples
|
||||
for (
|
||||
auto itr = cdt.finite_faces_begin();
|
||||
itr != cdt.finite_faces_end();
|
||||
itr != cdt.finite_faces_end();
|
||||
itr++)
|
||||
{
|
||||
faces.push_back(
|
||||
faces.push_back(
|
||||
{ v2i[itr->vertex(0)], v2i[itr->vertex(1)], v2i[itr->vertex(2)] });
|
||||
}
|
||||
}
|
||||
@@ -75,4 +75,8 @@ template void igl::copyleft::cgal::projected_cdt<CGAL::Epick, long>(std::vector<
|
||||
// generated by autoexplicit.sh
|
||||
template void igl::copyleft::cgal::projected_cdt<CGAL::Epeck, long>(std::vector<CGAL::Object, std::allocator<CGAL::Object> > const&, CGAL::Plane_3<CGAL::Epeck> const&, std::vector<CGAL::Point_3<CGAL::Epeck>, std::allocator<CGAL::Point_3<CGAL::Epeck> > >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::projected_cdt<class CGAL::Epeck, __int64>(class std::vector<class CGAL::Object, class std::allocator<class CGAL::Object>> const &, class CGAL::Plane_3<class CGAL::Epeck> const &, class std::vector<class CGAL::Point_3<class CGAL::Epeck>, class std::allocator<class CGAL::Point_3<class CGAL::Epeck>>> &, class std::vector<class std::vector<__int64, class std::allocator<__int64>>, class std::allocator<class std::vector<__int64, class std::allocator<__int64>>>> &);
|
||||
template void igl::copyleft::cgal::projected_cdt<class CGAL::Epick, __int64>(class std::vector<class CGAL::Object, class std::allocator<class CGAL::Object>> const &, class CGAL::Plane_3<class CGAL::Epick> const &, class std::vector<class CGAL::Point_3<class CGAL::Epick>, class std::allocator<class CGAL::Point_3<class CGAL::Epick>>> &, class std::vector<class std::vector<__int64, class std::allocator<__int64>>, class std::allocator<class std::vector<__int64, class std::allocator<__int64>>>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2016 Alec Jacobson
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_COPYLEFT_CGAL_PROJECTED_CDT_H
|
||||
#define IGL_COPYLEFT_CGAL_PROJECTED_CDT_H
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <Eigen/Core>
|
||||
#include <CGAL/Plane_3.h>
|
||||
#include <CGAL/Point_3.h>
|
||||
#include <CGAL/Object.h>
|
||||
#include <vector>
|
||||
namespace igl
|
||||
{
|
||||
@@ -32,7 +33,7 @@ namespace igl
|
||||
// Outputs:
|
||||
// vertices list of vertices of the CDT mesh _back on the 3D plane_
|
||||
// faces list of list of triangle indices into vertices
|
||||
//
|
||||
//
|
||||
template <typename Kernel, typename Index>
|
||||
IGL_INLINE void projected_cdt(
|
||||
const std::vector<CGAL::Object> & objects,
|
||||
|
||||
@@ -118,10 +118,11 @@ IGL_INLINE bool igl::copyleft::cgal::propagate_winding_numbers(
|
||||
#endif
|
||||
|
||||
bool valid = true;
|
||||
if (!piecewise_constant_winding_number(F, uE, uE2E))
|
||||
// https://github.com/libigl/libigl/issues/674
|
||||
if (!igl::piecewise_constant_winding_number(F, uE, uE2E))
|
||||
{
|
||||
assert(false && "Input mesh is not orientable");
|
||||
std::cerr << "Input mesh is not orientable!" << std::endl;
|
||||
assert(false && "Input mesh is not PWN");
|
||||
std::cerr << "Input mesh is not PWN!" << std::endl;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
@@ -316,4 +317,8 @@ template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL:
|
||||
// generated by autoexplicit.sh
|
||||
template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 1, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, unsigned long, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, unsigned long, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
||||
template bool igl::copyleft::cgal::propagate_winding_numbers<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
|
||||
#ifdef WIN32
|
||||
template bool igl::copyleft::cgal::propagate_winding_numbers<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, unsigned __int64, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, unsigned __int64, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
|
||||
template bool igl::copyleft::cgal::propagate_winding_numbers<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>, class Eigen::Matrix<int, -1, 3, 1, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned __int64, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>>(class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 1, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 3, 1, -1, 3>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>, class std::allocator<class std::vector<unsigned __int64, class std::allocator<unsigned __int64>>>> const &, unsigned __int64, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, unsigned __int64, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> const &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "assign_scalar.h"
|
||||
#include "projected_cdt.h"
|
||||
#include "../../get_seconds.h"
|
||||
#include "../../parallel_for.h"
|
||||
#include "../../LinSpaced.h"
|
||||
#include "../../unique_rows.h"
|
||||
|
||||
@@ -375,18 +376,21 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections(
|
||||
std::vector<std::vector<Point_3> > cdt_vertices(num_cdts);
|
||||
std::vector<std::vector<std::vector<Index> > > cdt_faces(num_cdts);
|
||||
|
||||
const auto cdt = [&](const size_t first, const size_t last)
|
||||
//// Not clear whether this is safe because of reference counting on Point_3
|
||||
//// objects...
|
||||
////
|
||||
//// I tried it and got random segfaults (via MATLAB). Seems this is not
|
||||
//// safe.
|
||||
//igl::parallel_for(num_cdts,[&](int i)
|
||||
for (size_t i=0; i<num_cdts; i++)
|
||||
{
|
||||
for (size_t i=first; i<last; i++)
|
||||
{
|
||||
auto& vertices = cdt_vertices[i];
|
||||
auto& faces = cdt_faces[i];
|
||||
const auto& P = cdt_inputs[i].first;
|
||||
const auto& involved_faces = cdt_inputs[i].second;
|
||||
delaunay_triangulation(P, involved_faces, vertices, faces);
|
||||
}
|
||||
};
|
||||
cdt(0, num_cdts);
|
||||
auto& vertices = cdt_vertices[i];
|
||||
auto& faces = cdt_faces[i];
|
||||
const auto& P = cdt_inputs[i].first;
|
||||
const auto& involved_faces = cdt_inputs[i].second;
|
||||
delaunay_triangulation(P, involved_faces, vertices, faces);
|
||||
}
|
||||
//,1000);
|
||||
#ifdef REMESH_INTERSECTIONS_TIMING
|
||||
log_time("cdt");
|
||||
#endif
|
||||
@@ -449,7 +453,7 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections(
|
||||
FF.data(), [&vv_to_unique](const typename DerivedFF::Scalar& a)
|
||||
{ return vv_to_unique[a]; });
|
||||
IM.resize(unique_vv.rows());
|
||||
// Have to use << instead of = becasue Eigen's PlainObjectBase is annoying
|
||||
// Have to use << instead of = because Eigen's PlainObjectBase is annoying
|
||||
IM << igl::LinSpaced<
|
||||
Eigen::Matrix<typename DerivedIM::Scalar, Eigen::Dynamic,1 >
|
||||
>(unique_vv.rows(), 0, unique_vv.rows()-1);
|
||||
@@ -511,4 +515,10 @@ template void igl::copyleft::cgal::remesh_intersections<Eigen::Matrix<CGAL::Lazy
|
||||
template void igl::copyleft::cgal::remesh_intersections<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epick, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epick>, std::allocator<CGAL::Triangle_3<CGAL::Epick> > > const&, std::map<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, std::vector<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object> > >, std::less<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index const, std::vector<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object> > > > > > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::remesh_intersections<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, 8, 3, 0, 8, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > > const&, std::map<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, std::vector<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object> > >, std::less<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index const, std::vector<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object> > > > > > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::remesh_intersections<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<CGAL::Triangle_3<CGAL::Epeck>, std::allocator<CGAL::Triangle_3<CGAL::Epeck> > > const&, std::map<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, std::vector<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object> > >, std::less<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index const, std::vector<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object>, std::allocator<std::pair<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Index, CGAL::Object> > > > > > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::remesh_intersections<class Eigen::Matrix<double, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class CGAL::Epeck, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epeck>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epeck>>> const &, class std::map<__int64, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>, struct std::less<__int64>, class std::allocator<struct std::pair<__int64 const, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>>>> const &, bool, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::remesh_intersections<class Eigen::Matrix<double, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class CGAL::Epick, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epick>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epick>>> const &, class std::map<__int64, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>, struct std::less<__int64>, class std::allocator<struct std::pair<__int64 const, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>>>> const &, bool, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::remesh_intersections<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class CGAL::Epeck, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epeck>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epeck>>> const &, class std::map<__int64, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>, struct std::less<__int64>, class std::allocator<struct std::pair<__int64 const, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>>>> const &, bool, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::remesh_intersections<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class CGAL::Epick, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, class std::vector<class CGAL::Triangle_3<class CGAL::Epick>, class std::allocator<class CGAL::Triangle_3<class CGAL::Epick>>> const &, class std::map<__int64, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>, struct std::less<__int64>, class std::allocator<struct std::pair<__int64 const, class std::vector<struct std::pair<__int64, class CGAL::Object>, class std::allocator<struct std::pair<__int64, class CGAL::Object>>>>>> const &, bool, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace igl
|
||||
// offending #offending map taking face indices into F to pairs of order
|
||||
// of first finding and list of intersection objects from all
|
||||
// intersections
|
||||
// stitch_all if true, merge all vertices with thte same coordiante.
|
||||
// stitch_all if true, merge all vertices with the same coordinate.
|
||||
// Outputs:
|
||||
// VV #VV by 3 list of vertex positions, if stitch_all = false then
|
||||
// first #V vertices will always be V
|
||||
|
||||
@@ -101,4 +101,8 @@ template void igl::copyleft::cgal::remesh_self_intersections<Eigen::Matrix<CGAL:
|
||||
template void igl::copyleft::cgal::remesh_self_intersections<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::remesh_self_intersections<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
template void igl::copyleft::cgal::remesh_self_intersections<Eigen::Matrix<double, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
||||
#ifdef WIN32
|
||||
template void igl::copyleft::cgal::remesh_self_intersections<class Eigen::Matrix<double, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<double, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, struct igl::copyleft::cgal::RemeshSelfIntersectionsParam const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
template void igl::copyleft::cgal::remesh_self_intersections<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<int, -1, -1, 0, -1, -1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<int, -1, 1, 0, -1, 1>>(class Eigen::MatrixBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, 3, 0, -1, 3>> const &, class Eigen::MatrixBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> const &, struct igl::copyleft::cgal::RemeshSelfIntersectionsParam const &, class Eigen::PlainObjectBase<class Eigen::Matrix<class CGAL::Lazy_exact_nt<class CGAL::Gmpq>, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, -1, 0, -1, -1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>> &, class Eigen::PlainObjectBase<class Eigen::Matrix<int, -1, 1, 0, -1, 1>> &);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user