Set position independent code flag

This commit is contained in:
Pascal Serrarens 2022-01-25 17:30:50 +01:00
parent 5f6ff853d2
commit 5c11ba83fd
2 changed files with 5 additions and 7 deletions

View File

@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.13) # CMake version check
project(VectorAlgebra) # Create project "simple_example"
set(CMAKE_CXX_STANDARD 11) # Enable c++14 standard
set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(FetchContent)
FetchContent_Declare(

View File

@ -27,8 +27,7 @@ Vector3::Vector3(Vec3 v) {
z = v.z;
}
Vector3::~Vector3()
{
Vector3::~Vector3() {
}
const Vector3 Vector3::zero = Vector3(0, 0, 0);
@ -110,7 +109,6 @@ Vector3 Vector3::Cross(const Vector3& v1, const Vector3& v2) {
return Vector3(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
}
// Projects a vector onto another vector.
Vector3 Vector3::Project(Vector3 vector, Vector3 onNormal) {
float sqrMagnitude = Dot(onNormal, onNormal);
if (sqrMagnitude < epsilon)
@ -122,7 +120,6 @@ Vector3 Vector3::Project(Vector3 vector, Vector3 onNormal) {
}
}
// Projects a vector onto a plane defined by a normal orthogonal to the plane.
Vector3 Vector3::ProjectOnPlane(Vector3 vector, Vector3 planeNormal) {
Vector3 r = vector - Project(vector, planeNormal);
return r;