graphics

Calculating a LookAt matrix

…衆ロ難τιáo~ 提交于 2019-12-17 03:50:47
问题 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.

Algorithm to fill triangle

你离开我真会死。 提交于 2019-12-17 03:44:09
问题 i'm thinking about rasterization triangle algorithm. ( triangle_rasterization_lesson ) I wtote the following code: void triangle(int xa, int ya, int xb, int yb, int xc, int yc, TGAImage &image, TGAColor color) { line(xa, ya, xb, yb, image, color); line(xa, ya, xc, yc, image, color); line(xb, yb, xc, yc, image, color); for (int x = xa; x<=xb; x++) { for (int y = ya; y<=yb; y++) { line(xc, yc, x, y, image, white); } } } With triangle(100, 100, 100, 400, 400, 100, image, red); it works properly.

java multiple graphics [closed]

跟風遠走 提交于 2019-12-17 03:44:07
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Okay so I have been working on this code for awhile that shows how the sorting algorithms work. Right now I have it working where it sorts multiple graphs with the same sort but I need each graph to do a

correcting fisheye distortion programmatically

落爺英雄遲暮 提交于 2019-12-17 02:54:50
问题 BOUNTY STATUS UPDATE: I discovered how to map a linear lens , from destination coordinates to source coordinates. How do you calculate the radial distance from the centre to go from fisheye to rectilinear? 1). I actually struggle to reverse it, and to map source coordinates to destination coordinates. What is the inverse, in code in the style of the converting functions I posted? 2). I also see that my undistortion is imperfect on some lenses - presumably those that are not strictly linear.

Android: How to overlay a bitmap and draw over a bitmap?

我怕爱的太早我们不能终老 提交于 2019-12-17 02:54:14
问题 I have three questions actually: Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise, which one is better? If I want to draw something transparent over a bitmap, how would I go about doing it? If I want to overlay one transparent bitmap over another, how would I do it? Sorry for the long list, but in the interest of learning, I would like to explore both the approaches. 回答1: I can't believe no one has answered this yet! A

Graphics rendering in title bar

拈花ヽ惹草 提交于 2019-12-17 02:51:32
问题 The graphics keep rendering in the title bar. I use a buffered Image encapsulated in a jlabel and use the resultant graphic objects to draw rectangles in my code. This is the important part of the jframe class constructor: super(); BufferedImage image=new BufferedImage(680,581,BufferedImage.TYPE_INT_ARGB); m_graphicsObject =image.getGraphics(); JLabel label=new JLabel(new ImageIcon(image)); // buttons, mouse events and other controls use listeners to handle actions // these listener are

Timing JavaFX Canvas Application

China☆狼群 提交于 2019-12-17 02:51:25
问题 I order to practice JavaFX, I built a simple app that draws Sierpinski Triangles. import javafx.application.Application; import javafx.application.Platform; import javafx.concurrent.Task; import javafx.geometry.Insets; import javafx.geometry.Point2D; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane;

Absolute Positioning Graphic JPanel Inside JFrame Blocked by Blank Sections

隐身守侯 提交于 2019-12-17 02:33:14
问题 I'm trying to improve my understanding of Java, particularly Java GUI, by making a puzzle program. Currently the user selects an image, which is cut up into a specified number of pieces. The pieces are drawn randomly to the screen but they seem to be covered by blank portions of other pieces, and not all of them show up, but I can print out all the coordinates. I am using absolute positioning because a LayoutManager didn't seem to work. I briefly tried layeredPanes but they confused me and

What is the best way to move an object on the screen?

北慕城南 提交于 2019-12-17 02:32:26
问题 I wanted to know what is the best way for moving an object on the screen- for expample: if some kind of shape presented on the screen(on graphic mode), I would like to move it left and right using the keyboard's arrows keys. I know how to read the keyboard buffer. The important thing is that I would like to know is how to move something smooth on the screen. I'm using DOS-Box, with 8086 architecture. And the movment must be on graphic mode (320X200). 回答1: OK finally got TASM+TLINK to work

Does anyone know of a low level (no frameworks) example of a drag & drop, re-order-able list?

人走茶凉 提交于 2019-12-17 02:00:16
问题 I am looking for code (any language) of a basic graphical list which can be reordered by drag and drop. So exactly this functionality http://jqueryui.com/sortable/ but written directly on the frame buffer/canvas without any frameworks (or low level 'put pixel' libraries at most) and probably not in HTML/JS (unless it's Canvas only without CSS). The simpler the better as I will be using it in assembler and I don't want to reinvent the wheel if not needed. 回答1: heh I hate frameworks so this is