// 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 "Direction.h" #include "Quaternion.h" #include "Vector3.h" #include template Direction::Direction() { this->horizontalAngle = AngleOf(0.0f); this->verticalAngle = AngleOf(0.0f); } template Direction::Direction(AngleOf horizontal, AngleOf vertical) { this->horizontalAngle = horizontal; this->verticalAngle = vertical; }; template Direction::Direction(Vector3 v) { this->horizontalAngle = atan2f(v.Right(), v.Forward()) * Passer::LinearAlgebra::Rad2Deg; this->verticalAngle = 90 - acosf(v.Up()) * Passer::LinearAlgebra::Rad2Deg; } template const Direction Direction::forward = Direction(0.0f, 0.0f); template const Direction Direction::back = Direction(180.0f, 0.0f); template const Direction Direction::up = Direction(0.0f, 90.0f); template const Direction Direction::down = Direction(0.0f, -90.0f); template const Direction Direction::left = Direction(-90.0f, 0.0f); template const Direction Direction::right = Direction(90.0f, 0.0f); template Vector3 Direction::ToVector3() { Vector3 v = Quaternion::Euler(-(this->verticalAngle.ToFloat()), this->horizontalAngle.ToFloat(), 0) * Vector3::forward; return v; } template class Direction; template class Direction; template class Direction;