graphics

Prevent Back button from closing my application

余生长醉 提交于 2019-12-22 04:58:27
问题 I am using the following code in my application's activity to prevent it from closing my app on back. /* Prevent app from being killed on back */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // Back? if (keyCode == KeyEvent.KEYCODE_BACK) { // Back moveTaskToBack(true); } // Return return super.onKeyDown(keyCode, event); } It does not work. The app is set to be Android 1.6 (API Level 4) compatible. Clicking on my application icon restarts my app at a Splash activity (which

How to create multiple plots, each with same plot area size, when only one plot has axis labels?

末鹿安然 提交于 2019-12-22 04:31:19
问题 I want to plot three graphs in a 1x3 layout. Only the first graph needs to have vertical axis labels, but I want all three plot areas to be exactly the same size. This would be no problem if either none or all of the graphs had axis labels. But how do I get all three graphs the same size when one has axis labels and the other two don't? I'm trying to do this in base graphics because that's what I know best, but I'd be happy to use grid or ggplot2 if they provide better methods for solving my

Does the method for computing the cross-product change for left handed coordinates?

强颜欢笑 提交于 2019-12-22 04:07:57
问题 Does the method for computing the cross-product change for left handed coordinates? 回答1: The formula for the cross product of the vectors (x1, x2, x3) and (y1, y2, y3) is z1 = x2 * y3 - x3 * y2 z2 = x3 * y1 - x1 * y3 z3 = x1 * y2 - x2 * y1 It is designed in a way that the three vectors x , y and z in the given order have the same handedness as the coordinate system itself. This property does not depend on the handedness of the coordinate system -- for a left-handed coordinate system the

Optimum set of dirty rectangles

寵の児 提交于 2019-12-22 03:49:30
问题 I'm looking for an algorithm here, independent of specific programming language. The problem: We have a 2-dimensional display area (think simple buffer of pixels). Periodically, some of the pixels are changed. We need to find a set of rectangles that encapsulate all changed pixels. It would be trivial, but undesirable, to compute a single, potentially large, rectangle that encapsulates all changed pixels. We would rather have multiple, smaller, tight-fitting rectangles down to a specified

Flash/ActionScript: Draw a display object “onto” another

依然范特西╮ 提交于 2019-12-22 01:43:36
问题 How do I properly draw one vector object onto a specific position of another in ActionScript, accounting for positioning, transparency, etc? My idea (as suggested e.g. here) was to use beginBitmapFill () and drawRect () to draw a bitmap copy (made using BitmapData.draw ()) of one MovieClip onto the . graphics property of the other MovieClip, but this proved more difficult than I thought, mainly for these reasons: Transparency is not preserved : where the source MovieClip is transparent, the

C#: Creating a graphical screensaver

♀尐吖头ヾ 提交于 2019-12-22 01:15:35
问题 I am thinking about creating a screen saver. I have the whole thing, its graphics and the back-end kind of ready in my head. But I am not quite sure how to get the graphics out in code. What I would like is a slide show of images with a bit of movement (kind of like the slide show in media center) and some floating text and shapes on top. The shapes somehow translucent. I currently have a very simple static slideshow made in WinForms. Just a simple application that goes fullscreen and

Computer Vision / Augmented Reality: how to overlay 3D objects over vision?

自闭症网瘾萝莉.ら 提交于 2019-12-22 00:48:02
问题 I am trying to create a sample application where I can overlay 3d objects on a camera screen. They will be placed at a particular point, and re-drawn every frame as the user moves the camera to shift perspective. In essence, I'm looking to replicate this: http://www.youtube.com/watch?v=EEstFtQbzow Here's my attempt at phrasing the problem more precisely: consider being given an initial image matrix (representing all the X,Y pixel coords) at the time of initial object placement. Once its

How to get the best fit bounding box from covariance matrix and mean position?

China☆狼群 提交于 2019-12-22 00:15:17
问题 Given a covariance matrix and mean position computed from a set of 2D points, is there any way to simply compute the best fit bounding box or approximation (accuracy is not that important in my case)? The bounding box can be rotated, and the position of each point is unknown. Can you please help me out? Edited: I've solved this out by just simply follow a few equations in here: http://www.visiondummy.com/2014/04/draw-error-ellipse-representing-covariance-matrix/ 回答1: One thing you could try

Effecient way to draw Ellipse with OpenGL or D3D

天大地大妈咪最大 提交于 2019-12-21 23:32:44
问题 There is a fast way to draw circle like this void DrawCircle(float cx, float cy, float r, int num_segments) { float theta = 2 * 3.1415926 / float(num_segments); float c = cosf(theta);//precalculate the sine and cosine float s = sinf(theta); float t; float x = r;//we start at angle = 0 float y = 0; glBegin(GL_LINE_LOOP); for(int ii = 0; ii < num_segments; ii++) { glVertex2f(x + cx, y + cy);//output vertex //apply the rotation matrix t = x; x = c * x - s * y; y = s * t + c * y; } glEnd(); } I

Loading Images (using their RGB(A) pixel data) in openGL textures

怎甘沉沦 提交于 2019-12-21 21:34:11
问题 In the main function: img = cvLoadImage("test.JPG"); //openCV functions to load and create matrix CvMat *mat = cvCreateMat(img->height,img->width,CV_8SC3 ); cvGetMat( img, mat,0,1); //creating the 3-dimensional array during runtime data = new float**[img->height]; for(int i=0;i<img->height;i++){ data[i] = new float*[img->width]; } for(int i=0;i<img->height;i++){ for(int j=0;j<img->width;j++) data[i][j] = new float[3]; } //setting RGB values for(int i=0;i<img->height;i++) { for(int j=0;j<img-