Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reformat everything #85

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
Expand All @@ -16,7 +16,7 @@ AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterCaseLabel: true
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
Expand Down
31 changes: 31 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions src/benchmarks/bench_matmul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,27 @@
namespace bricksim {
TEST_CASE("matrix_multiplication") {
BENCHMARK_ADVANCED("glm")
(Catch::Benchmark::Chronometer meter) {
glm::vec4 p0 = GENERATE_RANDOM_VEC4();
glm::mat4 m0 = {
GENERATE_RANDOM_VEC4(),
GENERATE_RANDOM_VEC4(),
GENERATE_RANDOM_VEC4(),
GENERATE_RANDOM_VEC4(),
};
meter.measure([&] { return p0 * m0; });
};
(Catch::Benchmark::Chronometer meter) {
glm::vec4 p0 = GENERATE_RANDOM_VEC4();
glm::mat4 m0 = {
GENERATE_RANDOM_VEC4(),
GENERATE_RANDOM_VEC4(),
GENERATE_RANDOM_VEC4(),
GENERATE_RANDOM_VEC4(),
};
meter.measure([&] { return p0 * m0; });
};
BENCHMARK_ADVANCED("eigen")
(Catch::Benchmark::Chronometer meter) {
Eigen::Vector4f p0 = GENERATE_RANDOM_EVEC4();
Eigen::Matrix4f m0;
m0 << GENERATE_RANDOM_EVEC4(),
GENERATE_RANDOM_EVEC4(),
GENERATE_RANDOM_EVEC4(),
GENERATE_RANDOM_EVEC4();
meter.measure([&] {
return Eigen::Vector4f(m0*p0);
});
};
(Catch::Benchmark::Chronometer meter) {
Eigen::Vector4f p0 = GENERATE_RANDOM_EVEC4();
Eigen::Matrix4f m0;
m0 << GENERATE_RANDOM_EVEC4(),
GENERATE_RANDOM_EVEC4(),
GENERATE_RANDOM_EVEC4(),
GENERATE_RANDOM_EVEC4();
meter.measure([&] {
return Eigen::Vector4f(m0 * p0);
});
};
}
}
38 changes: 19 additions & 19 deletions src/benchmarks/bench_triangle_clockwise_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
namespace bricksim {
TEST_CASE("triangle_clockwise_check") {
BENCHMARK_ADVANCED("discr")
(Catch::Benchmark::Chronometer meter) {
glm::vec2 p0 = GENERATE_RANDOM_VEC();
glm::vec2 p1 = GENERATE_RANDOM_VEC();
glm::vec2 p2 = GENERATE_RANDOM_VEC();
meter.measure([&] { return geometry::is2dTriangleClockwise(p0, p1, p2); });
};
(Catch::Benchmark::Chronometer meter) {
glm::vec2 p0 = GENERATE_RANDOM_VEC();
glm::vec2 p1 = GENERATE_RANDOM_VEC();
glm::vec2 p2 = GENERATE_RANDOM_VEC();
meter.measure([&] { return geometry::is2dTriangleClockwise(p0, p1, p2); });
};
BENCHMARK_ADVANCED("determinant")
(Catch::Benchmark::Chronometer meter) {
glm::vec2 p0 = GENERATE_RANDOM_VEC();
glm::vec2 p1 = GENERATE_RANDOM_VEC();
glm::vec2 p2 = GENERATE_RANDOM_VEC();
meter.measure([&] {
const auto det = glm::determinant(glm::mat3{
glm::vec3(p0, 1.f),
glm::vec3(p1, 1.f),
glm::vec3(p2, 1.f),
});
return det < 0;
});
};
(Catch::Benchmark::Chronometer meter) {
glm::vec2 p0 = GENERATE_RANDOM_VEC();
glm::vec2 p1 = GENERATE_RANDOM_VEC();
glm::vec2 p2 = GENERATE_RANDOM_VEC();
meter.measure([&] {
const auto det = glm::determinant(glm::mat3{
glm::vec3(p0, 1.f),
glm::vec3(p1, 1.f),
glm::vec3(p2, 1.f),
});
return det < 0;
});
};
}
}
3 changes: 1 addition & 2 deletions src/binary_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

namespace bricksim {
BinaryFile::BinaryFile(std::string name) :
name(std::move(name)) {
}
name(std::move(name)) {}

BinaryFile::BinaryFile(const std::filesystem::path& path) :
name(path.string()) {
Expand Down
4 changes: 2 additions & 2 deletions src/binary_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace bricksim {
std::string name;
std::vector<uint8_t> data;

explicit BinaryFile(std::string name);
explicit BinaryFile(std::string name);
explicit BinaryFile(const std::filesystem::path& path);
};
}
}
1 change: 1 addition & 0 deletions src/config/read.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "data.h"

namespace bricksim::config {
[[nodiscard]] const Config& get();
}
3 changes: 1 addition & 2 deletions src/connection/bounding.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "bounding.h"

namespace bricksim::connection {
}
namespace bricksim::connection {}
4 changes: 4 additions & 0 deletions src/connection/bounding.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <glm/vec3.hpp>
#include <variant>

namespace bricksim::connection {
struct BoundingPnt {
bool operator==(const BoundingPnt& rhs) const = default;
Expand All @@ -12,17 +13,20 @@ namespace bricksim::connection {

bool operator==(const BoundingBox& rhs) const = default;
};

struct BoundingCube {
float radius;

bool operator==(const BoundingCube& rhs) const = default;
};

struct BoundingCyl {
float radius;
float length;

bool operator==(const BoundingCyl& rhs) const = default;
};

struct BoundingSph {
float radius;

Expand Down
10 changes: 5 additions & 5 deletions src/connection/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@


namespace bricksim::connection {

Connection::Connection(const std::shared_ptr<Connector>& connectorA,
const std::shared_ptr<Connector>& connectorB) :
connectorA(connectorA),
connectorB(connectorB),
degreesOfFreedom(),
completelyUsedConnector({true, true}) {
}
completelyUsedConnector({true, true}) {}

Connection::Connection(const std::shared_ptr<Connector>& connectorA,
const std::shared_ptr<Connector>& connectorB,
DegreesOfFreedom degreesOfFreedom,
const std::array<bool, 2>& completelyUsedConnector) :
connectorA(connectorA),
connectorB(connectorB),
degreesOfFreedom(std::move(degreesOfFreedom)),
completelyUsedConnector(completelyUsedConnector) {
}
completelyUsedConnector(completelyUsedConnector) {}

bool Connection::operator==(const Connection& rhs) const {
return connectorA == rhs.connectorA
&& connectorB == rhs.connectorB
&& degreesOfFreedom == rhs.degreesOfFreedom
&& completelyUsedConnector == rhs.completelyUsedConnector;
}

bool Connection::operator!=(const Connection& rhs) const {
return !(rhs == *this);
}
Expand Down
Loading