added small eigen example
This commit is contained in:
parent
a1d55299a1
commit
fa806f62fa
@ -2,6 +2,14 @@ cmake_minimum_required(VERSION 3.10)
|
|||||||
|
|
||||||
project(Geometry)
|
project(Geometry)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
add_subdirectory(lib/eigen)
|
||||||
|
|
||||||
add_executable(Geometry main.cpp)
|
add_executable(Geometry main.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(Geometry PUBLIC Eigen3::Eigen)
|
||||||
|
|
||||||
|
target_include_directories(Geometry PUBLIC "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/lib/eigen/Eigen")
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
#define GEOMETRY_MAIN_H
|
#define GEOMETRY_MAIN_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <Dense>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
void eigenExample();
|
||||||
|
|
||||||
int main();
|
int main();
|
||||||
|
|
||||||
#endif //GEOMETRY_MAIN_H
|
#endif //GEOMETRY_MAIN_H
|
||||||
|
11
main.cpp
11
main.cpp
@ -1,6 +1,15 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
cout<<"Hello World";
|
cout<<"Hello World"<<endl;
|
||||||
|
eigenExample();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void eigenExample(){
|
||||||
|
Eigen::MatrixXd m(2,2);
|
||||||
|
m(1,0) = 2.5;
|
||||||
|
m(0,1) = -1;
|
||||||
|
m(1,1) = m(1,0) + m(0,1);
|
||||||
|
cout << m << endl;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user