graphics

Do not want scientific notation on plot axis

蓝咒 提交于 2019-12-17 07:09:41
问题 I regularly do all kinds of scatter plots in R using the plot command. Sometimes both, sometimes only one of the plot axes is labelled in scientific notation. I do not understand when R makes the decision to switch to scientific notation. Surprisingly, it often prints numbers which no sane human would write in scientific notation when labelling a plot, for example it labels 5 as 5e+00. Let's say you have a log-axis going up to 1000, scientific notation is unjustified with such "small" numbers

Javascript drawing library? [closed]

懵懂的女人 提交于 2019-12-17 07:09:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Any suggestion for a JavaScript interactive drawing library? Just need to draw lines, polygons, texts of different colors. IE/Firefox/Opera/Safari compatible. ­­­­­­­­­­­­­­­­­­­­­­­­­­ 回答1: Raphael is pretty cool for that, and works across browsers since it uses VML (for MSIE) and SVG (for everything else). 回答2

How do you find a point at a given perpendicular distance from a line?

半世苍凉 提交于 2019-12-17 07:09:11
问题 I have a line that I draw in a window and I let the user drag it around. So, my line is defined by two points: (x1,y1) and (x2,y2). But now I would like to draw "caps" at the end of my line, that is, short perpendicular lines at each of my end points. The caps should be N pixels in length. Thus, to draw my "cap" line at end point (x1,y1), I need to find two points that form a perpendicular line and where each of its points are N/2 pixels away from the point (x1,y1). So how do you calculate a

In MATLAB, how do I plot to an image and save the result without displaying it?

大兔子大兔子 提交于 2019-12-17 07:08:15
问题 This question kind of starts where this question ends up. MATLAB has a powerful and flexible image display system which lets you use the imshow and plot commands to display complex images and then save the result. For example: im = imread('image.tif'); f = figure, imshow(im, 'Border', 'tight'); rectangle('Position', [100, 100, 10, 10]); print(f, '-r80', '-dtiff', 'image2.tif'); This works great. The problem is that if you are doing a lot of image processing, it starts to be real drag to show

What does super.paintComponent(g) do?

荒凉一梦 提交于 2019-12-17 06:41:13
问题 What does super.paintComponent(g) do (especially when we place it inside paintComponent() method)? I am surprised I don't see anyone asking this in SO before. I dig out my school notes on Java Graphics, the only thing it mentioned on this line of code is "do not delete" . However I have been practicing and tying out on Java paintComponent() method these few weeks. So far I have not included that line into my codes, and everything seems to work well (so far). So.. Questions: What does it do?

How to add text to an image in java?

試著忘記壹切 提交于 2019-12-17 06:32:17
问题 I need to add some texts to an existing table image (png). Which means that I need to "write" on the image and I need the option to select the text location. How can I do it? Thank you very much. 回答1: It's easy, just get the Graphics object from the image and draw your string onto the image. This example (and output image) is doing that: public static void main(String[] args) throws Exception { final BufferedImage image = ImageIO.read(new URL( "http://upload.wikimedia.org/wikipedia/en/2/24

Overlay images onto Camera preview SurfaceView

流过昼夜 提交于 2019-12-17 05:37:55
问题 I have a SurfaceView that is being used to draw images, and I would like to overlay them onto a live-feed from the phone's camera. Currently, the SurfaceView that contains the images have a white-background, but if I were to overlay them onto the phone's camera feed, they would have to be transparent. The camera and animation drawing cannot be done on the same SurfaceView . What is the best course to pursue the use of multiple views that involve managing the camera and drawing images? Is it

Getting the true z value from the depth buffer

怎甘沉沦 提交于 2019-12-17 05:37:30
问题 Sampling from a depth buffer in a shader returns values between 0 and 1, as expected. Given the near- and far- clip planes of the camera, how do I calculate the true z value at this point, i.e. the distance from the camera? 回答1: From http://web.archive.org/web/20130416194336/http://olivers.posterous.com/linear-depth-in-glsl-for-real // == Post-process frag shader =========================================== uniform sampler2D depthBuffTex; uniform float zNear; uniform float zFar; varying vec2

Zooming graphics based on current mouse position

给你一囗甜甜゛ 提交于 2019-12-17 04:36:08
问题 I'm trying to zoom a drawing based on the current position of the mouse. Right now my onMouseWheel method looks like this (based on this StackOverflow answer): private void onMouseWheel(object sender, MouseEventArgs e) { if (e.Delta > 0) { _scale *= 1.25f; _translateY = e.Y - 1.25f * (e.Y - _translateY); _translateX = e.X - 1.25f * (e.X - _translateX); } else { _scale /= 1.25f; _translateY = e.Y - 0.8f * (e.Y - _translateY); _translateX = e.X - 0.8f * (e.X - _translateX); } this.Invalidate();

Calculating a LookAt matrix

孤街醉人 提交于 2019-12-17 03:51:38
问题 I'm in the midst of writing a 3d engine and I've come across the LookAt algorithm described in the DirectX documentation: zaxis = normal(At - Eye) xaxis = normal(cross(Up, zaxis)) yaxis = cross(zaxis, xaxis) xaxis.x yaxis.x zaxis.x 0 xaxis.y yaxis.y zaxis.y 0 xaxis.z yaxis.z zaxis.z 0 -dot(xaxis, eye) -dot(yaxis, eye) -dot(zaxis, eye) l Now I get how it works on the rotation side, but what I don't quite get is why it puts the translation component of the matrix to be those dot products.