Base: apply clang format

This commit is contained in:
wmayer
2023-11-10 18:27:44 +01:00
committed by WandererFan
parent bb333d9a74
commit 985def3416
154 changed files with 11874 additions and 9872 deletions

View File

@@ -24,8 +24,8 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <cstdlib>
# include <set>
#include <cstdlib>
#include <set>
#endif
#include "Tools3D.h"
@@ -34,32 +34,31 @@
using namespace Base;
template <typename float_type>
template<typename float_type>
Line3<float_type>::Line3(const Vector3<float_type>& p1, const Vector3<float_type>& p2)
: p1(p1)
, p2(p2)
{
}
: p1(p1)
, p2(p2)
{}
template <typename float_type>
bool Line3<float_type>::operator== (const Line3<float_type>& line) const
template<typename float_type>
bool Line3<float_type>::operator==(const Line3<float_type>& line) const
{
return (p1 == line.p1 && p2 == line.p2);
}
template <typename float_type>
template<typename float_type>
float_type Line3<float_type>::Length() const
{
return Base::Distance(p1, p2);
}
template <typename float_type>
template<typename float_type>
float_type Line3<float_type>::SqrLength() const
{
return Base::DistanceP2(p1, p2);
}
template <typename float_type>
template<typename float_type>
BoundBox3<float_type> Line3<float_type>::CalcBoundBox() const
{
BoundBox3<float_type> box;
@@ -68,40 +67,40 @@ BoundBox3<float_type> Line3<float_type>::CalcBoundBox() const
return box;
}
template <typename float_type>
template<typename float_type>
Vector3<float_type> Line3<float_type>::GetBase() const
{
return p1;
}
template <typename float_type>
template<typename float_type>
Vector3<float_type> Line3<float_type>::GetDirection() const
{
return p2 - p1;
}
template <typename float_type>
template<typename float_type>
void Line3<float_type>::Transform(const Base::Matrix4D& mat)
{
mat.multVec(p1, p1);
mat.multVec(p2, p2);
}
template <typename float_type>
template<typename float_type>
void Line3<float_type>::Transform(const Base::Placement& plm)
{
plm.multVec(p1, p1);
plm.multVec(p2, p2);
}
template <typename float_type>
template<typename float_type>
void Line3<float_type>::Transform(const Base::Rotation& rot)
{
rot.multVec(p1, p1);
rot.multVec(p2, p2);
}
template <typename float_type>
template<typename float_type>
Line3<float_type> Line3<float_type>::Transformed(const Base::Matrix4D& mat) const
{
Line3<float_type> line(*this);
@@ -109,7 +108,7 @@ Line3<float_type> Line3<float_type>::Transformed(const Base::Matrix4D& mat) cons
return line;
}
template <typename float_type>
template<typename float_type>
Line3<float_type> Line3<float_type>::Transformed(const Base::Placement& plm) const
{
Line3<float_type> line(*this);
@@ -117,7 +116,7 @@ Line3<float_type> Line3<float_type>::Transformed(const Base::Placement& plm) con
return line;
}
template <typename float_type>
template<typename float_type>
Line3<float_type> Line3<float_type>::Transformed(const Base::Rotation& rot) const
{
Line3<float_type> line(*this);
@@ -125,25 +124,26 @@ Line3<float_type> Line3<float_type>::Transformed(const Base::Rotation& rot) cons
return line;
}
template <typename float_type>
template<typename float_type>
bool Line3<float_type>::Contains(const Vector3<float_type>& pt) const
{
return Contains(pt, Vector3<float_type>::epsilon());
}
template <typename float_type>
template<typename float_type>
bool Line3<float_type>::Contains(const Vector3<float_type>& pt, float_type eps) const
{
Vector3<float_type> v1 = p1 - pt;
Vector3<float_type> v2 = p2 - pt;
Vector3<float_type> v3 = p2 - p1;
float_type dot = v1.Dot(v2);
if (dot > eps)
if (dot > eps) {
return false;
}
return v3.Cross(v1).Length() < eps;
}
template <typename float_type>
template<typename float_type>
Vector3<float_type> Line3<float_type>::FromPos(float_type distance) const
{
Vector3<float_type> dir(p2 - p1);
@@ -153,43 +153,43 @@ Vector3<float_type> Line3<float_type>::FromPos(float_type distance) const
// ----------------------------------------------------------------------------
template <typename float_type>
template<typename float_type>
size_t Polygon3<float_type>::GetSize() const
{
return points.size();
}
template <typename float_type>
void Polygon3<float_type>::Add (const Vector3<float_type>& p)
template<typename float_type>
void Polygon3<float_type>::Add(const Vector3<float_type>& p)
{
points.push_back(p);
}
template <typename float_type>
const Vector3<float_type>& Polygon3<float_type>::operator[] (size_t pos) const
template<typename float_type>
const Vector3<float_type>& Polygon3<float_type>::operator[](size_t pos) const
{
return points[pos];
}
template <typename float_type>
const Vector3<float_type>& Polygon3<float_type>::At (size_t pos) const
template<typename float_type>
const Vector3<float_type>& Polygon3<float_type>::At(size_t pos) const
{
return points.at(pos);
}
template <typename float_type>
Vector3<float_type>& Polygon3<float_type>::operator[] (size_t pos)
template<typename float_type>
Vector3<float_type>& Polygon3<float_type>::operator[](size_t pos)
{
return points[pos];
}
template <typename float_type>
Vector3<float_type>& Polygon3<float_type>::At (size_t pos)
template<typename float_type>
Vector3<float_type>& Polygon3<float_type>::At(size_t pos)
{
return points.at(pos);
}
template <typename float_type>
template<typename float_type>
bool Polygon3<float_type>::Remove(size_t pos)
{
if (pos < points.size()) {
@@ -202,43 +202,47 @@ bool Polygon3<float_type>::Remove(size_t pos)
return false;
}
template <typename float_type>
template<typename float_type>
void Polygon3<float_type>::Clear()
{
points.clear();
}
template <typename float_type>
template<typename float_type>
BoundBox3<float_type> Polygon3<float_type>::CalcBoundBox() const
{
BoundBox3<float_type> box;
for (const auto& it : points)
for (const auto& it : points) {
box.Add(it);
}
return box;
}
template <typename float_type>
template<typename float_type>
void Polygon3<float_type>::Transform(const Base::Matrix4D& mat)
{
for (auto& it : points)
for (auto& it : points) {
mat.multVec(it, it);
}
}
template <typename float_type>
template<typename float_type>
void Polygon3<float_type>::Transform(const Base::Placement& plm)
{
for (auto& it : points)
for (auto& it : points) {
plm.multVec(it, it);
}
}
template <typename float_type>
template<typename float_type>
void Polygon3<float_type>::Transform(const Base::Rotation& rot)
{
for (auto& it : points)
for (auto& it : points) {
rot.multVec(it, it);
}
}
template <typename float_type>
template<typename float_type>
Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Matrix4D& mat) const
{
Polygon3<float_type> poly(*this);
@@ -246,7 +250,7 @@ Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Matrix4D& mat
return poly;
}
template <typename float_type>
template<typename float_type>
Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Placement& plm) const
{
Polygon3<float_type> poly(*this);
@@ -254,7 +258,7 @@ Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Placement& pl
return poly;
}
template <typename float_type>
template<typename float_type>
Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Rotation& rot) const
{
Polygon3<float_type> poly(*this);
@@ -263,9 +267,10 @@ Polygon3<float_type> Polygon3<float_type>::Transformed(const Base::Rotation& rot
}
// explicit template instantiation
namespace Base {
namespace Base
{
template class BaseExport Line3<float>;
template class BaseExport Line3<double>;
template class BaseExport Polygon3<float>;
template class BaseExport Polygon3<double>;
}
} // namespace Base