fix physics-tests build errors

This commit is contained in:
Andrew Meadows 2015-07-28 12:24:17 -07:00
parent 2aa453b610
commit d03a7d1b70
8 changed files with 18 additions and 126 deletions

View file

@ -9,13 +9,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "BulletUtilTests.h"
#include <iostream>
//#include "PhysicsTestUtil.h"
#include <BulletUtil.h>
#include <NumericalConstants.h>
#include "BulletUtilTests.h"
// Add additional qtest functionality (the include order is important!)
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
// Constants
const glm::vec3 origin(0.0f);

View file

@ -13,9 +13,6 @@
#define hifi_BulletUtilTests_h
#include <QtTest/QtTest>
// Add additional qtest functionality (the include order is important!)
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
class BulletUtilTests : public QObject {
Q_OBJECT

View file

@ -1,70 +0,0 @@
//
// CollisionInfoTests.cpp
// tests/physics/src
//
// Created by Andrew Meadows on 2/21/2014.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <iostream>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <CollisionInfo.h>
#include <SharedUtil.h>
#include <StreamUtils.h>
#include "CollisionInfoTests.h"
QTEST_MAIN(CollisionInfoTests)
/*
static glm::vec3 xAxis(1.0f, 0.0f, 0.0f);
static glm::vec3 xZxis(0.0f, 1.0f, 0.0f);
static glm::vec3 xYxis(0.0f, 0.0f, 1.0f);
void CollisionInfoTests::rotateThenTranslate() {
CollisionInfo collision;
collision._penetration = xAxis;
collision._contactPoint = xYxis;
collision._addedVelocity = xAxis + xYxis + xZxis;
glm::quat rotation = glm::angleAxis(PI_OVER_TWO, zAxis);
float distance = 3.0f;
glm::vec3 translation = distance * xYxis;
collision.rotateThenTranslate(rotation, translation);
QCOMPARE(collision._penetration, xYxis);
glm::vec3 expectedContactPoint = -xAxis + translation;
QCOMPARE(collision._contactPoint, expectedContactPoint);
glm::vec3 expectedAddedVelocity = xYxis - xAxis + xZxis;
QCOMPARE(collision._addedVelocity, expectedAddedVelocity);
}
void CollisionInfoTests::translateThenRotate() {
CollisionInfo collision;
collision._penetration = xAxis;
collision._contactPoint = xYxis;
collision._addedVelocity = xAxis + xYxis + xZxis;
glm::quat rotation = glm::angleAxis( -PI_OVER_TWO, zAxis);
float distance = 3.0f;
glm::vec3 translation = distance * xYxis;
collision.translateThenRotate(translation, rotation);
QCOMPARE(collision._penetration, -xYxis);
glm::vec3 expectedContactPoint = (1.0f + distance) * xAxis;
QCOMPARE(collision._contactPoint, expectedContactPoint);
glm::vec3 expectedAddedVelocity = - xYxis + xAxis + xYxis;
QCOMPARE(collision._addedVelocity, expectedAddedVelocity);
}*/

View file

@ -1,29 +0,0 @@
//
// CollisionInfoTests.h
// tests/physics/src
//
// Created by Andrew Meadows on 2/21/2014.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_CollisionInfoTests_h
#define hifi_CollisionInfoTests_h
#include <QtTest/QtTest>
// Add additional qtest functionality (the include order is important!)
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
class CollisionInfoTests : public QObject {
Q_OBJECT
private slots:
// void rotateThenTranslate();
// void translateThenRotate();
};
#endif // hifi_CollisionInfoTests_h

View file

@ -9,11 +9,15 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "MeshMassPropertiesTests.h"
#include <iostream>
#include <string>
#include <MeshMassProperties.h>
#include "MeshMassPropertiesTests.h"
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
const btScalar acceptableRelativeError(1.0e-5f);
const btScalar acceptableAbsoluteError(1.0e-4f);

View file

@ -13,12 +13,6 @@
#define hifi_MeshMassPropertiesTests_h
#include <QtTest/QtTest>
#include <QtGlobal>
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
// Relative error macro (see errorTest in BulletTestUtils.h)
#define QCOMPARE_WITH_RELATIVE_ERROR(actual, expected, relativeError) \

View file

@ -9,12 +9,15 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "ShapeColliderTests.h"
//#include <stdio.h>
#include <iostream>
#include <math.h>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <QtGlobal>
#include <AACubeShape.h>
#include <CapsuleShape.h>
@ -25,7 +28,10 @@
#include <SphereShape.h>
#include <StreamUtils.h>
#include "ShapeColliderTests.h"
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
const glm::vec3 origin(0.0f);
@ -1553,8 +1559,6 @@ void ShapeColliderTests::rayHitsCapsule() {
intersection._rayDirection = - xAxis;
QCOMPARE(capsule.findRayIntersection(intersection), true);
float expectedDistance = startDistance - radius * sqrtf(2.0f * delta); // using small angle approximation of cosine
// float relativeError = fabsf(intersection._hitDistance - expectedDistance) / startDistance;
// for edge cases we allow a LOT of error
QCOMPARE_WITH_ABS_ERROR(intersection._hitDistance, expectedDistance, startDistance * EDGE_CASE_SLOP_FACTOR * EPSILON);
}
@ -1564,8 +1568,6 @@ void ShapeColliderTests::rayHitsCapsule() {
intersection._rayDirection = - xAxis;
QCOMPARE(capsule.findRayIntersection(intersection), true);
float expectedDistance = startDistance - radius * sqrtf(2.0f * delta); // using small angle approximation of cosine
// float relativeError = fabsf(intersection._hitDistance - expectedDistance) / startDistance;
// for edge cases we allow a LOT of error
QCOMPARE_WITH_ABS_ERROR(intersection._hitDistance, expectedDistance, startDistance * EPSILON * EDGE_CASE_SLOP_FACTOR);
}
@ -1575,8 +1577,6 @@ void ShapeColliderTests::rayHitsCapsule() {
intersection._rayDirection = - xAxis;
QCOMPARE(capsule.findRayIntersection(intersection), true);
float expectedDistance = startDistance - radius * sqrtf(2.0f * delta); // using small angle approximation of cosine
float relativeError = fabsf(intersection._hitDistance - expectedDistance) / startDistance;
// for edge cases we allow a LOT of error
QCOMPARE_WITH_ABS_ERROR(intersection._hitDistance, expectedDistance, startDistance * EPSILON * EDGE_CASE_SLOP_FACTOR);
}
// TODO: test at steep angles near cylinder/cap junction

View file

@ -13,13 +13,6 @@
#define hifi_ShapeColliderTests_h
#include <QtTest/QtTest>
#include <QtGlobal>
// Add additional qtest functionality (the include order is important!)
#include "BulletTestUtils.h"
#include "GlmTestUtils.h"
#include "../QTestExtensions.h"
class ShapeColliderTests : public QObject {
Q_OBJECT