Merge pull request #3643 from vkip/avoid_zero_conndepth

Avoid connection depth = 0 when segment is specified without depth in COMPSEGS
This commit is contained in:
Kai Bao 2023-08-23 23:53:19 +02:00 committed by GitHub
commit b4c30cf93b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,13 +126,13 @@ struct Record {
const double depth_change_segment = segment_depth - interpolation_detph; const double depth_change_segment = segment_depth - interpolation_detph;
const double segment_length = segment_distance - interpolation_distance; const double segment_length = segment_distance - interpolation_distance;
// Use segment depth if length of sement is 0
if (segment_length == 0.) { if (segment_length == 0.) {
throw std::runtime_error("Zero segment length is botained when doing interpolation between segment " center_depth = segment_depth;
+ std::to_string(segment_number) + " and segment " + std::to_string(interpolation_segment_number) ); } else {
}
center_depth = segment_depth + (center_distance - segment_distance) / segment_length * depth_change_segment; center_depth = segment_depth + (center_distance - segment_distance) / segment_length * depth_change_segment;
} }
}
@ -143,8 +143,8 @@ namespace {
// while the depth information is defaulted though, which need to be obtained from the related segment // while the depth information is defaulted though, which need to be obtained from the related segment
for( auto& compseg : compsegs ) { for( auto& compseg : compsegs ) {
// need to determine the related segment number first // need to determine the related segment number first, if not defined
if (compseg.segment_number != 0) continue; if (compseg.segment_number == 0) {
const double center_distance = (compseg.m_distance_start + compseg.m_distance_end) / 2.0; const double center_distance = (compseg.m_distance_start + compseg.m_distance_end) / 2.0;
const int branch_number = compseg.m_branch_number; const int branch_number = compseg.m_branch_number;
@ -173,6 +173,8 @@ namespace {
compseg.segment_number = segment_number; compseg.segment_number = segment_number;
}
// when depth is default or zero, we obtain the depth of the connection based on the information // when depth is default or zero, we obtain the depth of the connection based on the information
// of the related segments // of the related segments
if (compseg.center_depth == 0.) { if (compseg.center_depth == 0.) {