/* * Installs the UAE LIBRARY */ void emulib_install (void) { uaecptr a = here (); org (RTAREA_BASE + 0xFF60); // dw (0x4eb9); // dw ((RTAREA_BASE >> 16) | get_word (RTAREA_BASE + 36)); // dw (get_word (RTAREA_BASE + 38) + 12); calltrap (define_trap (uaelib_demux, 0, "")); dw (RTS); org (a); }
/* * Install the server */ void uaeexe_install (void) { uaecptr loop; if (!uae_boot_rom) return; loop = here (); org (UAEEXE_ORG); calltrap (deftrapres (uaeexe_server, 0, _T("uaeexe_server"))); dw (RTS); org (loop); }
void asm_prgm(void) { int n; for(n = 0; n < sizeof(locations)/sizeof(locations[0]) - 1; ++n) { org(locations[n]); mov_literal(GP0, locations[n + 1]); call(GP0); } org(locations[n]); halt(); }
cv::Mat drawHist(const cv::Mat hist) { cv::Mat r(256*3,256*3, CV_8U, cv::Scalar(0)); cv::Mat nhist; cv::normalize(hist, nhist, 0.0, 0.9, cv::NORM_MINMAX); for (int i=0; i<256; i++) cv::rectangle(r, cv::Point(3*i, 256*3 - 30), // 30 for tick cv::Point(3*i+1, (int)((256*3-30)*(1-nhist.at<float>(i)))), cv:: Scalar(255) ); int font = cv::FONT_HERSHEY_PLAIN; double scale = 1.0; int thickness = 1; for (int i=0; i<8; i++) { int baseline; std::string text = xf::tostr<int>(i*32); cv::Size tsize = cv::getTextSize(text, font, scale, thickness, &baseline); // center the text cv::Point org(i*32*3 - tsize.width/2, 256*3 - 27 + tsize.height); cv::putText(r, text, org, font, scale, cv::Scalar(255), 1, 8); } return r; }
void initparallel (void) { write_log("initparallel uae_boot_rom = %d\n", uae_boot_rom); #ifdef AHI if (uae_boot_rom) { write_log("installing ahi_winuae\n"); uaecptr a = here (); //this install the ahisound org (rtarea_base + 0xFFC0); calltrap (deftrapres (ahi_demux, 0, _T("ahi_winuae"))); dw (RTS); org (a); #ifdef AHI_V2 init_ahi_v2 (); #endif } #endif }
void MxPropSlim::discontinuity_constraint(MxVertexID i, MxVertexID j, MxFaceID f) { Vec3 org(m->vertex(i)), dest(m->vertex(j)); Vec3 e = dest - org; Vec3 v1(m->vertex(m->face(f)(0))); Vec3 v2(m->vertex(m->face(f)(1))); Vec3 v3(m->vertex(m->face(f)(2))); Vec3 n = triangle_normal(v1,v2,v3); Vec3 n2 = e ^ n; unitize(n2); MxQuadric3 Q3(n2, -(n2*org)); Q3 *= boundary_weight; if( weighting_policy == MX_WEIGHT_AREA || weighting_policy == MX_WEIGHT_AREA_AVG ) { Q3.set_area(norm2(e)); Q3 *= Q3.area(); } MxQuadric Q(Q3, dim()); quadric(i) += Q; quadric(j) += Q; }
shared_ptr<RandomAdjMatGen::AdjMatT> copyAndPermute(shared_ptr<RandomAdjMatGen::AdjMatT> org_ptr) { L("Generating random permutation..."); RandomAdjMatGen::AdjMatT& org = *org_ptr; int n = org.size1(); std::vector<int> idxs; for(int i=0; i<n; i++) idxs.push_back(i); int r = (int) pow(2,drand48()*n); std::vector<int>::iterator start=idxs.begin(),end=idxs.end(); random_shuffle (idxs.begin(), idxs.end()); cout << "Random Permutation: "; for(int i=0; i<n; i++) { cout << idxs[i]<<" "; idxmap[idxs[i]] = i; } cout << endl; // create new matrix shared_ptr<RandomAdjMatGen::AdjMatT> ret_ptr(new RandomAdjMatGen::AdjMatT(org.size1(),org.size2())); RandomAdjMatGen::AdjMatT& ret = *ret_ptr; // fill with values for(int i=0; i<n; i++) for(int j=0; j<n; j++) ret(i,j) = org(idxmap[i],idxmap[j]); return ret_ptr; }
void ShapeDrawer::drawShape(const btCollisionShape* shape) { const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape); btVector3 halfExtent = boxShape->getHalfExtentsWithMargin(); btVector3 org(0,0,0); btVector3 dx(1,0,0); btVector3 dy(0,1,0); btVector3 dz(0,0,1); dx *= halfExtent[0]; dy *= halfExtent[1]; dz *= halfExtent[2]; glBegin(GL_LINE_LOOP); glDrawVector(org - dx - dy - dz); glDrawVector(org + dx - dy - dz); glDrawVector(org + dx + dy - dz); glDrawVector(org - dx + dy - dz); glDrawVector(org - dx + dy + dz); glDrawVector(org + dx + dy + dz); glDrawVector(org + dx - dy + dz); glDrawVector(org - dx - dy + dz); glEnd(); glBegin(GL_LINES); glDrawVector(org + dx - dy - dz); glDrawVector(org + dx - dy + dz); glDrawVector(org + dx + dy - dz); glDrawVector(org + dx + dy + dz); glDrawVector(org - dx - dy - dz); glDrawVector(org - dx + dy - dz); glDrawVector(org - dx - dy + dz); glDrawVector(org - dx + dy + dz); glEnd(); }
HUB_MSG *TelnetProtocol::Encode(HUB_MSG *pMsg) { _ASSERTE(started == TRUE); _ASSERTE(pMsg->type == HUB_MSG_TYPE_LINE_DATA); DWORD len = pMsg->u.buf.size; BYTE_string org(pMsg->u.buf.pBuf, len); const BYTE *pBuf = org.data(); // discard original data from the stream if (!pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0)) return NULL; for (; len ; len--) { BYTE ch = *pBuf++; if (ch == cdIAC) streamEncoded += ch; streamEncoded += ch; if (ch == 13 /*CR*/ && ascii_cr_padding.size()) { if (options[0 /*TRANSMIT-BINARY*/] == NULL || options[0 /*TRANSMIT-BINARY*/]->stateLocal != TelnetOption::osYes) streamEncoded += ascii_cr_padding; } } return FlushEncodedStream(pMsg); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- static void CC_ListDeaths( const CCommand &args ) { Ep2LevelStats_t *map = s_CEP2GameStats_Singleton.FindOrAddMapStats( STRING( gpGlobals->mapname ) ); if ( !map ) return; int nRendered = 0; for ( int i = map->m_aPlayerDeaths.Count() - 1; i >= 0 ; --i, ++nRendered ) { Vector org( map->m_aPlayerDeaths[ i ].nPosition[ 0 ], map->m_aPlayerDeaths[ i ].nPosition[ 1 ], map->m_aPlayerDeaths[ i ].nPosition[ 2 ] + 36.0f ); // FIXME: This might overflow NDebugOverlay::Box( org, Vector( -8, -8, -8 ), Vector( 8, 8, 8 ), 0, 255, 0, 128, 10.0f ); /* Msg( "%s killed %s with %s at (%d,%d,%d)\n", g_aClassNames[ map->m_aPlayerDeaths[ i ].iAttackClass ], g_aClassNames[ map->m_aPlayerDeaths[ i ].iTargetClass ], WeaponIdToAlias( map->m_aPlayerDeaths[ i ].iWeapon ), map->m_aPlayerDeaths[ i ].nPosition[ 0 ], map->m_aPlayerDeaths[ i ].nPosition[ 1 ], map->m_aPlayerDeaths[ i ].nPosition[ 2 ] ); */ if ( nRendered > 150 ) break; } Msg( "\nlisted %d deaths\n", map->m_aPlayerDeaths.Count() ); }
const mydefs::Triangle3d TriangleIterator::operator*() { //////////////////////////////////////////////////////////////////////////////// int plus1mod3[3] = {1, 2, 0}; int minus1mod3[3] = {2, 0, 1}; #define org(otri, vertexptr) \ vertexptr = (vertex) (otri).tri[plus1mod3[(otri).orient] + 3] #define dest(otri, vertexptr) \ vertexptr = (vertex) (otri).tri[minus1mod3[(otri).orient] + 3] #define apex(otri, vertexptr) \ vertexptr = (vertex) (otri).tri[(otri).orient + 3] //////////////////////////////////////////////////////////////////////////////// mydefs::Triangle3d triangle; TVertex v1; TVertex v2; TVertex v3; if( validTriangle() ) { org(mCurrentTriangle, v1); dest(mCurrentTriangle, v2); apex(mCurrentTriangle, v3); triangle = wykobi::make_triangle( v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], v3[0], v3[1], v3[2]); } return triangle; }
void nsCertTree::dumpMap() { for (int i=0; i<mNumOrgs; i++) { nsAutoString org(mTreeArray[i].orgName); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("ORG[%s]", NS_LossyConvertUTF16toASCII(org).get())); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("OPEN[%d]", mTreeArray[i].open)); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("INDEX[%d]", mTreeArray[i].certIndex)); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("NCHILD[%d]", mTreeArray[i].numChildren)); } for (int i=0; i<mNumRows; i++) { treeArrayEl *el = GetThreadDescAtIndex(i); if (el != nsnull) { nsAutoString td(el->orgName); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("thread desc[%d]: %s", i, NS_LossyConvertUTF16toASCII(td).get())); } nsCOMPtr<nsIX509Cert> ct = GetCertAtIndex(i); if (ct != nsnull) { PRUnichar *goo; ct->GetCommonName(&goo); nsAutoString doo(goo); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("cert [%d]: %s", i, NS_LossyConvertUTF16toASCII(doo).get())); } } }
void AggregateTest::Render(const Scene *scene) { RNG rng; ProgressReporter prog(nIterations, "Aggregate Test"); // Compute bounding box of region used to generate random rays BBox bbox = scene->WorldBound(); bbox.Expand(bbox.pMax[bbox.MaximumExtent()] - bbox.pMin[bbox.MaximumExtent()]); Point lastHit; float lastEps = 0.f; for (int i = 0; i < nIterations; ++i) { // Choose random rays, _rayAccel_ and _rayAll_ for testing // Choose ray origin for testing accelerator Point org(Lerp(rng.RandomFloat(), bbox.pMin.x, bbox.pMax.x), Lerp(rng.RandomFloat(), bbox.pMin.y, bbox.pMax.y), Lerp(rng.RandomFloat(), bbox.pMin.z, bbox.pMax.z)); if ((rng.RandomUInt() % 4) == 0) org = lastHit; // Choose ray direction for testing accelerator Vector dir = UniformSampleSphere(rng.RandomFloat(), rng.RandomFloat()); if ((rng.RandomUInt() % 32) == 0) dir.x = dir.y = 0.f; else if ((rng.RandomUInt() % 32) == 0) dir.x = dir.z = 0.f; else if ((rng.RandomUInt() % 32) == 0) dir.y = dir.z = 0.f; // Choose ray epsilon for testing accelerator float eps = 0.f; if (rng.RandomFloat() < .25) eps = lastEps; else if (rng.RandomFloat() < .25) eps = 1e-3f; Ray rayAccel(org, dir, eps); Ray rayAll = rayAccel; // Compute intersections using accelerator and exhaustive testing Intersection isectAccel, isectAll; bool hitAccel = scene->Intersect(rayAccel, &isectAccel); bool hitAll = false; bool inconsistentBounds = false; for (u_int j = 0; j < primitives.size(); ++j) { if (bboxes[j].IntersectP(rayAll)) hitAll |= primitives[j]->Intersect(rayAll, &isectAll); else if (primitives[j]->Intersect(rayAll, &isectAll)) inconsistentBounds = true; } // Report any inconsistencies between intersections if (!inconsistentBounds && ((hitAccel != hitAll) || (rayAccel.maxt != rayAll.maxt))) Warning("Disagreement: t accel %.16g [%a] t exhaustive %.16g [%a]\n" "Ray: org [%a, %a, %a], dir [%a, %a, %a], mint = %a", rayAccel.maxt, rayAll.maxt, rayAccel.maxt, rayAll.maxt, rayAll.o.x, rayAll.o.y, rayAll.o.z, rayAll.d.x, rayAll.d.y, rayAll.d.z, rayAll.mint); if (hitAll) { lastHit = rayAll(rayAll.maxt); lastEps = isectAll.RayEpsilon; } prog.Update(); } prog.Done(); }
float Trans_Mesh::Ray_Tri_Intersect(const vec3& rayorig, const vec3& raydir, mat4& world, uint16_t startindex, uint16_t numindices) const{ world.inverse(); vec3 org(rayorig*world), di(raydir);// transform these to the mesh's space so the checks are in object space, not world space TransformNormal(di, world); // do all checks in OBJECT SPACE!!! di*=20000.0f;//make sure the ray is long enough return RayTriangleIntersect(org, di, &Vertices[0], &Indices[startindex],numindices); }
//-------------------------------------------------------------- ofVec3f ofxBulletRigidBody::getBulletPosition() { if(!isBody()) return 0; btScalar m[16]; btDefaultMotionState* myMotionState = (btDefaultMotionState*)body->getMotionState(); myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m); btVector3 org(m[12], m[13], m[14]); return ofVec3f(org.x(), org.y(), org.z()); }
float Animated_Mesh::Ray_BV_Intersect(const vec3& rayorig, const vec3& raydir) { mat4 inverseW(GetWorld()); inverseW.inverse(); vec3 org(rayorig*inverseW), di(raydir);// transform these to the mesh's space so the checks are in object space, not world space TransformNormal(di, inverseW); // do all checks in OBJECT SPACE!!! di*=20000.0f;//make sure the ray is long enough return Bounding_Volume.RayIntersect(org, di); }
ofPoint RagDoll::getBodyPos() { btScalar m[16]; btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_bodies[BODYPART_SPINE]->getMotionState(); myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m); btVector3 org(m[12], m[13], m[14]); return ofPoint(org.x(), org.y(), org.z()); }
int process(int argc, char**argv) { if(argc < 2) throw std::string("Usage:") + argv[0] + " EITHER_camera-number_OR_input-video-file-name [video-out-file-name]"; cv::VideoCapture cap(argv[1]); // try to open as a video file or image sequence. if (!cap.isOpened()) cap.open(atoi(argv[1])); // try to open as a video camera. if (!cap.isOpened()) throw "Failed to open the video device, video file or image sequence!\n"; int w = cap.get(CV_CAP_PROP_FRAME_WIDTH); int h = cap.get(CV_CAP_PROP_FRAME_HEIGHT); double fps = cap.get(CV_CAP_PROP_FPS); std::cout << "Frame size : " << w << " x " << h << std::endl; cv::VideoWriter writer; if(argc > 2) // NOTE: XVID is MPEG-4 writer.open(argv[2], cv::VideoWriter::fourcc('X','V','I','D'), fps==-1.? 24.: fps, cv::Size(w,h)); const char* title = "video"; cv::namedWindow(title, CV_WINDOW_AUTOSIZE); //create a window called "MyVideo" // cv::putText parameters std::ostringstream text; cv::Point org(20,20); int fontFace = cv::FONT_HERSHEY_PLAIN; // choose one of: // FONT_HERSHEY_SIMPLEX FONT_HERSHEY_PLAIN FONT_HERSHEY_DUPLEX // FONT_HERSHEY_COMPLEX FONT_HERSHEY_TRIPLEX FONT_HERSHEY_COMPLEX_SMALL // FONT_HERSHEY_SCRIPT_SIMPLEX FONT_HERSHEY_SCRIPT_COMPLEX double fontScale = 1.; cv::Scalar color(0,255,0); // green int thickness = 1; int lineType = 8; bool bottomLeftOrigin = false; // up-side-down text if true std::cout << "Press Esc key to quit" << std::endl; cv::Mat frame; for(int frameCount = 0; ; frameCount++) { cap >> frame; if (frame.empty()) break; // EOF if reading video file // add some text to the image text.seekp(0); // - Operator '<<' will append to 'text' if we don't do this! text << "frame: " << frameCount; cv::putText(frame, text.str(), org, fontFace, fontScale, color, thickness, lineType, bottomLeftOrigin); if(writer.isOpened()) writer << frame; cv::imshow(title, frame); // show frame if (cv::waitKey(1) == 27) // wait up to 1 ms for 'Esc' key, ascii decimal 27, press. break; } return 0; }
CRef<CTaxon3_reply> CTaxon3::SendOrgRefList(const vector<CRef< COrg_ref> >& list) { // Open connection to Taxonomy service CTaxon3_request request; ITERATE (vector<CRef< COrg_ref> >, it, list) { CRef<CT3Request> rq(new CT3Request); CRef<COrg_ref> org(new COrg_ref); org->Assign(**it); rq->SetOrg(*org); request.SetRequest().push_back(rq); }
osg::ref_ptr<osg::Geode> TestSaddle() { osg::Vec3 org(0, 0, 0); osg::Vec3 xLen(200, 0, 0), zLen(0, 0, 150); double yLen = 100, radius = 30; osg::Vec4 color(1, 1, 1, 0); osg::ref_ptr<osg::Geode> geode = new osg::Geode; geode->addDrawable(Geometry::BuildSaddle(org, xLen, yLen, zLen, radius, color)); return geode; }
osg::ref_ptr<osg::Geode> TestPyramid() { osg::Vec3 org(0, 0, 0); osg::Vec3 height(0, 0, 500); osg::Vec3 xAxis(1, 0, 0); osg::Vec3 offset(100, 0, 0); double bottomXLen = 300, bottomYLen = 100; double topXLen = 200, topYlen = 50; osg::ref_ptr<osg::Geode> geode = new osg::Geode; geode->addDrawable(Geometry::BuildPyramid(org, height, xAxis, offset, bottomXLen, bottomYLen, topXLen, topYlen, osg::Vec4(1, 1, 1, 0))); return geode; }
void info_getter_org::process_ip_info(ip_info& info) { if (!info.organization) { char const* rezult = GeoIP_name_by_addr(db, info.ip_string.c_str()); if (rezult) { std::string org(rezult); boost::replace_all(org, ",", " "); boost::trim(org); boost::erase_all(org, "("); boost::erase_all(org, ")"); info.organization.reset(org); } } }
vector<ofPoint> RagDoll::getPartsPos() { vector<ofPoint> ret; for (int i = 0; i < BODYPART_COUNT; i++) { btScalar m[16]; btDefaultMotionState* myMotionState = (btDefaultMotionState*)m_bodies[i]->getMotionState(); myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m); btVector3 org(m[12], m[13], m[14]); ret.push_back(ofPoint(org.x(), org.y(), org.z())); } return ret; }
void TestParse::testParseCompareOutput() { QCOMPARE(save_dives("./testout.ssrf"), 0); QFile org(SUBSURFACE_SOURCE "/dives/test40-42.xml"); org.open(QFile::ReadOnly); QFile out("./testout.ssrf"); out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); QString readin = orgS.readAll(); QString written = outS.readAll(); QCOMPARE(readin, written); }
osg::ref_ptr<osg::Geode> TestSCylinder() { osg::Vec3 org(0, 0, 0); osg::Vec3 height(0, 0, 200); osg::Vec3 bottomNormal(0, -1, -1); bottomNormal.normalize(); double radius = 50; osg::Vec4 color(1, 1, 1, 0); osg::ref_ptr<osg::Geode> geode = new osg::Geode; geode->addDrawable(Geometry::BuildSCylinder(org, height, bottomNormal, radius, color)); return geode; }
void rtarea_init (void) { rtarea_init_mem (); #ifdef USE_AUTOCONFIG uae_u32 a; char uaever[32]; snprintf (uaever, 32, "uae-%d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV); EXPANSION_uaeversion = ds (uaever); EXPANSION_explibname = ds ("expansion.library"); EXPANSION_doslibname = ds ("dos.library"); EXPANSION_uaedevname = ds ("uae.device"); deftrap (NULL); /* Generic emulator trap */ lasttrap = 0; EXPANSION_nullfunc = here (); calltrap (deftrap (nullfunc)); dw (RTS); a = here(); /* Standard "return from 68k mode" trap */ org (RTAREA_BASE + 0xFF00); calltrap (deftrap2 (m68k_mode_return, TRAPFLAG_NO_RETVAL, "")); org (RTAREA_BASE + 0xFF80); calltrap (deftrap2 (getchipmemsize, TRAPFLAG_DORET, "")); org (RTAREA_BASE + 0xFF10); calltrap (deftrap2 (uae_puts, TRAPFLAG_NO_RETVAL, "")); dw (RTS); org (a); #endif filesys_install_code (); }
void TestParse::testParseCompareNewFormatOutput() { QCOMPARE(save_dives("./testsbnewout.ssrf"), 0); QFile org(SUBSURFACE_SOURCE "/dives/TestDiveSeabearNewFormat.xml"); org.open(QFile::ReadOnly); QFile out("./testsbnewout.ssrf"); out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); QString readin = orgS.readAll(); QString written = outS.readAll(); QCOMPARE(readin, written); clear_dive_file_data(); }
float Animated_Mesh::Ray_Tri_Intersect(const vec3& rayorig, const vec3& raydir) { mat4 inverseW(GetWorld()); inverseW.inverse(); vec3 org(rayorig*inverseW), di(raydir);// transform these to the mesh's space so the checks are in object space, not world space TransformNormal(di, inverseW); // do all checks in OBJECT SPACE!!! di*=20000.0f;//make sure the ray is long enough if(Bounding_Volume.RayIntersect(org, di) == INFINITY) return INFINITY;// did not hit the aabb, therefore, we did not hit the object if(IB.Stride == 4){ return RayTriangleIntersect(org, di, &Vertices[0], reinterpret_cast<const uint32_t*>(&Indices[0]),Indices.size()/2); } else { return RayTriangleIntersect(org, di, &Vertices[0],&Indices[0],Indices.size()); } }
void SolutionViewer::WriteDigit(int col, int row, int num) { int cell_width = (int)floor(output_img.size().width /9.0); int cell_height = (int)floor(output_img.size().height/9.0); int font_face = cv::FONT_HERSHEY_SCRIPT_SIMPLEX; double font_scale = 1.5; int thickness = 3; cv::Point org((int)(col*cell_width+0.3*cell_width), (int)((row+1)*cell_height - 0.3*cell_height)); char tmp[2]; sprintf_s(tmp, "%d", num); putText(output_img, tmp, org, font_face, font_scale, cv::Scalar::all(0), thickness); }
void QgsAuthIdentCertEdit::populateIdentityComboBox() { cmbIdentityCert->addItem( tr( "Select identity..." ), "" ); QList<QSslCertificate> certs( QgsAuthManager::instance()->getCertIdentities() ); if ( !certs.isEmpty() ) { cmbIdentityCert->setIconSize( QSize( 26, 22 ) ); QgsStringMap idents; Q_FOREACH ( const QSslCertificate &cert, certs ) { QString org( SSL_SUBJECT_INFO( cert, QSslCertificate::Organization ) ); if ( org.isEmpty() ) org = tr( "Organization not defined" ); idents.insert( QStringLiteral( "%1 (%2)" ).arg( QgsAuthCertUtils::resolvedCertName( cert ), org ), QgsAuthCertUtils::shaHexForCert( cert ) ); }