41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0.If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at https ://mozilla.org/MPL/2.0/.
|
|
/*
|
|
#include "Axis.h"
|
|
|
|
#include "Quaternion.h"
|
|
#include "Vector3.h"
|
|
|
|
#include <math.h>
|
|
|
|
Axis::Axis() {
|
|
horizontalAngle = Angle();
|
|
verticalAngle = Angle();
|
|
}
|
|
|
|
Axis::Axis(Angle horizontal, Angle vertical) {
|
|
this->horizontalAngle = horizontal;
|
|
this->verticalAngle = vertical;
|
|
};
|
|
|
|
Axis::Axis(Vector3 v) {
|
|
this->horizontalAngle =
|
|
atan2f(v.Right(), v.Forward()) * Passer::LinearAlgebra::Rad2Deg;
|
|
this->verticalAngle = 90 - acosf(v.Up()) * Passer::LinearAlgebra::Rad2Deg;
|
|
}
|
|
|
|
const Axis Axis::forward = Axis(0.0f, 0.0f);
|
|
const Axis Axis::back = Axis(180.0f, 0.0f);
|
|
const Axis Axis::up = Axis(0.0f, 90.0f);
|
|
const Axis Axis::down = Axis(0.0f, -90.0f);
|
|
const Axis Axis::left = Axis(-90.0f, 0.0f);
|
|
const Axis Axis::right = Axis(90.0f, 0.0f);
|
|
|
|
Vector3 Axis::ToVector3() {
|
|
Vector3 v = Quaternion::Euler(-(this->verticalAngle.ToFloat()),
|
|
this->horizontalAngle.ToFloat(), 0) *
|
|
Vector3::forward;
|
|
return v;
|
|
}
|
|
*/ |