void SensorPolar2D::backProject(Matrix* M, int* indices, Matrix* T) { Timer t; Matrix PoseInv = getTransformation(); PoseInv.invert(); if(T) PoseInv *= *T; Matrix coords2D = Matrix::multiply(PoseInv, *M, false, true); const double angularResInv = 1.0 / _angularRes; for(unsigned int i=0; i<M->getRows(); i++) { const double phi = atan2(coords2D(1,i), coords2D(0,i)); if(phi<=_phiLowerBound) indices[i] = -1; else if(phi>=_phiUpperBound) indices[i] = -1; else indices[i] = round((phi-_phiMin) * angularResInv); } }
SkString GrGLShaderBuilder::ensureFSCoords2D(const TransformedCoordsArray& coords, int index) { if (kVec3f_GrSLType != coords[index].type()) { SkASSERT(kVec2f_GrSLType == coords[index].type()); return coords[index].getName(); } SkString coords2D("coords2D"); if (0 != index) { coords2D.appendf("_%i", index); } this->fsCodeAppendf("\tvec2 %s = %s.xy / %s.z;", coords2D.c_str(), coords[index].c_str(), coords[index].c_str()); return coords2D; }