Skip to content
Closed
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
11 changes: 10 additions & 1 deletion src/geode/geometry/distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
}
auto area2 = p * ( p - point_to_v0_length ) * ( p - point_to_v1_length )
* ( p - segment_length );
if( area2 <= 0 )

Check warning on line 91 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:91:9 [readability-use-std-min-max]

use `std::max` instead of `<=`
{
area2 = 0;
}
return 2 * std::sqrt( area2 ) / segment_length;
}

void get_min_edge02( double a11, double b1, std::array< double, 2 >& p )

Check warning on line 98 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:98:74 [readability-identifier-length]

parameter name 'p' is too short, expected at least 3 characters

Check warning on line 98 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:98:45 [readability-identifier-length]

parameter name 'b1' is too short, expected at least 3 characters
{
p[0] = 0;
if( b1 >= 0 )
Expand All @@ -112,21 +112,21 @@
}
}

void get_min_edge12( double a01,

Check warning on line 115 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:115:26 [bugprone-easily-swappable-parameters]

2 adjacent parameters of 'get_min_edge12' of similar type ('double') are easily swapped by mistake

Check warning on line 115 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:115:10 [readability-function-size]

function 'get_min_edge12' exceeds recommended size/complexity thresholds
double a11,
double b1,

Check warning on line 117 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:117:16 [readability-identifier-length]

parameter name 'b1' is too short, expected at least 3 characters
double f10,

Check warning on line 118 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:118:9 [bugprone-easily-swappable-parameters]

2 adjacent parameters of 'get_min_edge12' of similar type ('double') are easily swapped by mistake
double f01,
std::array< double, 2 >& p )

Check warning on line 120 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:120:34 [readability-identifier-length]

parameter name 'p' is too short, expected at least 3 characters
{
const auto h0 = a01 + b1 - f10;

Check warning on line 122 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:122:20 [readability-identifier-length]

variable name 'h0' is too short, expected at least 3 characters
if( h0 >= 0 )
{
p[1] = 0;
}
else
{
const auto h1 = a11 + b1 - f01;

Check warning on line 129 in src/geode/geometry/distance.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/geometry/distance.cpp:129:24 [readability-identifier-length]

variable name 'h1' is too short, expected at least 3 characters
if( h1 <= 0 )
{
p[1] = 1;
Expand Down Expand Up @@ -200,9 +200,13 @@
const geode::Triangle3D& triangle,
geode::local_index_t v0 )
{
DEBUG( "pivot_point_triangle_distance with pivot vertex " );
const auto v1 = v0 == 2 ? 0 : v0 + 1;
const auto v2 = v1 == 2 ? 0 : v1 + 1;
const auto& vertices = triangle.vertices();
SDEBUG( vertices[v0].get() );
SDEBUG( vertices[v1].get() );
SDEBUG( vertices[v2].get() );
const geode::Vector3D edge0{ vertices[v0], vertices[v1] };
const geode::Vector3D edge1{ vertices[v0], vertices[v2] };
const auto a00 = edge0.length2();
Expand All @@ -219,6 +223,9 @@
std::array< double, 2 > p0, p1, p;
double dt1, h0, h1;

DEBUG( f00 );
DEBUG( f10 );
DEBUG( f01 );
if( f00 >= 0 )
{
if( f01 >= 0 )
Expand Down Expand Up @@ -337,9 +344,11 @@
}
}
}

DEBUG( p[0] );
DEBUG( p[1] );
geode::Point3D closest_point{ vertices[v0].get() + edge0 * p[0]
+ edge1 * p[1] };
SDEBUG( closest_point );
const auto distance =
geode::point_point_distance( point, closest_point );
return std::make_tuple( distance, std::move( closest_point ) );
Expand Down
Loading