Compare commits

..

No commits in common. "3cf5815c95b28fcf4a28afef9a545562df362334" and "ed622216f9e2347c8002d267412ac8c66927bb7e" have entirely different histories.

5 changed files with 1 additions and 80 deletions

View file

@ -6,7 +6,7 @@ set(SC_3D_CollisionDetectionHelpers_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/src/sc_
add_library(SC_3D_CollisionDetectionHelpers ${SC_3D_CollisionDetectionHelpers_SOURCES})
set_target_properties(SC_3D_CollisionDetectionHelpers PROPERTIES VERSION 3.2.0 SOVERSION 3)
set_target_properties(SC_3D_CollisionDetectionHelpers PROPERTIES VERSION 3.1.0 SOVERSION 3)
target_compile_features(SC_3D_CollisionDetectionHelpers PUBLIC cxx_std_20)
if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")

View file

@ -1,9 +1,5 @@
# Changelog
## Version 3.2.0
Add Vec3 negate and normalize functions.
## Version 3.1.0
Add Vec3 helper functions.

View file

@ -684,14 +684,6 @@ SC_SACD_Vec3 SC_SACD_Vec3_Div(SC_SACD_Vec3 vec, float scalar) {
return vec / scalar;
}
SC_SACD_Vec3 SC_SACD_Vec3_Negate(SC_SACD_Vec3 vec) {
return SC_SACD_Vec3{-vec.x, -vec.y, -vec.z};
}
SC_SACD_Vec3 SC_SACD_Vec3_Normalize(SC_SACD_Vec3 vec) {
return vec / SC_SACD_Vec3_Length(vec);
}
SC_SACD_Vec3 SC_SACD_Vec3_Project(SC_SACD_Vec3 vec, SC_SACD_Vec3 target) {
float upper_dot_product = SC_SACD_Dot_Product(vec, target);
float lower_dot_product = SC_SACD_Dot_Product(target, target);

View file

@ -142,11 +142,6 @@ SC_SACD_EXPORT SC_SACD_Vec3 SC_SACD_Vec3_Difference(SC_SACD_Vec3 a,
SC_SACD_EXPORT SC_SACD_Vec3 SC_SACD_Vec3_Mult(SC_SACD_Vec3 vec, float scalar);
SC_SACD_EXPORT SC_SACD_Vec3 SC_SACD_Vec3_Div(SC_SACD_Vec3 vec, float scalar);
SC_SACD_EXPORT SC_SACD_Vec3 SC_SACD_Vec3_Negate(SC_SACD_Vec3 vec);
/// Turns vec into a unit vector and returns the unit vector.
SC_SACD_EXPORT SC_SACD_Vec3 SC_SACD_Vec3_Normalize(SC_SACD_Vec3 vec);
/// Projects "vec" onto "target".
SC_SACD_EXPORT SC_SACD_Vec3 SC_SACD_Vec3_Project(SC_SACD_Vec3 vec,
SC_SACD_Vec3 target);

View file

@ -840,68 +840,6 @@ int main() {
CHECK_FLOAT(result.z, 3.0F);
}
// Test negate.
{
SC_SACD_Vec3 vec{1.0F, 2.0F, 3.0F};
vec = SC_SACD_Vec3_Negate(vec);
CHECK_FLOAT(vec.x, -1.0F);
CHECK_FLOAT(vec.y, -2.0F);
CHECK_FLOAT(vec.z, -3.0F);
}
// Test normalize.
{
SC_SACD_Vec3 vec{1.0F, 0.0F, 0.0F};
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, 1.0F);
CHECK_FLOAT(vec.y, 0.0F);
CHECK_FLOAT(vec.z, 0.0F);
vec.x = 0.0F;
vec.y = -1.0F;
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, 0.0F);
CHECK_FLOAT(vec.y, -1.0F);
CHECK_FLOAT(vec.z, 0.0F);
vec.y = 0.0F;
vec.z = 0.7F;
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, 0.0F);
CHECK_FLOAT(vec.y, 0.0F);
CHECK_FLOAT(vec.z, 1.0F);
vec.x = 1.0F;
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, std::sqrt(0.5F));
CHECK_FLOAT(vec.y, 0.0F);
CHECK_FLOAT(vec.z, std::sqrt(0.5F));
vec.x = 1.0F;
vec.y = 1.0F;
vec.z = 1.0F;
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, std::sqrt(1.0F / 3.0F));
CHECK_FLOAT(vec.y, std::sqrt(1.0F / 3.0F));
CHECK_FLOAT(vec.z, std::sqrt(1.0F / 3.0F));
vec.x = 1.0F;
vec.y = -1.0F;
vec.z = -1.0F;
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, std::sqrt(1.0F / 3.0F));
CHECK_FLOAT(vec.y, -std::sqrt(1.0F / 3.0F));
CHECK_FLOAT(vec.z, -std::sqrt(1.0F / 3.0F));
vec.x = 1.0F;
vec.y = 2.0F;
vec.z = 3.0F;
vec = SC_SACD_Vec3_Normalize(vec);
CHECK_FLOAT(vec.x, std::sqrt(1.0F / 14.0F));
CHECK_FLOAT(vec.y, std::sqrt(4.0F / 14.0F));
CHECK_FLOAT(vec.z, std::sqrt(9.0F / 14.0F));
}
std::cout << "Checks checked: " << checks_checked << '\n'
<< "Checks passed: " << checks_passed << '\n';