blender/tests/gtests/blenlib/BLI_math_geom_test.cc
Campbell Barton e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00

22 lines
539 B
C++

/* Apache License, Version 2.0 */
#include "testing/testing.h"
#include "BLI_math.h"
#include "stubs/bf_intern_eigen_stubs.h"
TEST(math_geom, DistToLine2DSimple)
{
float p[2] = {5.0f, 1.0f}, a[2] = {0.0f, 0.0f}, b[2] = {2.0f, 0.0f};
float distance = dist_to_line_v2(p, a, b);
EXPECT_NEAR(1.0f, distance, 1e-6);
}
TEST(math_geom, DistToLineSegment2DSimple)
{
float p[2] = {3.0f, 1.0f}, a[2] = {0.0f, 0.0f}, b[2] = {2.0f, 0.0f};
float distance = dist_to_line_segment_v2(p, a, b);
EXPECT_NEAR(sqrtf(2.0f), distance, 1e-6);
}