Commit ca7443d7 authored by Yuwei Xiao's avatar Yuwei Xiao
Browse files

init

parents
build/
.DS_Store
.vscode
.clang-format
*.aux
*.log
*.gz
*.out
\ No newline at end of file
[submodule "libigl"]
path = libigl
url = http://dalab.se.sjtu.edu.cn/gitlab/xiaoyuwei/libigl.git
cmake_minimum_required(VERSION 3.1)
project(0_dummy)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
set(CMAKE_CXX_FLAGS "-Wall")
# libigl
option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF)
option(LIBIGL_WITH_ANTTWEAKBAR "Use AntTweakBar" OFF)
option(LIBIGL_WITH_CGAL "Use CGAL" OFF)
option(LIBIGL_WITH_COMISO "Use CoMiso" OFF)
option(LIBIGL_WITH_CORK "Use Cork" OFF)
option(LIBIGL_WITH_EMBREE "Use Embree" OFF)
option(LIBIGL_WITH_LIM "Use LIM" OFF)
option(LIBIGL_WITH_MATLAB "Use Matlab" OFF)
option(LIBIGL_WITH_MOSEK "Use MOSEK" OFF)
option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" ON)
option(LIBIGL_WITH_PNG "Use PNG" OFF)
option(LIBIGL_WITH_PYTHON "Use Python" OFF)
option(LIBIGL_WITH_TETGEN "Use Tetgen" OFF)
option(LIBIGL_WITH_TRIANGLE "Use Triangle" OFF)
option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON)
option(LIBIGL_WITH_XML "Use XML" OFF)
if (NOT LIBIGL_FOUND)
find_package(LIBIGL REQUIRED QUIET)
endif()
# Add default project files
file(GLOB LIBFILES ${PROJECT_SOURCE_DIR}/../include/*.*)
source_group("Library Files" FILES ${LIBFILES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
# Add your project files
file(GLOB SRCFILES *.cpp)
file(GLOB HFILES *.h)
add_definitions(-DIGL_VIEWER_VIEWER_QUIET)
add_executable(${PROJECT_NAME} ${SRCFILES} ${HFILES} ${LIBFILES} )
target_link_libraries(${PROJECT_NAME} igl::core igl::opengl_glfw igl::opengl_glfw_imgui)
\ No newline at end of file
#include "DummySim.h"
using namespace std;
/*
* Example simulation that changes the colors of a cube.
*/
DummySim::DummySim() : Simulation() {
init();
}
void DummySim::init() {
// create a cube on [-1,1]^3
// vertices
m_V.resize(8, 3);
int v = 5;
m_V << -v, -v, -v, v, -v, -v, -v, v, -v, v, v, -v, -v, -v, v, v, -v, v,
-v, v, v, v, v, v;
// faces
m_F.resize(12, 3);
m_F << 0, 2, 1, 2, 3, 1, 1, 3, 5, 3, 7, 5, 2, 6, 3, 6, 7, 3, 5, 7, 4, 7,
6, 4, 4, 6, 0, 6, 2, 0, 0, 4, 1, 4, 5, 1;
// face colors
m_C.resize(12, 3);
reset();
}
void DummySim::resetMembers() {
m_C.setZero();
m_C.col(0).setOnes();
}
void DummySim::updateRenderGeometry() {
m_renderV = m_V;
m_renderF = m_F;
m_renderC = m_C;
}
bool DummySim::advance() {
// do next step of some color animation
int speed = 60;
int decColor = (m_step / speed) % 3;
int incColor = (decColor + 1) % 3;
for (int i = 0; i < m_C.rows(); i++) {
m_C(i, decColor) = (m_C(i, decColor) * speed - 1) / speed;
m_C(i, incColor) = (m_C(i, incColor) * speed + 1) / speed;
}
// advance step
m_step++;
return false;
}
void DummySim::renderRenderGeometry(
igl::opengl::glfw::Viewer &viewer) {
viewer.data().set_mesh(m_renderV, m_renderF);
viewer.data().set_colors(m_renderC);
}
\ No newline at end of file
#include "Simulation.h"
/*
* Example simulation that changes the colors of a cube.
*/
class DummySim : public Simulation {
public:
DummySim();
virtual void init() override;
virtual void resetMembers() override;
virtual void updateRenderGeometry() override;
virtual bool advance() override;
virtual void renderRenderGeometry(igl::opengl::glfw::Viewer &viewer) override;
private:
Eigen::MatrixXd m_V; // vertex positions
Eigen::MatrixXi m_F; // face indices
Eigen::MatrixXd m_C; // colors per face
Eigen::MatrixXd m_renderV; // vertex positions for rendering
Eigen::MatrixXi m_renderF; // face indices for rendering
Eigen::MatrixXd m_renderC; // colors per face for rendering
};
\ No newline at end of file
#include <igl/writeOFF.h>
#include <thread>
#include "DummySim.h"
#include "Gui.h"
#include "Simulator.h"
/*
* This class is a GUI for our dummy simulation. It extends the basic GUI
* defined in Gui.h. We could add more controls and visuals here, but we don't
* need any additional functionality for this dummy simulation.
*/
class DummyGui : public Gui {
public:
DummySim *p_dummySim = NULL; // pointer to the dummy simulation
DummyGui() {
// create a new dummy simulation
p_dummySim = new DummySim();
// set this simulation as the simulation that is running in our GUI
setSimulation(p_dummySim);
// start the GUI
start();
}
virtual void updateSimulationParameters() override {
// We don't have any simulation parameters to update periodically so we
// don't need to do anything here
};
};
int main(int argc, char *argv[]) {
// create a new instance of the GUI for the dummy simulation
new DummyGui();
return 0;
}
\ No newline at end of file
cmake_minimum_required(VERSION 3.1)
project(PBS)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF)
option(LIBIGL_WITH_ANTTWEAKBAR "Use AntTweakBar" OFF)
option(LIBIGL_WITH_CGAL "Use CGAL" OFF)
option(LIBIGL_WITH_COMISO "Use CoMiso" OFF)
option(LIBIGL_WITH_CORK "Use Cork" OFF)
option(LIBIGL_WITH_EMBREE "Use Embree" OFF)
option(LIBIGL_WITH_LIM "Use LIM" OFF)
option(LIBIGL_WITH_MATLAB "Use Matlab" OFF)
option(LIBIGL_WITH_MOSEK "Use MOSEK" OFF)
option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui" ON)
option(LIBIGL_WITH_PNG "Use PNG" OFF)
option(LIBIGL_WITH_PYTHON "Use Python" OFF)
option(LIBIGL_WITH_TETGEN "Use Tetgen" OFF)
option(LIBIGL_WITH_TRIANGLE "Use Triangle" OFF)
option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON)
option(LIBIGL_WITH_XML "Use XML" OFF)
if (NOT LIBIGL_FOUND)
find_package(LIBIGL REQUIRED QUIET)
endif()
add_subdirectory(0_dummy)
add_subdirectory(1-1_cannonball)
add_subdirectory(1-2_spring)
add_subdirectory(2-1_spinning)
add_subdirectory(2-2_gyro)
add_subdirectory(3_collision)
add_subdirectory(4_mss)
add_subdirectory(5_fluid)
\ No newline at end of file
# Computer Animation 2020 - Exercise
## Overview
Code framework for course exercise.
## Installation
Install **Git** and build system **Cmake**.
### Note for linux users
Many linux distributions do not include `gcc` and the basic development tools in their default installation. On Ubuntu, you need to install the following packages:
```
sudo apt-get install build-essential libx11-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxi-dev libxmu-dev libblas-dev libxinerama-dev libxcursor-dev
```
### Build
Run the following commands inside the relevant subfolder to setup the build folder:
```
mkdir build
cd build
cmake ..
```
Compile and run the executable, e.g. Ubuntu:
```
make && ./0_dummy/0_dummy
```
## Exercise Handin
**You only need to handin the directory containing the modified executable**. For example (homework 0), you only need to compress folder *0_dummy* and submit the compressed file. *Please don't include any build file, only the source code and related resource file*.
```
zip NAME_ID_0_dummy.zip 0_dummy/*
```
Rename your compressed file following the rule *`NAME_ID_XXX`*.
OFF
# cube.off
# A cube
8 12 0
-1 -1 -1
1 -1 -1
-1 1 -1
1 1 -1
-1 -1 1
1 -1 1
-1 1 1
1 1 1
3 0 2 1
3 2 3 1
3 1 3 5
3 3 7 5
3 2 6 3
3 6 7 3
3 5 7 4
3 7 6 4
3 4 6 0
3 6 2 0
3 4 0 1
3 4 1 5
\ No newline at end of file
OFF
# cube.off
# A cube
8 24 0
-1 -1 -1
1 -1 -1
-1 1 -1
1 1 -1
-1 -1 1
1 -1 1
-1 1 1
1 1 1
3 0 2 1
3 2 3 1
3 1 3 5
3 3 7 5
3 2 6 3
3 6 7 3
3 5 7 4
3 7 6 4
3 4 6 0
3 6 2 0
3 4 0 1
3 4 1 5
3 0 3 1
3 2 3 0
3 1 7 5
3 3 7 1
3 2 7 3
3 6 7 2
3 5 7 6
3 6 4 5
3 4 6 2
3 4 2 0
3 5 0 1
3 4 0 5
\ No newline at end of file
OFF
# cube.off
# A cube
8 12 0
-1 -1 -1
1 -1 -1
-1 1 -1
1 1 -1
-1 -1 1
1 -1 1
-1 1 1
1 1 1
3 0 2 1
3 2 3 1
3 2 6 3
3 6 7 3
3 5 7 4
3 7 6 4
3 1 7 5
3 3 7 1
#3 2 7 3
#3 6 7 2
3 4 6 2
3 4 2 0
3 5 0 1
3 4 0 5
\ No newline at end of file
OFF
# cube.off
# A cube
8 12 0
-1 -0.01 -1
1 -0.01 -1
-1 0.01 -1
1 0.01 -1
-1 -0.01 1
1 -0.01 1
-1 0.01 1
1 0.01 1
3 0 2 1
3 2 3 1
3 1 3 5
3 3 7 5
3 2 6 3
3 6 7 3
3 5 7 4
3 7 6 4
3 4 6 0
3 6 2 0
3 4 0 1
3 4 1 5
\ No newline at end of file
OFF
482 960 0
0 19.7371 -0
-0 19.3578 -3.85051
-0.751198 19.3578 -3.77653
-1.47353 19.3578 -3.55741
-2.13923 19.3578 -3.20159
-2.72272 19.3578 -2.72272
-3.20159 19.3578 -2.13923
-3.55741 19.3578 -1.47353
-3.77653 19.3578 -0.751197
-3.85051 19.3578 1e-06
-3.77653 19.3578 0.751199
-3.55741 19.3578 1.47353
-3.20158 19.3578 2.13923
-2.72272 19.3578 2.72273
-2.13923 19.3578 3.20159
-1.47353 19.3578 3.55741
-0.751195 19.3578 3.77653
4e-06 19.3578 3.85051
0.751202 19.3578 3.77653
1.47353 19.3578 3.55741
2.13924 19.3578 3.20158
2.72273 19.3578 2.72272
3.20159 19.3578 2.13923
3.55741 19.3578 1.47352
3.77653 19.3578 0.751192
3.85051 19.3578 -6e-06
3.77653 19.3578 -0.751204
3.55741 19.3578 -1.47353
3.20158 19.3578 -2.13924
2.72272 19.3578 -2.72273
2.13922 19.3578 -3.20159
1.47352 19.3578 -3.55741
0.75119 19.3578 -3.77653
-0 18.2347 -7.55305
-1.47353 18.2347 -7.40792
-2.89043 18.2347 -6.97811
-4.19625 18.2347 -6.28014
-5.34082 18.2347 -5.34082
-6.28014 18.2347 -4.19625
-6.97811 18.2347 -2.89043
-7.40792 18.2347 -1.47353
-7.55305 18.2347 2e-06
-7.40792 18.2347 1.47353
-6.97811 18.2347 2.89043
-6.28013 18.2347 4.19626
-5.34081 18.2347 5.34082
-4.19625 18.2347 6.28014
-2.89042 18.2347 6.97811
-1.47352 18.2347 7.40793
7e-06 18.2347 7.55305
1.47353 18.2347 7.40792
2.89044 18.2347 6.97811
4.19626 18.2347 6.28013
5.34082 18.2347 5.34081
6.28014 18.2347 4.19624
6.97812 18.2347 2.89042
7.40793 18.2347 1.47352
7.55305 18.2347 -1.2e-05
7.40792 18.2347 -1.47354
6.97811 18.2347 -2.89044
6.28013 18.2347 -4.19626
5.34081 18.2347 -5.34083
4.19624 18.2347 -6.28014
2.89041 18.2347 -6.97812
1.47351 18.2347 -7.40793
-0 16.4108 -10.9653
-2.13923 16.4108 -10.7546
-4.19625 16.4108 -10.1306
-6.09201 16.4108 -9.11734
-7.75366 16.4108 -7.75366
-9.11734 16.4108 -6.09201
-10.1306 16.4108 -4.19625
-10.7546 16.4108 -2.13923
-10.9653 16.4108 4e-06
-10.7546 16.4108 2.13924
-10.1306 16.4108 4.19626
-9.11734 16.4108 6.09202
-7.75366 16.4108 7.75367
-6.09201 16.4108 9.11735
-4.19624 16.4108 10.1307
-2.13922 16.4108 10.7546
1.1e-05 16.4108 10.9653
2.13924 16.4108 10.7546
4.19626 16.4108 10.1306
6.09202 16.4108 9.11733
7.75367 16.4108 7.75365
9.11735 16.4108 6.092
10.1307 16.4108 4.19624
10.7546 16.4108 2.13921
10.9653 16.4108 -1.8e-05
10.7546 16.4108 -2.13925
10.1306 16.4108 -4.19627
9.11733 16.4108 -6.09203
7.75365 16.4108 -7.75368
6.09199 16.4108 -9.11735
4.19623 16.4108 -10.1307
2.13921 16.4108 -10.7546
-1e-06 13.9562 -13.9562
-2.72272 13.9562 -13.6881
-5.34082 13.9562 -12.8939
-7.75366 13.9562 -11.6042
-9.86854 13.9562 -9.86854
-11.6042 13.9562 -7.75366
-12.8939 13.9562 -5.34081
-13.6881 13.9562 -2.72272
-13.9562 13.9562 5e-06
-13.6881 13.9562 2.72273
-12.8939 13.9562 5.34082
-11.6042 13.9562 7.75367
-9.86853 13.9562 9.86855
-7.75365 13.9562 11.6042
-5.34081 13.9562 12.8939
-2.72271 13.9562 13.6881
1.3e-05 13.9562 13.9562
2.72274 13.9562 13.6881
5.34083 13.9562 12.8939
7.75368 13.9562 11.6042
9.86855 13.9562 9.86853
11.6042 13.9562 7.75365
12.8939 13.9562 5.3408
13.6881 13.9562 2.7227
13.9562 13.9562 -2.2e-05
13.6881 13.9562 -2.72275
12.8939 13.9562 -5.34084
11.6042 13.9562 -7.75368
9.86852 13.9562 -9.86856
7.75364 13.9562 -11.6042
5.34079 13.9562 -12.8939
2.72269 13.9562 -13.6881
-1e-06 10.9653 -16.4108
-3.20159 10.9653 -16.0955
-6.28013 10.9653 -15.1616
-9.11734 10.9653 -13.6451
-11.6042 10.9653 -11.6042
-13.6451 10.9653 -9.11734
-15.1616 10.9653 -6.28013
-16.0955 10.9653 -3.20158
-16.4108 10.9653 5e-06
-16.0955 10.9653 3.20159
-15.1616 10.9653 6.28014
-13.6451 10.9653 9.11735
-11.6042 10.9653 11.6042
-9.11733 10.9653 13.6451
-6.28012 10.9653 15.1616
-3.20157 10.9653 16.0955
1.6e-05 10.9653 16.4108
3.2016 10.9653 16.0955
6.28015 10.9653 15.1616
9.11736 10.9653 13.6451
11.6042 10.9653 11.6042
13.6451 10.9653 9.11732
15.1616 10.9653 6.28011
16.0955 10.9653 3.20156
16.4108 10.9653 -2.6e-05
16.0954 10.9653 -3.20161
15.1616 10.9653 -6.28016
13.6451 10.9653 -9.11737
11.6042 10.9653 -11.6042
9.11732 10.9653 -13.6451
6.2801 10.9653 -15.1616
3.20155 10.9653 -16.0955
-1e-06 7.55305 -18.2347
-3.55741 7.55305 -17.8843
-6.97811 7.55305 -16.8467
-10.1306 7.55305 -15.1616
-12.8939 7.55305 -12.8939
-15.1616 7.55305 -10.1306
-16.8467 7.55305 -6.97811
-17.8843 7.55305 -3.55741
-18.2347 7.55305 6e-06
-17.8843 7.55305 3.55742
-16.8466 7.55305 6.97812
-15.1616 7.55305 10.1307
-12.8939 7.55305 12.8939
-10.1306 7.55305 15.1616
-6.9781 7.55305 16.8467
-3.55739 7.55305 17.8843
1.8e-05 7.55305 18.2347
3.55743 7.55305 17.8843
6.97813 7.55305 16.8466
10.1307 7.55305 15.1616
12.8939 7.55305 12.8939
15.1616 7.55305 10.1306
16.8467 7.55305 6.97809
17.8843 7.55305 3.55738
18.2347 7.55305 -2.9e-05
17.8843 7.55305 -3.55744
16.8466 7.55305 -6.97814
15.1616 7.55305 -10.1307
12.8938 7.55305 -12.8939
10.1306 7.55305 -15.1616
6.97808 7.55305 -16.8467
3.55737 7.55305 -17.8843
-1e-06 3.85051 -19.3578
-3.77653 3.85051 -18.9859
-7.40792 3.85051 -17.8843
-10.7546 3.85051 -16.0955
-13.6881 3.85051 -13.6881
-16.0955 3.85051 -10.7546
-17.8843 3.85051 -7.40792
-18.9859 3.85051 -3.77652
-19.3578 3.85051 6e-06
-18.9859 3.85051 3.77653
-17.8843 3.85051 7.40793
-16.0954 3.85051 10.7546
-13.688 3.85051 13.6881
-10.7546 3.85051 16.0955
-7.40791 3.85051 17.8843
-3.77651 3.85051 18.9859
1.9e-05 3.85051 19.3578
3.77655 3.85051 18.9859
7.40794 3.85051 17.8843
10.7547 3.85051 16.0954
13.6881 3.85051 13.688
16.0955 3.85051 10.7546
17.8843 3.85051 7.4079
18.9859 3.85051 3.7765
19.3578 3.85051 -3.1e-05
18.9859 3.85051 -3.77656
17.8843 3.85051 -7.40796
16.0954 3.85051 -10.7547
13.688 3.85051 -13.6881
10.7546 3.85051 -16.0955
7.40789 3.85051 -17.8843
3.77648 3.85051 -18.9859
-1e-06 1e-06 -19.7371
-3.85051 1e-06 -19.3578
-7.55305 1e-06 -18.2347
-10.9653 1e-06 -16.4108
-13.9562 1e-06 -13.9562
-16.4108 1e-06 -10.9653
-18.2347 1e-06 -7.55305
-19.3578 1e-06 -3.85051
-19.7371 1e-06 6e-06
-19.3578 1e-06 3.85052
-18.2347 1e-06 7.55306
-16.4108 1e-06 10.9653
-13.9562 1e-06 13.9562
-10.9653 1e-06 16.4108
-7.55304 1e-06 18.2347
-3.8505 1e-06 19.3578
1.9e-05 1e-06 19.7371
3.85053 1e-06 19.3578
7.55307 1e-06 18.2347
10.9654 1e-06 16.4108
13.9562 1e-06 13.9562
16.4108 1e-06 10.9653
18.2347 1e-06 7.55303
19.3578 1e-06 3.85048
19.7371 1e-06 -3.2e-05
19.3578 1e-06 -3.85055
18.2347 1e-06 -7.55308
16.4108 1e-06 -10.9654
13.9562 1e-06 -13.9562
10.9653 1e-06 -16.4108
7.55302 1e-06 -18.2347
3.85047 1e-06 -19.3578
-1e-06 -3.85051 -19.3578
-3.77653 -3.85051 -18.9859
-7.40792 -3.85051 -17.8843
-10.7546 -3.85051 -16.0955
-13.6881 -3.85051 -13.6881
-16.0955 -3.85051 -10.7546
-17.8843 -3.85051 -7.40792
-18.9859 -3.85051 -3.77652
-19.3578 -3.85051 6e-06
-18.9859 -3.85051 3.77654
-17.8843 -3.85051 7.40793
-16.0954 -3.85051 10.7546
-13.688 -3.85051 13.6881
-10.7546 -3.85051 16.0955
-7.40791 -3.85051 17.8843
-3.77651 -3.85051 18.9859
1.9e-05 -3.85051 19.3578
3.77655 -3.85051 18.9859
7.40794 -3.85051 17.8843
10.7547 -3.85051 16.0954
13.6881 -3.85051 13.688
16.0955 -3.85051 10.7546
17.8843 -3.85051 7.4079
18.9859 -3.85051 3.7765
19.3578 -3.85051 -3.1e-05
18.9859 -3.85051 -3.77656
17.8843 -3.85051 -7.40796
16.0954 -3.85051 -10.7547
13.688 -3.85051 -13.6881
10.7546 -3.85051 -16.0955
7.40789 -3.85051 -17.8843
3.77649 -3.85051 -18.9859
-1e-06 -7.55305 -18.2347
-3.55741 -7.55305 -17.8843
-6.97811 -7.55305 -16.8467
-10.1306 -7.55305 -15.1616
-12.8939 -7.55305 -12.8939
-15.1616 -7.55305 -10.1306
-16.8467 -7.55305 -6.97811
-17.8843 -7.55305 -3.55741
-18.2347 -7.55305 6e-06
-17.8843 -7.55305 3.55742
-16.8466 -7.55305 6.97812
-15.1616 -7.55305 10.1307
-12.8939 -7.55305 12.8939
-10.1306 -7.55305 15.1616
-6.9781 -7.55305 16.8467
-3.55739 -7.55305 17.8843
1.8e-05 -7.55305 18.2347
3.55743 -7.55305 17.8843
6.97813 -7.55305 16.8466
10.1307 -7.55305 15.1616
12.8939 -7.55305 12.8939
15.1616 -7.55305 10.1306
16.8467 -7.55305 6.97809
17.8843 -7.55305 3.55738
18.2347 -7.55305 -2.9e-05
17.8843 -7.55305 -3.55744
16.8466 -7.55305 -6.97814
15.1616 -7.55305 -10.1307
12.8938 -7.55305 -12.8939
10.1306 -7.55305 -15.1616
6.97808 -7.55305 -16.8467
3.55737 -7.55305 -17.8843
-1e-06 -10.9653 -16.4108
-3.20159 -10.9653 -16.0955
-6.28013 -10.9653 -15.1616
-9.11734 -10.9653 -13.6451
-11.6042 -10.9653 -11.6042
-13.6451 -10.9653 -9.11734
-15.1616 -10.9653 -6.28013
-16.0955 -10.9653 -3.20158
-16.4108 -10.9653 5e-06
-16.0955 -10.9653 3.20159
-15.1616 -10.9653 6.28014
-13.6451 -10.9653 9.11735
-11.6042 -10.9653 11.6042
-9.11733 -10.9653 13.6451
-6.28012 -10.9653 15.1616
-3.20157 -10.9653 16.0955
1.6e-05 -10.9653 16.4108
3.2016 -10.9653 16.0955
6.28015 -10.9653 15.1616
9.11736 -10.9653 13.6451
11.6042 -10.9653 11.6042
13.6451 -10.9653 9.11732
15.1616 -10.9653 6.28011
16.0955 -10.9653 3.20156
16.4108 -10.9653 -2.6e-05
16.0954 -10.9653 -3.20161
15.1616 -10.9653 -6.28016
13.6451 -10.9653 -9.11737
11.6042 -10.9653 -11.6042
9.11732 -10.9653 -13.6451
6.2801 -10.9653 -15.1616
3.20155 -10.9653 -16.0955
-1e-06 -13.9562 -13.9562
-2.72272 -13.9562 -13.6881
-5.34082 -13.9562 -12.8939
-7.75366 -13.9562 -11.6042
-9.86854 -13.9562 -9.86854
-11.6042 -13.9562 -7.75366
-12.8939 -13.9562 -5.34081
-13.6881 -13.9562 -2.72272
-13.9562 -13.9562 5e-06
-13.6881 -13.9562 2.72273
-12.8939 -13.9562 5.34082
-11.6042 -13.9562 7.75367
-9.86853 -13.9562 9.86855
-7.75365 -13.9562 11.6042
-5.34081 -13.9562 12.8939
-2.72271 -13.9562 13.6881
1.3e-05 -13.9562 13.9562
2.72274 -13.9562 13.6881
5.34083 -13.9562 12.8939
7.75368 -13.9562 11.6042
9.86855 -13.9562 9.86853
11.6042 -13.9562 7.75365
12.8939 -13.9562 5.3408
13.6881 -13.9562 2.7227
13.9562 -13.9562 -2.2e-05
13.6881 -13.9562 -2.72275
12.8939 -13.9562 -5.34084
11.6042 -13.9562 -7.75368
9.86852 -13.9562 -9.86856
7.75364 -13.9562 -11.6042
5.34079 -13.9562 -12.8939
2.72269 -13.9562 -13.6881
-0 -16.4108 -10.9653
-2.13923 -16.4108 -10.7546
-4.19625 -16.4108 -10.1306
-6.09201 -16.4108 -9.11734
-7.75366 -16.4108 -7.75366
-9.11734 -16.4108 -6.09201
-10.1306 -16.4108 -4.19625
-10.7546 -16.4108 -2.13923
-10.9653 -16.4108 4e-06
-10.7546 -16.4108 2.13924
-10.1306 -16.4108 4.19626
-9.11734 -16.4108 6.09202
-7.75366 -16.4108 7.75367
-6.09201 -16.4108 9.11734
-4.19624 -16.4108 10.1306
-2.13922 -16.4108 10.7546
1.1e-05 -16.4108 10.9653
2.13924 -16.4108 10.7546
4.19626 -16.4108 10.1306
6.09202 -16.4108 9.11733
7.75367 -16.4108 7.75365
9.11735 -16.4108 6.092
10.1307 -16.4108 4.19624
10.7546 -16.4108 2.13921
10.9653 -16.4108 -1.8e-05
10.7546 -16.4108 -2.13925
10.1306 -16.4108 -4.19627
9.11733 -16.4108 -6.09203
7.75365 -16.4108 -7.75368
6.09199 -16.4108 -9.11735
4.19623 -16.4108 -10.1307
2.13921 -16.4108 -10.7546
-0 -18.2347 -7.55305
-1.47353 -18.2347 -7.40792
-2.89043 -18.2347 -6.97811
-4.19625 -18.2347 -6.28013
-5.34081 -18.2347 -5.34081
-6.28013 -18.2347 -4.19625
-6.97811 -18.2347 -2.89043
-7.40792 -18.2347 -1.47353
-7.55305 -18.2347 2e-06
-7.40792 -18.2347 1.47353
-6.97811 -18.2347 2.89043
-6.28013 -18.2347 4.19625
-5.34081 -18.2347 5.34082
-4.19625 -18.2347 6.28014
-2.89042 -18.2347 6.97811
-1.47352 -18.2347 7.40792
7e-06 -18.2347 7.55305
1.47353 -18.2347 7.40792
2.89043 -18.2347 6.97811
4.19626 -18.2347 6.28013
5.34082 -18.2347 5.34081
6.28014 -18.2347 4.19624
6.97811 -18.2347 2.89042
7.40792 -18.2347 1.47352
7.55305 -18.2347 -1.2e-05
7.40792 -18.2347 -1.47354
6.9781 -18.2347 -2.89044
6.28012 -18.2347 -4.19626
5.3408 -18.2347 -5.34082
4.19624 -18.2347 -6.28014
2.89041 -18.2347 -6.97812
1.47351 -18.2347 -7.40792
-0 -19.3578 -3.85051
-0.751197 -19.3578 -3.77652
-1.47353 -19.3578 -3.55741
-2.13923 -19.3578 -3.20158
-2.72272 -19.3578 -2.72272
-3.20158 -19.3578 -2.13923
-3.55741 -19.3578 -1.47353
-3.77652 -19.3578 -0.751196
-3.85051 -19.3578 1e-06
-3.77652 -19.3578 0.751198
-3.5574 -19.3578 1.47353
-3.20158 -19.3578 2.13923
-2.72272 -19.3578 2.72272
-2.13923 -19.3578 3.20158
-1.47352 -19.3578 3.55741
-0.751194 -19.3578 3.77652
4e-06 -19.3578 3.85051
0.751201 -19.3578 3.77652
1.47353 -19.3578 3.5574
2.13923 -19.3578 3.20158
2.72272 -19.3578 2.72272
3.20158 -19.3578 2.13922
3.55741 -19.3578 1.47352
3.77652 -19.3578 0.751191
3.85051 -19.3578 -6e-06
3.77652 -19.3578 -0.751203
3.5574 -19.3578 -1.47353
3.20158 -19.3578 -2.13923
2.72271 -19.3578 -2.72273
2.13922 -19.3578 -3.20159
1.47352 -19.3578 -3.55741
0.751189 -19.3578 -3.77652
0 -19.7371 -0
3 0 1 2
3 0 2 3
3 0 3 4
3 0 4 5
3 0 5 6
3 0 6 7
3 0 7 8
3 0 8 9
3 0 9 10
3 0 10 11
3 0 11 12
3 0 12 13
3 0 13 14
3 0 14 15
3 0 15 16
3 0 16 17
3 0 17 18
3 0 18 19
3 0 19 20
3 0 20 21
3 0 21 22
3 0 22 23
3 0 23 24
3 0 24 25
3 0 25 26
3 0 26 27
3 0 27 28
3 0 28 29
3 0 29 30
3 0 30 31
3 0 31 32
3 0 32 1
3 1 33 34
3 1 34 2
3 2 34 35
3 2 35 3
3 3 35 36
3 3 36 4
3 4 36 37
3 4 37 5
3 5 37 38
3 5 38 6
3 6 38 39
3 6 39 7
3 7 39 40
3 7 40 8
3 8 40 41
3 8 41 9
3 9 41 42
3 9 42 10
3 10 42 43
3 10 43 11
3 11 43 44
3 11 44 12
3 12 44 45
3 12 45 13
3 13 45 46
3 13 46 14
3 14 46 47
3 14 47 15
3 15 47 48
3 15 48 16
3 16 48 49
3 16 49 17
3 17 49 50
3 17 50 18
3 18 50 51
3 18 51 19
3 19 51 52
3 19 52 20
3 20 52 53
3 20 53 21
3 21 53 54
3 21 54 22
3 22 54 55
3 22 55 23
3 23 55 56
3 23 56 24
3 24 56 57
3 24 57 25
3 25 57 58
3 25 58 26
3 26 58 59
3 26 59 27
3 27 59 60
3 27 60 28
3 28 60 61
3 28 61 29
3 29 61 62
3 29 62 30
3 30 62 63
3 30 63 31
3 31 63 64
3 31 64 32
3 32 64 33
3 32 33 1
3 33 65 66
3 33 66 34
3 34 66 67
3 34 67 35
3 35 67 68
3 35 68 36
3 36 68 69
3 36 69 37
3 37 69 70
3 37 70 38
3 38 70 71
3 38 71 39
3 39 71 72
3 39 72 40
3 40 72 73
3 40 73 41
3 41 73 74
3 41 74 42
3 42 74 75
3 42 75 43
3 43 75 76
3 43 76 44
3 44 76 77
3 44 77 45
3 45 77 78
3 45 78 46
3 46 78 79
3 46 79 47
3 47 79 80
3 47 80 48
3 48 80 81
3 48 81 49
3 49 81 82
3 49 82 50
3 50 82 83
3 50 83 51
3 51 83 84
3 51 84 52
3 52 84 85
3 52 85 53
3 53 85 86
3 53 86 54
3 54 86 87
3 54 87 55
3 55 87 88
3 55 88 56
3 56 88 89
3 56 89 57
3 57 89 90
3 57 90 58
3 58 90 91
3 58 91 59
3 59 91 92
3 59 92 60
3 60 92 93
3 60 93 61
3 61 93 94
3 61 94 62
3 62 94 95
3 62 95 63
3 63 95 96
3 63 96 64
3 64 96 65
3 64 65 33
3 65 97 98
3 65 98 66
3 66 98 99
3 66 99 67
3 67 99 100
3 67 100 68
3 68 100 101
3 68 101 69
3 69 101 102
3 69 102 70
3 70 102 103
3 70 103 71
3 71 103 104
3 71 104 72
3 72 104 105
3 72 105 73
3 73 105 106
3 73 106 74
3 74 106 107
3 74 107 75
3 75 107 108
3 75 108 76
3 76 108 109
3 76 109 77
3 77 109 110
3 77 110 78
3 78 110 111
3 78 111 79
3 79 111 112
3 79 112 80
3 80 112 113
3 80 113 81
3 81 113 114
3 81 114 82
3 82 114 115
3 82 115 83
3 83 115 116
3 83 116 84
3 84 116 117
3 84 117 85
3 85 117 118
3 85 118 86
3 86 118 119
3 86 119 87
3 87 119 120
3 87 120 88
3 88 120 121
3 88 121 89
3 89 121 122
3 89 122 90
3 90 122 123
3 90 123 91
3 91 123 124
3 91 124 92
3 92 124 125
3 92 125 93
3 93 125 126
3 93 126 94
3 94 126 127
3 94 127 95
3 95 127 128
3 95 128 96
3 96 128 97
3 96 97 65
3 97 129 130
3 97 130 98
3 98 130 131
3 98 131 99
3 99 131 132
3 99 132 100
3 100 132 133
3 100 133 101
3 101 133 134
3 101 134 102
3 102 134 135
3 102 135 103
3 103 135 136
3 103 136 104
3 104 136 137
3 104 137 105
3 105 137 138
3 105 138 106
3 106 138 139
3 106 139 107
3 107 139 140
3 107 140 108
3 108 140 141
3 108 141 109
3 109 141 142
3 109 142 110
3 110 142 143
3 110 143 111
3 111 143 144
3 111 144 112
3 112 144 145
3 112 145 113
3 113 145 146
3 113 146 114
3 114 146 147
3 114 147 115
3 115 147 148
3 115 148 116
3 116 148 149
3 116 149 117
3 117 149 150
3 117 150 118
3 118 150 151
3 118 151 119
3 119 151 152
3 119 152 120
3 120 152 153
3 120 153 121
3 121 153 154
3 121 154 122
3 122 154 155
3 122 155 123
3 123 155 156
3 123 156 124
3 124 156 157
3 124 157 125
3 125 157 158
3 125 158 126
3 126 158 159
3 126 159 127
3 127 159 160
3 127 160 128
3 128 160 129
3 128 129 97
3 129 161 162
3 129 162 130
3 130 162 163
3 130 163 131
3 131 163 164
3 131 164 132
3 132 164 165
3 132 165 133
3 133 165 166
3 133 166 134
3 134 166 167
3 134 167 135
3 135 167 168
3 135 168 136
3 136 168 169
3 136 169 137
3 137 169 170
3 137 170 138
3 138 170 171
3 138 171 139
3 139 171 172
3 139 172 140
3 140 172 173
3 140 173 141
3 141 173 174
3 141 174 142
3 142 174 175
3 142 175 143
3 143 175 176
3 143 176 144
3 144 176 177
3 144 177 145
3 145 177 178
3 145 178 146
3 146 178 179
3 146 179 147
3 147 179 180
3 147 180 148
3 148 180 181
3 148 181 149
3 149 181 182
3 149 182 150
3 150 182 183
3 150 183 151
3 151 183 184
3 151 184 152
3 152 184 185
3 152 185 153
3 153 185 186
3 153 186 154
3 154 186 187
3 154 187 155
3 155 187 188
3 155 188 156
3 156 188 189
3 156 189 157
3 157 189 190
3 157 190 158
3 158 190 191
3 158 191 159
3 159 191 192
3 159 192 160
3 160 192 161
3 160 161 129
3 161 193 194
3 161 194 162
3 162 194 195
3 162 195 163
3 163 195 196
3 163 196 164
3 164 196 197
3 164 197 165
3 165 197 198
3 165 198 166
3 166 198 199
3 166 199 167
3 167 199 200
3 167 200 168
3 168 200 201
3 168 201 169
3 169 201 202
3 169 202 170
3 170 202 203
3 170 203 171
3 171 203 204
3 171 204 172
3 172 204 205
3 172 205 173
3 173 205 206
3 173 206 174
3 174 206 207
3 174 207 175
3 175 207 208
3 175 208 176
3 176 208 209
3 176 209 177
3 177 209 210
3 177 210 178
3 178 210 211
3 178 211 179
3 179 211 212
3 179 212 180
3 180 212 213
3 180 213 181
3 181 213 214
3 181 214 182
3 182 214 215
3 182 215 183
3 183 215 216
3 183 216 184
3 184 216 217
3 184 217 185
3 185 217 218
3 185 218 186
3 186 218 219
3 186 219 187
3 187 219 220
3 187 220 188
3 188 220 221
3 188 221 189
3 189 221 222
3 189 222 190
3 190 222 223
3 190 223 191
3 191 223 224
3 191 224 192
3 192 224 193
3 192 193 161
3 193 225 226
3 193 226 194
3 194 226 227
3 194 227 195
3 195 227 228
3 195 228 196
3 196 228 229
3 196 229 197
3 197 229 230
3 197 230 198
3 198 230 231
3 198 231 199
3 199 231 232
3 199 232 200
3 200 232 233
3 200 233 201
3 201 233 234
3 201 234 202
3 202 234 235
3 202 235 203
3 203 235 236
3 203 236 204
3 204 236 237
3 204 237 205
3 205 237 238
3 205 238 206
3 206 238 239
3 206 239 207
3 207 239 240
3 207 240 208
3 208 240 241
3 208 241 209
3 209 241 242
3 209 242 210
3 210 242 243
3 210 243 211
3 211 243 244
3 211 244 212
3 212 244 245
3 212 245 213
3 213 245 246
3 213 246 214
3 214 246 247
3 214 247 215
3 215 247 248
3 215 248 216
3 216 248 249
3 216 249 217
3 217 249 250
3 217 250 218
3 218 250 251
3 218 251 219
3 219 251 252
3 219 252 220
3 220 252 253
3 220 253 221
3 221 253 254
3 221 254 222
3 222 254 255
3 222 255 223
3 223 255 256
3 223 256 224
3 224 256 225
3 224 225 193
3 225 257 258
3 225 258 226
3 226 258 259
3 226 259 227
3 227 259 260
3 227 260 228
3 228 260 261
3 228 261 229
3 229 261 262
3 229 262 230
3 230 262 263
3 230 263 231
3 231 263 264
3 231 264 232
3 232 264 265
3 232 265 233
3 233 265 266
3 233 266 234
3 234 266 267
3 234 267 235
3 235 267 268
3 235 268 236
3 236 268 269
3 236 269 237
3 237 269 270
3 237 270 238
3 238 270 271
3 238 271 239
3 239 271 272
3 239 272 240
3 240 272 273
3 240 273 241
3 241 273 274
3 241 274 242
3 242 274 275
3 242 275 243
3 243 275 276
3 243 276 244
3 244 276 277
3 244 277 245
3 245 277 278
3 245 278 246
3 246 278 279
3 246 279 247
3 247 279 280
3 247 280 248
3 248 280 281
3 248 281 249
3 249 281 282
3 249 282 250
3 250 282 283
3 250 283 251
3 251 283 284
3 251 284 252
3 252 284 285
3 252 285 253
3 253 285 286
3 253 286 254
3 254 286 287
3 254 287 255
3 255 287 288
3 255 288 256
3 256 288 257
3 256 257 225
3 257 289 290
3 257 290 258
3 258 290 291
3 258 291 259
3 259 291 292
3 259 292 260
3 260 292 293
3 260 293 261
3 261 293 294
3 261 294 262
3 262 294 295
3 262 295 263
3 263 295 296
3 263 296 264
3 264 296 297
3 264 297 265
3 265 297 298
3 265 298 266
3 266 298 299
3 266 299 267
3 267 299 300
3 267 300 268
3 268 300 301
3 268 301 269
3 269 301 302
3 269 302 270
3 270 302 303
3 270 303 271
3 271 303 304
3 271 304 272
3 272 304 305
3 272 305 273
3 273 305 306
3 273 306 274
3 274 306 307
3 274 307 275
3 275 307 308
3 275 308 276
3 276 308 309
3 276 309 277
3 277 309 310
3 277 310 278
3 278 310 311
3 278 311 279
3 279 311 312
3 279 312 280
3 280 312 313
3 280 313 281
3 281 313 314
3 281 314 282
3 282 314 315
3 282 315 283
3 283 315 316
3 283 316 284
3 284 316 317
3 284 317 285
3 285 317 318
3 285 318 286
3 286 318 319
3 286 319 287
3 287 319 320
3 287 320 288
3 288 320 289
3 288 289 257
3 289 321 322
3 289 322 290
3 290 322 323
3 290 323 291
3 291 323 324
3 291 324 292
3 292 324 325
3 292 325 293
3 293 325 326
3 293 326 294
3 294 326 327
3 294 327 295
3 295 327 328
3 295 328 296
3 296 328 329
3 296 329 297
3 297 329 330
3 297 330 298
3 298 330 331
3 298 331 299
3 299 331 332
3 299 332 300
3 300 332 333
3 300 333 301
3 301 333 334
3 301 334 302
3 302 334 335
3 302 335 303
3 303 335 336
3 303 336 304
3 304 336 337
3 304 337 305
3 305 337 338
3 305 338 306
3 306 338 339
3 306 339 307
3 307 339 340
3 307 340 308
3 308 340 341
3 308 341 309
3 309 341 342
3 309 342 310
3 310 342 343
3 310 343 311
3 311 343 344
3 311 344 312
3 312 344 345
3 312 345 313
3 313 345 346
3 313 346 314
3 314 346 347
3 314 347 315
3 315 347 348
3 315 348 316
3 316 348 349
3 316 349 317
3 317 349 350
3 317 350 318
3 318 350 351
3 318 351 319
3 319 351 352
3 319 352 320
3 320 352 321
3 320 321 289
3 321 353 354
3 321 354 322
3 322 354 355
3 322 355 323
3 323 355 356
3 323 356 324
3 324 356 357
3 324 357 325
3 325 357 358
3 325 358 326
3 326 358 359
3 326 359 327
3 327 359 360
3 327 360 328
3 328 360 361
3 328 361 329
3 329 361 362
3 329 362 330
3 330 362 363
3 330 363 331
3 331 363 364
3 331 364 332
3 332 364 365
3 332 365 333
3 333 365 366
3 333 366 334
3 334 366 367
3 334 367 335
3 335 367 368
3 335 368 336
3 336 368 369
3 336 369 337
3 337 369 370
3 337 370 338
3 338 370 371
3 338 371 339
3 339 371 372
3 339 372 340
3 340 372 373
3 340 373 341
3 341 373 374
3 341 374 342
3 342 374 375
3 342 375 343
3 343 375 376
3 343 376 344
3 344 376 377
3 344 377 345
3 345 377 378
3 345 378 346
3 346 378 379
3 346 379 347
3 347 379 380
3 347 380 348
3 348 380 381
3 348 381 349
3 349 381 382
3 349 382 350
3 350 382 383
3 350 383 351
3 351 383 384
3 351 384 352
3 352 384 353
3 352 353 321
3 353 385 386
3 353 386 354
3 354 386 387
3 354 387 355
3 355 387 388
3 355 388 356
3 356 388 389
3 356 389 357
3 357 389 390
3 357 390 358
3 358 390 391
3 358 391 359
3 359 391 392
3 359 392 360
3 360 392 393
3 360 393 361
3 361 393 394
3 361 394 362
3 362 394 395
3 362 395 363
3 363 395 396
3 363 396 364
3 364 396 397
3 364 397 365
3 365 397 398
3 365 398 366
3 366 398 399
3 366 399 367
3 367 399 400
3 367 400 368
3 368 400 401
3 368 401 369
3 369 401 402
3 369 402 370
3 370 402 403
3 370 403 371
3 371 403 404
3 371 404 372
3 372 404 405
3 372 405 373
3 373 405 406
3 373 406 374
3 374 406 407
3 374 407 375
3 375 407 408
3 375 408 376
3 376 408 409
3 376 409 377
3 377 409 410
3 377 410 378
3 378 410 411
3 378 411 379
3 379 411 412
3 379 412 380
3 380 412 413
3 380 413 381
3 381 413 414
3 381 414 382
3 382 414 415
3 382 415 383
3 383 415 416
3 383 416 384
3 384 416 385
3 384 385 353
3 385 417 418
3 385 418 386
3 386 418 419
3 386 419 387
3 387 419 420
3 387 420 388
3 388 420 421
3 388 421 389
3 389 421 422
3 389 422 390
3 390 422 423
3 390 423 391
3 391 423 424
3 391 424 392
3 392 424 425
3 392 425 393
3 393 425 426
3 393 426 394
3 394 426 427
3 394 427 395
3 395 427 428
3 395 428 396
3 396 428 429
3 396 429 397
3 397 429 430
3 397 430 398
3 398 430 431
3 398 431 399
3 399 431 432
3 399 432 400
3 400 432 433
3 400 433 401
3 401 433 434
3 401 434 402
3 402 434 435
3 402 435 403
3 403 435 436
3 403 436 404
3 404 436 437
3 404 437 405
3 405 437 438
3 405 438 406
3 406 438 439
3 406 439 407
3 407 439 440
3 407 440 408
3 408 440 441
3 408 441 409
3 409 441 442
3 409 442 410
3 410 442 443
3 410 443 411
3 411 443 444
3 411 444 412
3 412 444 445
3 412 445 413
3 413 445 446
3 413 446 414
3 414 446 447
3 414 447 415
3 415 447 448
3 415 448 416
3 416 448 417
3 416 417 385
3 417 449 450
3 417 450 418
3 418 450 451
3 418 451 419
3 419 451 452
3 419 452 420
3 420 452 453
3 420 453 421
3 421 453 454
3 421 454 422
3 422 454 455
3 422 455 423
3 423 455 456
3 423 456 424
3 424 456 457
3 424 457 425
3 425 457 458
3 425 458 426
3 426 458 459
3 426 459 427
3 427 459 460
3 427 460 428
3 428 460 461
3 428 461 429
3 429 461 462
3 429 462 430
3 430 462 463
3 430 463 431
3 431 463 464
3 431 464 432
3 432 464 465
3 432 465 433
3 433 465 466
3 433 466 434
3 434 466 467
3 434 467 435
3 435 467 468
3 435 468 436
3 436 468 469
3 436 469 437
3 437 469 470
3 437 470 438
3 438 470 471
3 438 471 439
3 439 471 472
3 439 472 440
3 440 472 473
3 440 473 441
3 441 473 474
3 441 474 442
3 442 474 475
3 442 475 443
3 443 475 476
3 443 476 444
3 444 476 477
3 444 477 445
3 445 477 478
3 445 478 446
3 446 478 479
3 446 479 447
3 447 479 480
3 447 480 448
3 448 480 449
3 448 449 417
3 481 450 449
3 481 451 450
3 481 452 451
3 481 453 452
3 481 454 453
3 481 455 454
3 481 456 455
3 481 457 456
3 481 458 457
3 481 459 458
3 481 460 459
3 481 461 460
3 481 462 461
3 481 463 462
3 481 464 463
3 481 465 464
3 481 466 465
3 481 467 466
3 481 468 467
3 481 469 468
3 481 470 469
3 481 471 470
3 481 472 471
3 481 473 472
3 481 474 473
3 481 475 474
3 481 476 475
3 481 477 476
3 481 478 477
3 481 479 478
3 481 480 479
3 481 449 480
OFF
# cube.off
# A cube
20 36 0
-1 -1 -1
1 -1 -1
-1 1 -1
1 1 -1
-1 -1 1
1 -1 1
-1 1 1
1 1 1
-3 -1 -1
3 -1 -1
-3 1 -1
3 1 -1
-3 -1 1
3 -1 1
-3 1 1
3 1 1
-1 -3 -1
1 -3 -1
-1 -3 1
1 -3 1
3 0 2 1
3 2 3 1
3 9 11 13
3 11 15 13
3 2 6 3
3 6 7 3
3 5 7 4
3 7 6 4
3 12 14 8
3 14 10 8
3 18 16 17
3 18 17 19
3 8 10 0
3 10 2 0
3 3 9 1
3 3 11 9
3 12 6 14
3 12 4 6
3 7 5 15
3 15 5 13
3 14 2 10
3 2 14 6
3 8 0 12
3 4 12 0
3 3 7 11
3 7 15 11
3 5 1 9
3 5 9 13
3 0 1 17
3 0 17 16
3 19 5 18
3 5 4 18
3 0 16 4
3 4 16 18
3 1 5 19
3 17 1 19
\ No newline at end of file
#ifndef AABB_H
#define AABB_H
#include <Eigen/Core>
#include "RigidObject.h"
class AABB {
public:
AABB()
: m_minCoord(
Eigen::Vector3d::Constant(std::numeric_limits<double>::min())),
m_maxCoord(
Eigen::Vector3d::Constant(std::numeric_limits<double>::max())) {}
AABB(const Eigen::Vector3d& minCoord, const Eigen::Vector3d& maxCoord)
: m_minCoord(minCoord), m_maxCoord(maxCoord) {}
const Eigen::Vector3d& getMinCoord() const { return m_minCoord; };
const Eigen::Vector3d& getMaxCoord() const { return m_maxCoord; };
void setMinCoord(const Eigen::Vector3d& minCoord) { m_minCoord = minCoord; }
void setMaxCoord(const Eigen::Vector3d& maxCoord) { m_maxCoord = maxCoord; }
bool testCollision(const AABB& other) const {
if (m_maxCoord.x() < other.m_minCoord.x() ||
other.m_maxCoord.x() < m_minCoord.x())
return false;
if (m_maxCoord.y() < other.m_minCoord.y() ||
other.m_maxCoord.y() < m_minCoord.y())
return false;
if (m_maxCoord.z() < other.m_minCoord.z() ||
other.m_maxCoord.z() < m_minCoord.z())
return false;
return true;
}
void computeAABB(const RigidObject & obj) {
Eigen::MatrixXd V;
Eigen::MatrixXi F;
obj.getMesh(V, F);
Eigen::Vector3d minCoord = V.colwise().minCoeff();
setMinCoord(minCoord);
Eigen::Vector3d maxCoord = V.colwise().maxCoeff();
setMaxCoord(maxCoord);
}
void clear() {
m_minCoord =
Eigen::Vector3d::Constant(std::numeric_limits<double>::min());
m_maxCoord =
Eigen::Vector3d::Constant(std::numeric_limits<double>::max());
}
private:
Eigen::Vector3d m_minCoord;
Eigen::Vector3d m_maxCoord;
};
#endif // AABB_H
\ No newline at end of file
//=============================================================================
// Physically-based Simulation in Computer Graphics
// ETH Zurich
//
// Author: Christian Schumacher
//=============================================================================
#pragma once
#include <vector>
#include <assert.h>
// Simple 2D array
template <typename SCALAR>
class Array2T
{
public:
// Default constructor
Array2T()
{
m_size[0] = 0;
m_size[1] = 0;
}
// Constructor with given size
Array2T(int size0, int size1, SCALAR value = (SCALAR)0)
{
resize(size0, size1, value);
}
// Copy constructor
Array2T(const Array2T<SCALAR> &m)
{
*this = m;
}
// Resize array
void resize(int size0, int size1, SCALAR value = (SCALAR)0)
{
m_size[0] = size0;
m_size[1] = size1;
m_data.resize(size0 * size1, value);
}
// Fill array with scalar s
void fill(SCALAR s)
{
std::fill(m_data.begin(), m_data.end(), s);
}
// Fill array with 0
void zero()
{
fill(0);
}
// Read & write element access
SCALAR& operator()(unsigned int i, unsigned int j)
{
assert(i >= 0 && i < m_size[0] && j >= 0 && j < m_size[1]);
return m_data[i * m_size[1] + j];
}
// Read only element access
const SCALAR& operator()(unsigned int i, unsigned int j) const
{
assert(i >= 0 && i < m_size[0] && j >= 0 && j < m_size[1]);
return m_data[i * m_size[1] + j];
}
// Dimension
int size(int dimension) const
{
assert(dimension >= 0 && dimension < 2);
return (int)m_size[dimension];
}
// Assignment
Array2T<SCALAR> &operator=(const Array2T<SCALAR> &m2)
{
if (&m2 != this)
{
resize(m2.size(0), m2.size(1));
int n = (int)m_data.size();
for (int i = 0; i < n; i++)
m_data[i] = m2.m_data[i];
}
return *this;
}
protected:
unsigned int m_size[2];
std::vector<SCALAR> m_data;
};
typedef Array2T<double> Array2d;
#ifndef ARROW_H
#define ARROW_H
#include <Eigen/Core>
#include <vector>
class Arrow {
public:
Arrow(const Eigen::RowVector3d& s, const Eigen::RowVector3d& e) {
Arrow(s, e, Eigen::RowVector3d(1.0, 0, 0));
}
Arrow(const Eigen::RowVector3d& s, const Eigen::RowVector3d& e,
const Eigen::RowVector3d& c)
: start(s), end(e), color(c) {
direction = (end - start).normalized();
Eigen::RowVector3d per1 =
direction.cross(Eigen::Vector3d(1, 0, 0)).normalized() * 0.5;
if (std::isnan(per1.sum())) {
per1 = direction.cross(Eigen::Vector3d(0, 1, 0)).normalized() * 0.5;
}
Eigen::RowVector3d per2 =
direction.cross(per1.normalized()).normalized() * 0.5;
head.resize(4);
head[0] = end - 0.1 * (direction + per1);
head[1] = end - 0.1 * (direction - per1);
head[2] = end - 0.1 * (direction + per2);
head[3] = end - 0.1 * (direction - per2);
}
Eigen::RowVector3d start;
Eigen::RowVector3d end;
Eigen::RowVector3d direction;
std::vector<Eigen::RowVector3d> head;
Eigen::RowVector3d color;
size_t id;
};
#endif // ARROW_H
\ No newline at end of file
#include "BaseObject.h"
#include <igl/per_face_normals.h>
#include <igl/per_vertex_normals.h>
#include <igl/readOBJ.h>
#include <igl/readOFF.h>
bool BaseObject::loadMesh(const std::string& path) {
bool succ = false;
std::ifstream infile(path);
if (!infile.good()) {
return false;
}
const std::string OFF(".off");
if (path.compare(path.size() - OFF.size(), OFF.size(), OFF) == 0) {
succ = igl::readOFF(path, m_mesh.V, m_mesh.F, m_mesh.V_normals);
if (succ) {
std::cout << "Reading OFF-file from " << path << " ..."
<< std::endl;
}
}
const std::string OBJ(".obj");
if (path.compare(path.size() - OBJ.size(), OBJ.size(), OBJ) == 0) {
succ = igl::readOBJ(path, m_mesh.V, m_mesh.F);
if (succ) {
std::cout << "Reading OBJ-file from " << path << " ..."
<< std::endl;
igl::per_vertex_normals(m_mesh.V, m_mesh.F, m_mesh.V_normals);
}
}
m_mesh.C = Eigen::MatrixXd(1, 3);
m_mesh.C << 255.0 / 255.0, 228.0 / 255.0, 58.0 / 255.0;
return succ;
}
void BaseObject::setMesh(const Eigen::MatrixXd& V, const Eigen::MatrixXi& F) {
m_mesh.V = V;
m_mesh.F = F;
}
void BaseObject::findAndLoadMesh(const std::string& file) {
if (loadMesh(file)) return;
if (loadMesh("data/" + file)) return;
if (loadMesh("../data/" + file)) return;
if (loadMesh("../../data/" + file)) return;
if (loadMesh("../../../data/" + file)) return;
std::cerr << "Failed to find " << file << std::endl;
}
void BaseObject::reset() {
setPosition(Eigen::Vector3d::Zero());
setRotation(Eigen::Matrix3d::Identity());
resetMembers();
}
void BaseObject::recomputeCOM() {
Eigen::Vector3d COM = m_mesh.V.colwise().mean();
m_mesh.V = m_mesh.V.rowwise() - COM.transpose();
}
void BaseObject::setScale(double s) { m_scale = s; }
void BaseObject::setID(int id) { m_id = id; }
void BaseObject::setType(ObjType t) { m_type = t; }
void BaseObject::setPosition(const Eigen::Vector3d& p) { m_position = p; }
void BaseObject::setRotation(const Eigen::Quaterniond& q) {
m_quat = q;
m_rot = q.toRotationMatrix();
}
void BaseObject::setRotation(const Eigen::Matrix3d& R) {
m_rot = R;
m_quat = R;
}
void BaseObject::setColors(const Eigen::MatrixXd& C) { m_mesh.C = C; }
double BaseObject::getScale() const { return m_scale; }
int BaseObject::getID() const { return m_id; }
ObjType BaseObject::getType() const { return m_type; }
Eigen::Vector3d BaseObject::getPosition() const { return m_position; }
Eigen::Quaterniond BaseObject::getRotation() const { return m_quat; }
Eigen::Matrix3d BaseObject::getRotationMatrix() const { return m_rot; }
Eigen::Vector3d BaseObject::getVertexPosition(int vertexIndex) const {
return m_mesh.V.row(vertexIndex) * m_scale *
getRotationMatrix().transpose() +
getPosition().transpose();
}
void BaseObject::getMesh(Eigen::MatrixXd& V, Eigen::MatrixXi& F) const {
// get mesh after rotation and translation
V = (m_mesh.V * m_scale * getRotationMatrix().transpose()).rowwise() +
getPosition().transpose();
F = m_mesh.F;
}
void BaseObject::getColors(Eigen::MatrixXd& C) const { C = m_mesh.C; }
\ No newline at end of file
#ifndef BASEOBJECT_H
#define BASEOBJECT_H
#include <igl/per_face_normals.h>
#include <igl/per_vertex_normals.h>
#include <igl/readOBJ.h>
#include <igl/readOFF.h>
#include <Eigen/Core>
struct Mesh {
Eigen::MatrixXd V;
Eigen::MatrixXi F;
Eigen::MatrixXd C;
// Per face attributes
Eigen::MatrixXd F_normals; // One normal per face
// Per vertex attributes
Eigen::MatrixXd V_normals; // One normal per vertex
// UV parametrization
Eigen::MatrixXd V_uv; // UV vertices
Eigen::MatrixXi F_uv; // optional faces for UVs
};
enum class ObjType { STATIC, DYNAMIC };
class BaseObject {
public:
bool loadMesh(const std::string& path);
void setMesh(const Eigen::MatrixXd& V, const Eigen::MatrixXi& F);
void findAndLoadMesh(const std::string& file);
void reset();
void recomputeCOM();
void setScale(double s);
void setID(int id);
virtual void setType(ObjType t);
void setPosition(const Eigen::Vector3d& p);
void setRotation(const Eigen::Quaterniond& q);
void setRotation(const Eigen::Matrix3d& R);
void setColors(const Eigen::MatrixXd& C);
double getScale() const;
int getID() const;
ObjType getType() const;
Eigen::Vector3d getPosition() const;
Eigen::Quaterniond getRotation() const;
Eigen::Matrix3d getRotationMatrix() const;
Eigen::Vector3d getVertexPosition(int vertexIndex) const;
void getMesh(Eigen::MatrixXd& V, Eigen::MatrixXi& F) const;
void getColors(Eigen::MatrixXd& C) const;
virtual ~BaseObject() {}
protected:
/*
* Reset class variables specific to a certain object. Is called by
* BaseObject::reset().
*/
virtual void resetMembers() = 0;
int m_id = -1;
Mesh m_mesh;
ObjType m_type;
double m_scale = 1.0; // Scale
Eigen::Vector3d m_position; // Position of the center of mass
Eigen::Quaterniond m_quat; // Rotation (quaternion)
Eigen::Matrix3d m_rot; // Rotation (matrix)
};
#endif
\ No newline at end of file
#ifndef GRID2_H
#define GRID2_H
#include <igl/colormap.h>
#include <Eigen/Core>
#include "Array2T.h"
class Grid2 {
public:
Grid2(int res_x, int res_y, double dx) {
m_res_x = res_x;
m_res_y = res_y;
m_dx = dx;
m_x = Array2d(res_x, res_y);
buildMesh();
}
Array2d& x() { return m_x; }
void buildMesh() {
int num_vertices = (m_res_x + 1) * (m_res_y + 1);
int num_faces = m_res_x * m_res_y * 2; // 2 triangles per cell
m_V = Eigen::MatrixXd(num_vertices, 3);
m_F = Eigen::MatrixXi(num_faces, 3);
int i = 0;
for (int y = 0; y <= m_res_y; ++y) {
for (int x = 0; x <= m_res_x; ++x) {
m_V.row(i++) = Eigen::RowVector3d(x, y, 0) * m_dx;
}
}
i = 0;
for (int y = 0; y < m_res_y; ++y) {
for (int x = 0; x < m_res_x; ++x) {
int vid = y * (m_res_x + 1) + x;
int vid_right = vid + 1;
int vid_right_up = vid_right + (m_res_x + 1);
int vid_up = vid + (m_res_x + 1);
m_F.row(i++) = Eigen::RowVector3i(vid, vid_right, vid_right_up);
m_F.row(i++) = Eigen::RowVector3i(vid, vid_right_up, vid_up);
}
}
}
void reset() {
m_x.zero();
}
void applySource(double xmin, double xmax, double ymin, double ymax) {
for (int y = (int)(ymin * m_res_y); y < (int)(ymax * m_res_y); y++) {
for (int x = (int)(xmin * m_res_x); x < (int)(xmax * m_res_x); x++) {
m_x(x, y) = 1.0;
}
}
}
void getMesh(Eigen::MatrixXd& V, Eigen::MatrixXi& F) const {
V = m_V;
F = m_F;
}
void getColors(Eigen::MatrixXd& C, bool normalize=false, bool faceColor=true) const {
if (faceColor) {
if (C.rows() == 0) {
int num_faces = m_res_x * m_res_y * 2; // 2 triangles per cell
C = Eigen::MatrixXd(num_faces, 3);
}
int i = 0;
double cmin = m_x(0, 0);
double cmax = cmin;
for (int y = 0; y < m_res_y; ++y) {
for (int x = 0; x < m_res_x; ++x) {
double c = m_x(x, y);
if (normalize) {
if (c > cmax) cmax = c;
if (c < cmin) cmin = c;
}
else {
C.row(i++).setConstant(c);
C.row(i++).setConstant(c);
}
}
}
if (!normalize) return;
else if (cmin == cmax) {
C.setZero();
return;
}
// std::cout << "cmin:" << cmin << " cmax:" << cmax << std::endl;
for (int y = 0; y < m_res_y; ++y) {
for (int x = 0; x < m_res_x; ++x) {
double c = m_x(x, y);
c = (c - cmin) / (cmax - cmin); // [0,1]
double r, g, b;
igl::colormap(igl::COLOR_MAP_TYPE_VIRIDIS, c, r, g, b);
C.row(i++) = Eigen::RowVector3d(r, g, b);
C.row(i++) = Eigen::RowVector3d(r, g, b);
}
}
}
else {
// vertex color
if (C.rows() == 0) {
int num_vertices = (m_res_x + 1) * (m_res_y + 1);
C = Eigen::MatrixXd(num_vertices, 3);
}
int i = 0;
double cmin = m_x(0, 0);
double cmax = cmin;
for (int y = 0; y <= m_res_y; ++y) {
for (int x = 0; x <= m_res_x; ++x) {
int x0 = std::max(x - 1, 0);
int x1 = std::min(x, m_res_x - 1);
int y0 = std::max(y - 1, 0);
int y1 = std::min(y, m_res_y - 1);
double c00 = m_x(x0, y0);
double c01 = m_x(x0, y1);
double c10 = m_x(x1, y0);
double c11 = m_x(x1, y1);
double c = (c00 + c01 + c10 + c11) / 4;
if (normalize) {
if (c > cmax) cmax = c;
if (c < cmin) cmin = c;
}
C.row(i++).setConstant(c);
}
}
if (!normalize) return;
else if (cmin == cmax) {
C.setZero();
return;
}
i = 0;
// std::cout << "cmin:" << cmin << " cmax:" << cmax << std::endl;
for (int y = 0; y <= m_res_y; ++y) {
for (int x = 0; x <= m_res_x; ++x) {
double c = (C(i, 0) - cmin) / (cmax - cmin); // [0,1]
double r, g, b;
igl::colormap(igl::COLOR_MAP_TYPE_VIRIDIS, c, r, g, b);
C.row(i++) = Eigen::RowVector3d(r, g, b);
}
}
}
}
protected:
int m_res_x, m_res_y;
double m_dx;
Array2d m_x;
Eigen::MatrixXd m_V;
Eigen::MatrixXi m_F;
};
#endif // GRID2_H
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment