Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/maths/tests/test_Bound.h
/* Copyright (C) 2012 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
void test_extend_vector() | void test_extend_vector() | ||||
{ | { | ||||
CBoundingBoxAligned bound; | CBoundingBoxAligned bound; | ||||
CVector3D v (1, 2, 3); | CVector3D v (1, 2, 3); | ||||
bound += v; | bound += v; | ||||
CVector3D centre; | CVector3D center; | ||||
bound.GetCentre(centre); | bound.GetCenter(center); | ||||
TS_ASSERT_EQUALS(centre, v); | TS_ASSERT_EQUALS(center, v); | ||||
} | } | ||||
void test_extend_bound() | void test_extend_bound() | ||||
{ | { | ||||
CBoundingBoxAligned bound; | CBoundingBoxAligned bound; | ||||
CVector3D v (1, 2, 3); | CVector3D v (1, 2, 3); | ||||
CBoundingBoxAligned b (v, v); | CBoundingBoxAligned b (v, v); | ||||
bound += b; | bound += b; | ||||
CVector3D centre; | CVector3D center; | ||||
bound.GetCentre(centre); | bound.GetCenter(center); | ||||
TS_ASSERT_EQUALS(centre, v); | TS_ASSERT_EQUALS(center, v); | ||||
} | } | ||||
void test_aabb_to_obb_translation() | void test_aabb_to_obb_translation() | ||||
{ | { | ||||
CBoundingBoxAligned aabb(CVector3D(-1,-2,-1), CVector3D(1,2,1)); | CBoundingBoxAligned aabb(CVector3D(-1,-2,-1), CVector3D(1,2,1)); | ||||
CMatrix3D translation; | CMatrix3D translation; | ||||
translation.SetTranslation(CVector3D(1,3,7)); | translation.SetTranslation(CVector3D(1,3,7)); | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator