From e91cded83161106314db4d5f9680595d66a6b2c0 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Sun, 5 Nov 2017 23:15:47 +0100 Subject: [PATCH] Update code documentation and fix warnings --- src/collision/shapes/BoxShape.cpp | 1 - src/collision/shapes/BoxShape.h | 15 ++++----------- src/collision/shapes/ConcaveMeshShape.h | 2 +- src/mathematics/Matrix3x3.h | 6 +++--- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/collision/shapes/BoxShape.cpp b/src/collision/shapes/BoxShape.cpp index 01c4d965..6b8c8d6b 100644 --- a/src/collision/shapes/BoxShape.cpp +++ b/src/collision/shapes/BoxShape.cpp @@ -35,7 +35,6 @@ using namespace reactphysics3d; // Constructor /** * @param extent The vector with the three extents of the box (in meters) - * @param margin The collision margin (in meters) around the collision shape */ BoxShape::BoxShape(const Vector3& extent) : ConvexPolyhedronShape(CollisionShapeName::BOX), mExtent(extent) { diff --git a/src/collision/shapes/BoxShape.h b/src/collision/shapes/BoxShape.h index 56c14797..5643a5c8 100644 --- a/src/collision/shapes/BoxShape.h +++ b/src/collision/shapes/BoxShape.h @@ -41,14 +41,7 @@ namespace reactphysics3d { * This class represents a 3D box shape. Those axis are unit length. * The three extents are half-widths of the box along the three * axis x, y, z local axis. The "transform" of the corresponding - * rigid body will give an orientation and a position to the box. This - * collision shape uses an extra margin distance around it for collision - * detection purpose. The default margin is 4cm (if your units are meters, - * which is recommended). In case, you want to simulate small objects - * (smaller than the margin distance), you might want to reduce the margin by - * specifying your own margin distance using the "margin" parameter in the - * constructor of the box shape. Otherwise, it is recommended to use the - * default margin distance by not using the "margin" parameter in the constructor. + * body will give an orientation and a position to the box. */ class BoxShape : public ConvexPolyhedronShape { @@ -171,9 +164,9 @@ inline size_t BoxShape::getSizeInBytes() const { // Return a local support point in a given direction without the objec margin inline Vector3 BoxShape::getLocalSupportPointWithoutMargin(const Vector3& direction) const { - return Vector3(direction.x < 0.0 ? -mExtent.x : mExtent.x, - direction.y < 0.0 ? -mExtent.y : mExtent.y, - direction.z < 0.0 ? -mExtent.z : mExtent.z); + return Vector3(direction.x < decimal(0.0) ? -mExtent.x : mExtent.x, + direction.y < decimal(0.0) ? -mExtent.y : mExtent.y, + direction.z < decimal(0.0) ? -mExtent.z : mExtent.z); } // Return true if a point is inside the collision shape diff --git a/src/collision/shapes/ConcaveMeshShape.h b/src/collision/shapes/ConcaveMeshShape.h index b99f2b4a..82c08794 100644 --- a/src/collision/shapes/ConcaveMeshShape.h +++ b/src/collision/shapes/ConcaveMeshShape.h @@ -103,7 +103,7 @@ class ConcaveMeshRaycastCallback : public DynamicAABBTreeRaycastCallback { // Class ConcaveMeshShape /** * This class represents a static concave mesh shape. Note that collision detection - * with a concave mesh shape can be very expensive. You should use only use + * with a concave mesh shape can be very expensive. You should only use * this shape for a static mesh. */ class ConcaveMeshShape : public ConcaveShape { diff --git a/src/mathematics/Matrix3x3.h b/src/mathematics/Matrix3x3.h index dfa23085..ebb8792d 100644 --- a/src/mathematics/Matrix3x3.h +++ b/src/mathematics/Matrix3x3.h @@ -233,9 +233,9 @@ inline Matrix3x3 Matrix3x3::computeSkewSymmetricMatrixForCrossProduct(const Vect // Return the matrix with absolute values inline Matrix3x3 Matrix3x3::getAbsoluteMatrix() const { - return Matrix3x3(fabs(mRows[0][0]), fabs(mRows[0][1]), fabs(mRows[0][2]), - fabs(mRows[1][0]), fabs(mRows[1][1]), fabs(mRows[1][2]), - fabs(mRows[2][0]), fabs(mRows[2][1]), fabs(mRows[2][2])); + return Matrix3x3(std::fabs(mRows[0][0]), std::fabs(mRows[0][1]), std::fabs(mRows[0][2]), + std::fabs(mRows[1][0]), std::fabs(mRows[1][1]), std::fabs(mRows[1][2]), + std::fabs(mRows[2][0]), std::fabs(mRows[2][1]), std::fabs(mRows[2][2])); } // Overloaded operator for addition