Skip to content

Commit

Permalink
mrange #100
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed Aug 27, 2023
1 parent fdc2b6b commit 5d9507c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions inst/include/sfheaders/sfc/m_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ namespace zm {
T& val
) {
T d = static_cast< T >( val );

if ( std::isnan( d ) ) { return; };

//calculate_m_range( m_range, d );
m_range[0] = std::min( d, m_range[0] );
m_range[1] = std::max( d, m_range[1] );
Expand All @@ -85,6 +88,9 @@ namespace zm {
typedef typename Rcpp::traits::storage_type< RTYPE >::type T;

T d = point[2];

if ( std::isnan( d ) ) { return; };

//xmin, ymin, xmax, ymax
m_range[0] = std::min( d, m_range[0] );
m_range[1] = std::max( d, m_range[1] );
Expand All @@ -101,6 +107,9 @@ namespace zm {
typedef typename Rcpp::traits::storage_type< RTYPE >::type T;

T d = xyzm == "XYM" ? point[2] : point[3];

if ( std::isnan( d ) ) { return; };

//xmin, ymin, xmax, ymax
m_range[0] = std::min( d, m_range[0] );
m_range[1] = std::max( d, m_range[1] );
Expand All @@ -117,6 +126,8 @@ namespace zm {

double d = static_cast< double >( i );

if ( std::isnan( d ) ) { return; };

//calculate_m_range( m_range, d );
m_range[0] = std::min( d, m_range[0] );
m_range[1] = std::max( d, m_range[1] );
Expand All @@ -138,8 +149,8 @@ namespace zm {
double dmin = static_cast< double >( zmin );
double dmax = static_cast< double >( zmax );

m_range[0] = std::min( dmin, m_range[0] );
m_range[1] = std::max( dmax, m_range[1] );
m_range[0] = std::isnan( dmin ) ? m_range[0] : std::min( dmin, m_range[0] );
m_range[1] = std::isnan( dmax ) ? m_range[1] : std::max( dmax, m_range[1] );

}

Expand Down

0 comments on commit 5d9507c

Please sign in to comment.