Set position independent code flag
This commit is contained in:
parent
5f6ff853d2
commit
5c11ba83fd
@ -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(
|
||||
|
@ -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;
|
||||
@ -145,7 +142,7 @@ float Vector3::Angle(Vector3 from, Vector3 to) {
|
||||
return fraction; // short cut to returning NaN universally
|
||||
|
||||
float cdot = clamp(fraction, -1.0, 1.0);
|
||||
float r = ((float)acos(cdot))* Rad2Deg;
|
||||
float r = ((float)acos(cdot)) * Rad2Deg;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user