Imath::V3f transform3_param_t::get_center_at_frame( float frame) const { if( image_mode()) { Imath::V2f xy = get_absolute_value_at_frame<Imath::V2f>( center_xy_param(), frame); float z = get_value_at_frame<float>( center_z_param(), frame); return Imath::V3f( xy.x, xy.y, z); } else return get_value_at_frame<Imath::V3f>( center_param(), frame); }
boost::optional<Imath::M33d> transform2_param_t::matrix_at_time( float time, int subsample) const { const double deg2rad = 0.01745329251; Imath::V2f s = get_value_at_time<Imath::V2f>( scale_param(), time); if( s.x == 0.0f && s.y == 0.0f) return boost::optional<Imath::M33d>(); Imath::V2f c = get_absolute_value_at_time<Imath::V2f>( center_param(), time); Imath::V2f t = get_value_at_time<Imath::V2f>( translate_param(), time) / (float) subsample; float angle = get_value_at_time<float>( rotate_param(), time); Imath::M33d m = Imath::M33d().setTranslation( -c) * Imath::M33d().setScale( s) * Imath::M33d().setRotation( angle * deg2rad) * Imath::M33d().setTranslation( c + t); return boost::optional<Imath::M33d>( m); }
boost::optional<Imath::M33d> transform2_param_t::xform_blur_matrix_at_time( float time, float t, int subsample) const { const double deg2rad = 0.01745329251f; Imath::V2f s = get_value_at_time<Imath::V2f>( scale_param(), time); if( s.x == 0.0f && s.y == 0.0f) return boost::optional<Imath::M33d>(); Imath::V2f c = get_absolute_value_at_time<Imath::V2f>( center_param(), time); Imath::V2f d = get_value_at_time<Imath::V2f>( translate_param(), time) / (float) subsample; float angle = get_value_at_time<float>( rotate_param(), time); s = Imath::lerp( Imath::V2f( 1, 1), s, t); d = Imath::lerp( Imath::V2f( 0, 0), d, t); angle = Imath::lerp( 0.0f, angle, t); Imath::M33d m = Imath::M33d().setTranslation( -c) * Imath::M33d().setScale( s) * Imath::M33d().setRotation( angle * deg2rad) * Imath::M33d().setTranslation( c + d); return boost::optional<Imath::M33d>( m); }