added vector stuff to app

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-07 20:44:56 +02:00
parent aa02ff3faa
commit a00a92a0ee
3 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,3 @@
add_executable(app main.cpp) add_executable(app main.cpp)
target_link_libraries(app PRIVATE block vector) target_link_libraries(app PRIVATE block)

View File

@ -4,5 +4,23 @@
int main(int argc, char **argv) { int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl; std::cout << "Hello, world!" << std::endl;
Volumes::Block block; Volumes::Block block;
Vector::Vector3 vec(1,2,3);
Vector::Vector3 vec2(2,1,3);
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
vec*=2;
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
vec/=2;
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
std::cout<<vec.dot(vec)<<std::endl;
std::cout<<vec.cross(vec2)<<std::endl;
vec.norm();
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
vec-=vec;
std::cout<<vec<<std::endl;
std::cout<<vec.len()<<std::endl;
return 0; return 0;
} }

View File

@ -3,8 +3,6 @@ file(GLOB HEADER_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/include/Block/*")
add_library(block block.cpp vector3.cpp ${HEADER_LIST}) add_library(block block.cpp vector3.cpp ${HEADER_LIST})
add_library(block::block ALIAS block) add_library(block::block ALIAS block)
target_link_libraries(block PUBLIC vector::vector)
target_include_directories(block PUBLIC "${PROJECT_SOURCE_DIR}/include") target_include_directories(block PUBLIC "${PROJECT_SOURCE_DIR}/include")
source_group( source_group(