graphics

Android — putting the GLSurfaceView.Renderer to sleep (as in Thread.sleep(20)) outside of the OnDrawFrame Method

好久不见. 提交于 2019-12-14 03:57:40
问题 I want to control the rendering rate of my GLSurfaceView.Renderer. I implemented a thread in the class that extends GLSurfaceView, and put it to sleep periodically in a while(true) loop, which did nothing to slow down the renderer. There's a good answer here that suggests putting the GL Thread to sleep by using a Thread.sleep within the Renderer.onDrawFrame() method. I'd like to handle it from outside the Renderer class. How can that be done when an explicit call requires passing in a GL10

Understanding the geometry of a truncated Icosahedron, for rendering

笑着哭i 提交于 2019-12-14 03:56:03
问题 I'm trying to render a truncated icosahedron like above with clickable zones using Three.js. I found the code for a regular icosahedron var t = ( 1 + Math.sqrt( 5 ) ) / 2; var vertices = [ [ -1, t, 0 ], [ 1, t, 0 ], [ -1, -t, 0 ], [ 1, -t, 0 ], [ 0, -1, t ], [ 0, 1, t ], [ 0, -1, -t ], [ 0, 1, -t ], [ t, 0, -1 ], [ t, 0, 1 ], [ -t, 0, -1 ], [ -t, 0, 1 ] ]; var faces = [ [ 0, 11, 5 ], [ 0, 5, 1 ], [ 0, 1, 7 ], [ 0, 7, 10 ], [ 0, 10, 11 ], [ 1, 5, 9 ], [ 5, 11, 4 ], [ 11, 10, 2 ], [ 10, 7, 6 ],

Can Jung graphics appear in the same place every time?

自作多情 提交于 2019-12-14 03:53:34
问题 I'm using JUNG ( http://jung.sourceforge.net/index.html ) to draw graphics in java. The software is great but I have a small question. How can I be sure that the displayed graph is each time the same (no changes is architecture or position)? To be more specific: the graph model (data to be represented) doesn't change but its representation changes each time I hit the "View graph" button :) [some vertices are in other places, for example: sometimes in the upper part of the window, sometimes in

How to plot a room outline from range finder sensors in a toy car?

荒凉一梦 提交于 2019-12-14 03:42:44
问题 I have a toy car that has an arduino and 4 Ultrasonic Range Finder sensors in front, rear and both sides, they give me the distance to a wall if any exist within the range that the sensor covers, the sensors give me this data in short intervals, the car has to move around a room and plot the outline, the rooms can have columns and be kind of irregular, I don't know the algorithms involved in this plotting, any insight would be appreciated. 回答1: heh once did a robot that was almost the same :)

Rotating an image in VB.net

百般思念 提交于 2019-12-14 03:08:51
问题 I have been attempting to rotate an image in vb.net and have had some trouble with it. The first block of code was working, but it was causing an undesireable side effect where after the rotation the image had been scaled down such that the x dimension would fit in the pre-existing y dimension. So I had the image rotated, but it was only taking up part of the canvas. In order to solve that, I figured I should just create a larger bitmap as an intermediate step so that when it was rotated, the

Jfree chart xy line implementation

谁说胖子不能爱 提交于 2019-12-14 03:02:04
问题 I want to plot 4 lines in one dataset but I cannot. Could any1 tell me what libs in need in jfree and how I can implement them in 1 chart public void visualise(){ //visualise data XYSeries series = new XYSeries("Membrane mVolt"); XYSeries series2 = new XYSeries("potassium_channel_n_gate_n"); XYSeries series3 = new XYSeries("sodium_channel_h_gate_h"); XYSeries series4 = new XYSeries("sodium_channel_m_gate_m"); //add data to charts for(int l=0;l<301;l++){ series.add(tData[l], YData[0][l]);

How can I read float data with glReadPixels

╄→гoц情女王★ 提交于 2019-12-14 02:33:31
问题 I've been trying to read float data for a couple of days with glReadPixels . My cpp code: //expanded to whole screen quad via vertex shader glDrawArrays( GL_TRIANGLES, 0, 3 ); int size = width * height; GLfloat* pixels = new GLfloat[ size ]; glReadPixels( 0, 0, width, height, GL_RED, GL_FLOAT, pixels ); pixelVector.resize( size ); for ( int i = 0; i < size; i++ ) { pixelVector[i] = (float) pixels[i]; } and my shader code: out float data; void main() { data = 0.02; } Strangely I get 0.0196078

Persistent graphics WinForms

ⅰ亾dé卋堺 提交于 2019-12-14 02:22:00
问题 I've a WinForms application on wich i have to draw some lines between controls. These lines need to be persistent, so i override the form OnPaint() event. The problem is that, the re-draw of the lines aren't very smooth. I'm creating the graphics as follows: Graphics g; g = this.CreateGraphics(); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.FillRectangle(Brushes.White, this.ClientRectangle); And drawing the lines as follows: public void lineDraw(Control L1, Control L2

Algorithm to find the coordinates of a corner in a simple image

孤街醉人 提交于 2019-12-14 02:17:33
问题 I have a bitmap where two large blocks of colors intersect, and I would like to find the intersection of these two blocks. Note that I do not know the actual geometry of the two shapes, because this is all just raw pixel data. Is there any algorithm I could use to do this? 回答1: If you have all the pixel data in memory (which I'd assume you do, but this is a major sticking point) and there are only two distinct colours, all you should need to do is run a horizontal scanline to find the point

Built in colormaps in Matlab

核能气质少年 提交于 2019-12-14 02:11:31
问题 I want a lighter version of the "cyan" color, using the function colormap('cyan'). How do you do this? 回答1: Check out the function BRIGHTEN: X = spiral(8); image(X) colormap(winter), colorbar brighten(0.6) Another trick is to right click on the colorbar and select Interactive Colormap Shift , this allows to shift the color-to-data mapping using mouse dragging. 回答2: Pure cyan is represented by the RGB triple [0 1 1] . To make it lighter, just increase the red component (ex: [0.5 1 1] ), thus