graphics

Why do Stereolithography (.STL) files require each triangle to have a normal vector?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 07:30:01
问题 I'm trying to write some code to manipulate .STL ASCII files, and I'm trying to fully understand the file format. From what I've seen, the content of the "facet normal" line of each triangle has no effect on the triangle drawn. It also does not have any effect on which side of the triangle is considered the "outside", which is done by reversing the order of the vertices. This triangle facet normal 1 1 1 outer loop vertex -1 1 1 vertex 1 -1 1 vertex 1 1 -1 endloop endfacet is identical to this

How to add graphics on top of a multiscaleimage?

最后都变了- 提交于 2019-12-11 07:29:21
问题 I want to add graphics to a multiscaleimage. I use the project that Deep Zoom Composer auto generated when creating a multiscaleimage. Displaying the multiscaleimage from VS2008 works. I've tried this and added the graphics to the maincanvas, without any results: <Grid> <Canvas Name="maincanvas"/> <MultiScaleImage/> </Grid> Edit: When the user zooms in on the multiscaleimage, the user can place geometrically figures on the image. E.g. place a rectangle next to a person in the image, which

Make color palette of discretized values for a continuous variable (lattice levelplot)

我与影子孤独终老i 提交于 2019-12-11 07:29:18
问题 Following up on this question, I want to make a levelplot heat map and color each cell according to the variable p.value in my data frame. I would like to have the cells colored in such way that there are only 3 colors (discretized color palette for continuous variable): white for p.values >0.05 red for p.values <0.05 and >0.01 dark red for p.values <0.01 So far this is my MWE. set.seed(150) pv.df <- data.frame(compound=rep(LETTERS[1:8], each=3), comparison=rep(c("a/b","b/c","a/c"), 8), p

Blackberry setting a clipping region/area

做~自己de王妃 提交于 2019-12-11 07:27:49
问题 In J2ME we have the clipRect() and setClip() to clip a region in the Graphics area. What is the equivalent apis available in BlackBerry and how do we use it? 回答1: See the blackberry API. pushRegion() for the clipRect(), don't know of exact setClip replacement. http://www.blackberry.com/developers/docs/3.6api/net/rim/device/api/ui/Graphics.html 来源: https://stackoverflow.com/questions/1330205/blackberry-setting-a-clipping-region-area

Correctly Size Icon Bound to Canvas Object

老子叫甜甜 提交于 2019-12-11 07:17:26
问题 I have to following method that retrieves Canvas object from a Resource Dictionary using the named assembly and a relative URI and binds the Canvas to a MenuItem s Icon . This code to get the vector graphic Canvas is public Canvas GetVectorGraphic(string assemblyName, string relativeUri, string name) { var imageResourceDictionary = new ResourceDictionary(); imageResourceDictionary.Source = new Uri(assemblyName + ";component/" + relativeUri, UriKind.Relative) ?? new Uri(relativeUri, UriKind

Matrix Rotation Around an Arbitrary Axis Bug

佐手、 提交于 2019-12-11 07:07:32
问题 I have been attempting to get matrix rotation around an arbitrary axis working, I think I'm close but I have a bug. I am relatively new to 3D rotations and have a basic understanding of what is going on. public static Matrix4D Rotate(Vector3D u, Vector3D v) { double angle = Acos(u.Dot(v)); Vector3D axis = u.Cross(v); double c = Cos(angle); double s = Sin(angle); double t = 1 - c; return new Matrix4D(new double [,] { { c + Pow(axis.X, 2) * t, axis.X * axis.Y * t -axis.Z * s, axis.X * axis.Z *

protected void paintComponent(Graphics g)

我的未来我决定 提交于 2019-12-11 07:07:13
问题 We can override the paintComponent(Graphics g) method of JComponent . It is called automatically to refresh the screen. What can I do that is called regularly, for example every 100 ms. Is this possible? 回答1: Maybe your purpose is refreshing the component every certain ms? If so, there's a few options available. The use of Timer is a first option. Example here. The option most people use is Thread animation. Here is an example. Also there's a timing framework available to download. I can't

Linux drawing in text mode(no gui, desktop)

大兔子大兔子 提交于 2019-12-11 06:56:33
问题 I'm kind of new to linux without a gui and i run into a problem. When using a linux distro with gui, it looks easy to draw on a window using a library(opengl, sdl). I wanted to create a chip8 emulator in c++, but how can i handle drawing on screen? Or any library that can draw in text based linux, or just usage of opengl in text based linux. Thanks! Btw! I'm using bash in windows and a vagrant machine running precise64. 回答1: For text mode drawing you might want to investigate NCURSES: http:/

Plot DelaunayTriangulation in Mathematica

女生的网名这么多〃 提交于 2019-12-11 06:52:03
问题 Considering the following example (from Sjoerd Solution on plotting a ConvexHull) Needs["ComputationalGeometry`"] pts = RandomReal[{0, 10}, {60, 2}]; dtpts=DelaunayTriangulation[pts] I would now like to plot the DelaunayTriangulation for a set of point but can`t figure out the Plot syntax using Graphics. Thoughts ? 回答1: Graphics[ GraphicsComplex[ pts, { Function[{startPt, finishPts},Line[{startPt, #}] & /@ finishPts] @@@ dtpts, Red, Point@Range[Length@pts] } ] ] And if you need real polygons:

convert 2D screen coordinates to 3D space coordinates in C++?

白昼怎懂夜的黑 提交于 2019-12-11 06:39:35
问题 I'm writing a 2D game using a wrapper of OpenGLES . There is a camera aiming at a bunch of textures, which are the sprites for the game. The user should be able to move the view around by moving their fingers around on the screen. The problem is, the camera is about 100 units away from the textures, so when the finger is slid across the screen to pan the camera, the sprites move faster than the finger due to parallax effect. So basically, I need to convert 2D screen coordinates, to 3D