//-------------------------------------------------------------- void testApp::draw3d(){ ofClear(255,255,255, 0); // 3D stuff cam.begin(); ofPushMatrix(); ofTranslate(0,0,0); ofNoFill(); ofSetColor(255,255,255); sBox(0, 0, 0, 150, 150, 150); // outer case sBox(0, -144, position.z, 6, 150, 20); // top move bar sBox(position.x, position.y, position.z, 50, 50, 50); // aquarium case ofSetColor(200, 100, 0); ofSphere(ofMap(sideCam->blobX, 0, 320, -125, 125), ofMap(sideCam->blobY, 0, 240, -125, 125), ofMap(topCam->blobY, 0, 240, -125, 125), 5); ofPopMatrix(); cam.end(); }
void AES::subBytes() { for (int i = 0; i < 16; i++) { data[i] = sBox(data[i]); } }
// ------------------------------------------------------------------------------------------------- // ------------------------------------------------------------------------------------------------- void cRenderQuadAtt::calc_normals(cAppGauge *gauge) { for(int i = 0; i < (int)vecVertex.size(); i++) vecVertex[i].normal = AlgVector(0.0f, 0.0f, 0.0f); if(m_geometry_type == cRenderPick::LINE) return; const float limit = FLT_MAX; float xmin = limit; float xmax = -limit; float ymin = limit; float ymax = -limit; float zmin = limit; float zmax = -limit; // Calculate normals int v1, v2, v3; AlgVector vec1, vec2, normal; float modulo1, modulo2; for(int i = 0; i < m_num_geometries; i++) { v1 = vecTria[i].v1; v2 = vecTria[i].v2; v3 = vecTria[i].v3; #pragma region calculate normal //normal em v1 vec1 = vecVertex[v2].v - vecVertex[v1].v; vec2 = vecVertex[v3].v - vecVertex[v1].v; modulo1 = vec1.Length(); modulo2 = vec2.Length(); normal = vec1.Cross(vec2); vecVertex[v1].normal += (normal*(normal.Length()/(modulo1*modulo2))); //normal em v2 vec1 = vecVertex[v3].v - vecVertex[v2].v; vec2 = vecVertex[v1].v - vecVertex[v2].v; modulo1 = vec1.Length(); modulo2 = vec2.Length(); normal = vec1.Cross(vec2); vecVertex[v2].normal += (normal*(normal.Length()/(modulo1*modulo2))); //normal em v3 vec1 = vecVertex[v1].v - vecVertex[v3].v; vec2 = vecVertex[v2].v - vecVertex[v3].v; modulo1 = vec1.Length(); modulo2 = vec2.Length(); normal = vec1.Cross(vec2); vecVertex[v3].normal += (normal*(normal.Length()/(modulo1*modulo2))); #pragma endregion // calculate bouding box xmin = std::min(xmin, vecVertex[v1].v.x); xmax = std::max(xmax, vecVertex[v1].v.x); ymin = std::min(ymin, vecVertex[v1].v.y); ymax = std::max(ymax, vecVertex[v1].v.y); zmin = std::min(zmin, vecVertex[v1].v.z); zmax = std::max(zmax, vecVertex[v1].v.z); xmin = std::min(xmin, vecVertex[v2].v.x); xmax = std::max(xmax, vecVertex[v2].v.x); ymin = std::min(ymin, vecVertex[v2].v.y); ymax = std::max(ymax, vecVertex[v2].v.y); zmin = std::min(zmin, vecVertex[v2].v.z); zmax = std::max(zmax, vecVertex[v2].v.z); xmin = std::min(xmin, vecVertex[v3].v.x); xmax = std::max(xmax, vecVertex[v3].v.x); ymin = std::min(ymin, vecVertex[v3].v.y); ymax = std::max(ymax, vecVertex[v3].v.y); zmin = std::min(zmin, vecVertex[v3].v.z); zmax = std::max(zmax, vecVertex[v3].v.z); //if(gauge) // gauge->update(); } m_bbox = sBox(xmin, xmax, ymin, ymax, zmin, zmax); }
std::vector<bool> encryptionDevice::iterateBoxes(std::vector<bool> &matrix, std::vector<int> tm1, std::vector<int> tm2, std::vector<int> pos, int it, bool r) { for (int i = 0; i < it; i++) { matrix = sBox(matrix, tm1, tm2, r); matrix = pBox(matrix, pos, r); } return matrix; }