/* Descrição: Implementação do método setDist do TAD, atribui uma distância elemento i e j da matriz */ bool TDistMat::setDist(int i, int j, float dist) { int index = convertIndex(i, j); if(index != -1) { if(i != j) { if(dist >= 0) { if(j > i) index = convertIndex(j, i); mat[index] = dist; return true; } else cout << endl << "[ Erro: Valor invalido para distancia ]" << endl; } } else cout << endl << "[ Erro: Indice invalido ]" << endl; return false; }
void CSSClipInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { const ClipAutos& autos = toCSSClipNonInterpolableValue(nonInterpolableValue)->clipAutos(); const InterpolableList& list = toInterpolableList(interpolableValue); const auto& convertIndex = [&list, &environment](bool isAuto, size_t index) { if (isAuto) return Length(Auto); return CSSLengthInterpolationType::resolveInterpolableLength(*list.get(index), nullptr, environment.state().cssToLengthConversionData(), ValueRangeAll); }; environment.state().style()->setClip(LengthBox( convertIndex(autos.isTopAuto, ClipTop), convertIndex(autos.isRightAuto, ClipRight), convertIndex(autos.isBottomAuto, ClipBottom), convertIndex(autos.isLeftAuto, ClipLeft))); }
int convertIndex(const fj::Vector3& position)const { const int kIndexX = (position.x() - getRangeX().getMin()) / getDivisionsSizeX(); const int kIndexY = (position.y() - getRangeY().getMin()) / getDivisionsSizeY(); const int kIndexZ = (position.z() - getRangeZ().getMin()) / getDivisionsSizeZ(); const int kClampedX = clamp(kIndexX, 0, getResolutions().ResolutionX); const int kClampedY = clamp(kIndexY, 0, getResolutions().ResolutionY); const int kClampedZ = clamp(kIndexZ, 0, getResolutions().ResolutionZ); return convertIndex(kClampedX, kClampedY, kClampedZ);; }
/* Descrição: Implementação do método getDist do TAD, retorna a distância no índice i e j */ float TDistMat::getDist(int i, int j) { int index = convertIndex(i, j); if(index != -1) { if(i == j) return 0; else { if(j > i) index = convertIndex(j, i); return mat[index]; } } else cout << endl << "[ Erro: Indice invalido ]" << endl; return -1; }
void WarpPerspectiveBilinear::selectControlPoint(unsigned index) { // depending on index, select perspective or bilinear control point if( isCorner( index ) ) { mWarp->selectControlPoint( convertIndex( index ) ); } else { mWarp->deselectControlPoint(); } // always select bilinear control point, which we use to keep track of editing Warp::selectControlPoint( index ); }
void WarpPerspectiveBilinear::moveControlPoint(unsigned index, const Vec2f &shift) { // depending on index, move perspective or bilinear control point if( isCorner( index ) ) { // perspective: simply move the control point mWarp->moveControlPoint( convertIndex( index ), shift ); } else { // bilinear: transform control point from normalized screen space to warped space Vec2f pt = getControlPoint(index); setControlPoint(index, pt + shift); } }
Vec2f WarpPerspectiveBilinear::getControlPoint(unsigned index) const { // depending on index, return perspective or bilinear control point if( isCorner( index ) ) { // perspective: simply return one of the corners return mWarp->getControlPoint( convertIndex( index ) ); } else { // bilinear: transform control point from warped space to normalized screen space Vec2f p = Warp::getControlPoint(index) * Vec2f( mWarp->getSize() ); Vec3f pt = mWarp->getTransform().transformPoint( Vec3f(p.x, p.y, 0.0f) ); return Vec2f(pt.x, pt.y) / mWindowSize; } }
void WarpPerspectiveBilinear::setControlPoint(unsigned index, const Vec2f &pos) { // depending on index, set perspective or bilinear control point if( isCorner( index ) ) { // perspective: simply set the control point mWarp->setControlPoint( convertIndex( index ), pos ); } else { // bilinear:: transform control point from normalized screen space to warped space Vec2f p = pos * mWindowSize; Vec3f pt = mWarp->getInvertedTransform().transformPoint( Vec3f(p.x, p.y, 0.0f) ); Vec2f size( mWarp->getSize() ); Warp::setControlPoint( index, Vec2f(pt.x, pt.y) / size ); } }
/** \fn ctor \brief this one is used when converting a type 1 avi to type 2 */ aviIndexOdml::aviIndexOdml(aviWrite *father,aviIndexAvi *cousin ) : aviIndexBase(father,cousin->_masterList,cousin->odmlChunkPosition) { commonInit(); ADM_info("Creating Odml file from avi/type1... \n"); LMovie = cousin->LMovie; // steal movie from cousin cousin->LMovie=NULL; nbVideoFrame=cousin->nbVideoFrame; for(int i=0;i<ADM_AVI_MAX_AUDIO_TRACK;i++) audioFrameCount[i]=cousin->audioFrameCount[i]; // Convert cousin's index int n=cousin->myIndex.size(); bool done[1+ADM_AVI_MAX_AUDIO_TRACK]; for(int j=0;j<ADM_AVI_MAX_AUDIO_TRACK+1;j++) { indexes[j].indexPosition=cousin->placeHolder[j]; } for(int j=0;j<ADM_AVI_MAX_AUDIO_TRACK+1;j++) { uint32_t trackFcc=superIndex.trackIndeces[j].fcc; for(int i=0;i<n;i++) { IdxEntry trx=cousin->myIndex[i]; // if(trx.fcc==trackFcc) { odmIndexEntry ix; ix.flags=trx.flags; ix.offset=trx.offset; ix.size=trx.len; indexes[j].listOfChunks.push_back(ix); convertIndex(indexes+j,j); } } } // cousin->myIndex.clear(); // empty cousin index for(int j=0;j<ADM_AVI_MAX_AUDIO_TRACK+1;j++) printf("Track %d, found %d entries\n",j,(int)indexes[j].listOfChunks.size()); startNewRiff(); }
vec2 WarpPerspectiveBilinear::getControlPoint( unsigned index ) const { // depending on index, return perspective or bilinear control point if( isCorner( index ) ) { // perspective: simply return one of the corners return mWarp->getControlPoint( convertIndex( index ) ); } else { // bilinear: transform control point from warped space to normalized screen space vec2 p = Warp::getControlPoint( index ) * vec2( mWarp->getSize() ); vec4 pt = mWarp->getTransform() * vec4( p.x, p.y, 0, 1 ); if( pt.w != 0 ) pt.w = 1 / pt.w; pt *= pt.w; return vec2( pt.x, pt.y ) / mWindowSize; } }
void WarpPerspectiveBilinear::setControlPoint( unsigned index, const vec2 &pos ) { // depending on index, set perspective or bilinear control point if( isCorner( index ) ) { // perspective: simply set the control point mWarp->setControlPoint( convertIndex( index ), pos ); } else { // bilinear:: transform control point from normalized screen space to warped space vec2 p = pos * mWindowSize; vec4 pt = mWarp->getInvertedTransform() * vec4( p.x, p.y, 0, 1 ); if( pt.w != 0 ) pt.w = 1 / pt.w; pt *= pt.w; vec2 size( mWarp->getSize() ); Warp::setControlPoint( index, vec2( pt.x, pt.y ) / size ); } }
const T& get(const int i, const int j, const int k)const { return m_components[convertIndex(i, j, k)]; }
void add(const int i, const int j, const int k, const T& t) { const int kIndex = convertIndex(i, j, k); add(kIndex, t); }
void set(const int i, const int j, const int k, const T& t) { const int kIndex = convertIndex(i, j, k); m_components[kIndex] = t; }