fix performance-*
* performance-type-promotion-in-math-fn * performance-trivially-destructible * performance-noexcept-move-constructor * performance-faster-string-find
This commit is contained in:
@@ -65,7 +65,8 @@ int BoundBoxPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
double xMax = 0.0;
|
||||
double yMax = 0.0;
|
||||
double zMax = 0.0;
|
||||
PyObject *object1 {}, *object2 {};
|
||||
PyObject* object1 {};
|
||||
PyObject* object2 {};
|
||||
BoundBoxPy::PointerType ptr = getBoundBoxPtr();
|
||||
if (PyArg_ParseTuple(args, "d|ddddd", &xMin, &yMin, &zMin, &xMax, &yMax, &zMax)) {
|
||||
ptr->MaxX = xMax;
|
||||
|
||||
@@ -1073,7 +1073,7 @@ std::vector<T> InventorLoader::readData(const char* fieldName) const
|
||||
bool found = false;
|
||||
while (std::getline(inp, str)) {
|
||||
std::string::size_type point = str.find(fieldName);
|
||||
std::string::size_type open = str.find("[");
|
||||
std::string::size_type open = str.find('[');
|
||||
if (point != std::string::npos && open > point) {
|
||||
str = str.substr(open);
|
||||
found = true;
|
||||
@@ -1101,7 +1101,7 @@ std::vector<T> InventorLoader::readData(const char* fieldName) const
|
||||
}
|
||||
|
||||
// search for ']' to finish the reading
|
||||
if (str.find("]") != std::string::npos) {
|
||||
if (str.find(']') != std::string::npos) {
|
||||
break;
|
||||
}
|
||||
} while (std::getline(inp, str));
|
||||
|
||||
@@ -36,8 +36,6 @@ CoordinateSystem::CoordinateSystem()
|
||||
, ydir(0, 1, 0)
|
||||
{}
|
||||
|
||||
CoordinateSystem::~CoordinateSystem() = default;
|
||||
|
||||
void CoordinateSystem::setAxes(const Axis& vec, const Vector3d& xd)
|
||||
{
|
||||
if (xd.Sqr() < Base::Vector3d::epsilon()) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
CoordinateSystem();
|
||||
CoordinateSystem(const CoordinateSystem&) = default;
|
||||
CoordinateSystem(CoordinateSystem&&) = default;
|
||||
~CoordinateSystem();
|
||||
~CoordinateSystem() = default;
|
||||
|
||||
CoordinateSystem& operator=(const CoordinateSystem&) = default;
|
||||
CoordinateSystem& operator=(CoordinateSystem&&) = default;
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
//@}
|
||||
|
||||
/** Specialty constructors */
|
||||
static Rotation slerp(const Rotation& q1, const Rotation& q2, double t);
|
||||
static Rotation slerp(const Rotation& q0, const Rotation& q1, double t);
|
||||
static Rotation identity();
|
||||
|
||||
/**
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
// operators
|
||||
inline BoundBox2d& operator=(const BoundBox2d&) = default;
|
||||
inline BoundBox2d& operator=(BoundBox2d&&) = default;
|
||||
inline bool operator==(const BoundBox2d& rclBB) const;
|
||||
inline bool operator==(const BoundBox2d& bbox) const;
|
||||
|
||||
// methods
|
||||
inline double Width() const;
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
~Polygon2d() = default;
|
||||
|
||||
inline Polygon2d& operator=(const Polygon2d& rclP);
|
||||
inline Polygon2d& operator=(Polygon2d&& rclP);
|
||||
inline Polygon2d& operator=(Polygon2d&& rclP) noexcept;
|
||||
|
||||
// admin-interface
|
||||
inline size_t GetCtVectors() const;
|
||||
@@ -382,7 +382,7 @@ inline bool Vector2d::IsEqual(const Vector2d& v, double tolerance) const
|
||||
|
||||
inline Polygon2d& Polygon2d::operator=(const Polygon2d& rclP) = default;
|
||||
|
||||
inline Polygon2d& Polygon2d::operator=(Polygon2d&& rclP) = default;
|
||||
inline Polygon2d& Polygon2d::operator=(Polygon2d&& rclP) noexcept = default;
|
||||
|
||||
inline void Polygon2d::DeleteAll()
|
||||
{
|
||||
|
||||
@@ -60,12 +60,12 @@ public:
|
||||
Line3() = default;
|
||||
~Line3() = default;
|
||||
Line3(const Line3& line) = default;
|
||||
Line3(Line3&& line) = default;
|
||||
Line3(Line3&& line) noexcept = default;
|
||||
Line3(const Vector3<float_type>& p1, const Vector3<float_type>& p2);
|
||||
|
||||
// operators
|
||||
Line3& operator=(const Line3& line) = default;
|
||||
Line3& operator=(Line3&& line) = default;
|
||||
Line3& operator=(Line3&& line) noexcept = default;
|
||||
bool operator==(const Line3& line) const;
|
||||
|
||||
// methods
|
||||
@@ -112,10 +112,10 @@ public:
|
||||
Polygon3() = default;
|
||||
~Polygon3() = default;
|
||||
Polygon3(const Polygon3<float_type>& poly) = default;
|
||||
Polygon3(Polygon3<float_type>&& poly) = default;
|
||||
Polygon3(Polygon3<float_type>&& poly) noexcept = default;
|
||||
|
||||
Polygon3& operator=(const Polygon3<float_type>& poly) = default;
|
||||
Polygon3& operator=(Polygon3<float_type>&& poly) = default;
|
||||
Polygon3& operator=(Polygon3<float_type>&& poly) noexcept = default;
|
||||
|
||||
size_t GetSize() const;
|
||||
void Add(const Vector3<float_type>& pnt);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
#include "Vector3D.h"
|
||||
@@ -215,9 +216,9 @@ bool Vector3<_Precision>::operator!=(const Vector3<_Precision>& rcVct) const
|
||||
template<class _Precision>
|
||||
bool Vector3<_Precision>::operator==(const Vector3<_Precision>& rcVct) const
|
||||
{
|
||||
return (fabs(x - rcVct.x) <= traits_type::epsilon())
|
||||
&& (fabs(y - rcVct.y) <= traits_type::epsilon())
|
||||
&& (fabs(z - rcVct.z) <= traits_type::epsilon());
|
||||
return (std::fabs(x - rcVct.x) <= traits_type::epsilon())
|
||||
&& (std::fabs(y - rcVct.y) <= traits_type::epsilon())
|
||||
&& (std::fabs(z - rcVct.z) <= traits_type::epsilon());
|
||||
}
|
||||
|
||||
template<class _Precision>
|
||||
@@ -254,15 +255,16 @@ _Precision Vector3<_Precision>::DistanceToPlane(const Vector3<_Precision>& rclBa
|
||||
template<class _Precision>
|
||||
_Precision Vector3<_Precision>::Length() const
|
||||
{
|
||||
return static_cast<_Precision>(sqrt((x * x) + (y * y) + (z * z)));
|
||||
return static_cast<_Precision>(std::sqrt((x * x) + (y * y) + (z * z)));
|
||||
}
|
||||
|
||||
template<class _Precision>
|
||||
_Precision Vector3<_Precision>::DistanceToLine(const Vector3<_Precision>& rclBase,
|
||||
const Vector3<_Precision>& rclDirect) const
|
||||
_Precision Vector3<_Precision>::DistanceToLine(const Vector3<_Precision>& base,
|
||||
const Vector3<_Precision>& dir) const
|
||||
{
|
||||
return static_cast<_Precision>(
|
||||
fabs((rclDirect % Vector3(*this - rclBase)).Length() / rclDirect.Length()));
|
||||
// clang-format off
|
||||
return static_cast<_Precision>(std::fabs((dir % Vector3(*this - base)).Length() / dir.Length()));
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
template<class _Precision>
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
/// Construction
|
||||
explicit Vector3(_Precision fx = 0.0, _Precision fy = 0.0, _Precision fz = 0.0);
|
||||
Vector3(const Vector3<_Precision>& v) = default;
|
||||
Vector3(Vector3<_Precision>&& v) = default;
|
||||
Vector3(Vector3<_Precision>&& v) noexcept = default;
|
||||
~Vector3() = default;
|
||||
|
||||
/** @name Operator */
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
Vector3& operator/=(_Precision fDiv);
|
||||
/// Assignment
|
||||
Vector3& operator=(const Vector3<_Precision>& v) = default;
|
||||
Vector3& operator=(Vector3<_Precision>&& v) = default;
|
||||
Vector3& operator=(Vector3<_Precision>&& v) noexcept = default;
|
||||
/// Scalar product
|
||||
_Precision operator*(const Vector3<_Precision>& rcVct) const;
|
||||
/// Scalar product
|
||||
|
||||
Reference in New Issue
Block a user