ToHoudiniCurvesConverter::RemoveDuplicateEnds::ReturnType ToHoudiniCurvesConverter::RemoveDuplicateEnds::operator()( typename T::ConstPtr data ) const { assert( data ); typedef typename T::ValueType::value_type ValueType; const std::vector<ValueType> &origValues = data->readable(); typename T::Ptr result = new T(); std::vector<ValueType> &newValues = result->writable(); size_t index = 0; for ( size_t i=0; i < m_vertsPerCurve.size(); i++ ) { for ( size_t j=0; j < (size_t)m_vertsPerCurve[i]; j++, index++ ) { if ( j > 1 && j < (size_t)m_vertsPerCurve[i]-2 ) { newValues.push_back( origValues[index] ); } } } return result; }
ReturnType operator()( typename T::ConstPtr data ) { typedef typename T::ValueType Container; typedef typename Container::value_type V; const Container &input = data->readable(); V2i paddedSize = m_size + V2i( 2 ); // padding with the border value makes the iteration easier later m_output.resize( paddedSize.x * paddedSize.y ); V threshold = (V)m_threshold; std::fill( m_output.begin(), m_output.begin() + paddedSize.x, m_borderValue ); // 1 scanline padding at top int ii = 0; int oi = paddedSize.x; for( int y=0; y<m_size.y; y++ ) { m_output[oi++] = m_borderValue; // 1 pixel padding at left for( int x=0; x<m_size.x; x++ ) { m_output[oi++] = input[ii++] > threshold ? 1 : 0; } m_output[oi++] = m_borderValue; // 1 pixel padding at right } std::fill( m_output.begin() + oi, m_output.begin() + oi + paddedSize.x, m_borderValue ); // 1 scanline padding at bottom }
bool operator() ( typename T::ConstPtr data ) { assert( data ); const typename T::ValueType &v = data->readable(); return v.size() == m_variableSize; }
static std::string decToHexVector( typename T::ConstPtr v ) { const typename T::ValueType &c = v->readable(); return IECore::decToHex( c.begin(), c.end() ); }