point

Why is Lua arithmetic is not equal to itself? [duplicate]

痞子三分冷 提交于 2019-11-28 13:54:20
Possible Duplicate: What is a simple example of floating point/rounding error? When I execute the following Lua code: a = 5.6 b = 14 * 0.4 c = 11.2 / 2 d = 28 * 0.2 print( a == b ) print( a == c ) print( a == d ) print( b == c ) print( b == d ) print( c == d ) I get the following results: false true false false true false Can someone explain why 14 * 0.4 and 28 * 0.2 are not equal to 5.6? Thanks You are dealing with the natural imprecision of binary floating point numbers. Your number a might be 5.5999999999999996 and your result b might be 5.6000000000000005, which are not equal. In fact,

Find cells in array that are crossed by a given line segment

醉酒当歌 提交于 2019-11-28 12:41:14
问题 I have got a 2D array of cells with size 10x10, and many points that are pairs of floating point values, like: (1.6, 1.54), (4.53, 3.23). The pairs (x,y) are such that x<10 and y<10 Each cell takes points whose coordinates have the same integer part as the cell coordinates. So arr[3][7] will take points with x={3...3.99(9)} and y={7... 7.99(9)}, for example (3.5, 7.1) or (3.2, 7.6). Similarly (1.6, 1.54) is in arr[1][1] , (4.53, 3.23) is in arr[4][3], etc. Each point has got a designated

Display the plot values on mouse over. - Detect Scatter points

别来无恙 提交于 2019-11-28 11:12:31
I am attempting to display the plot values of different points on my QCustomPlot in which I have a Line style of lsLine . I know i could set a mouse over signal on the QCustomPlot but that wont really help since I just need to be informed when the mouse is over my plotted line.My question is is there any way to find out if the mouse is over my scatter point. Is there a signal i could connect to that would tell me when the mouse is over a scatter point ? Reimplement QCustomPlot::mouseMoveEvent or connect to QCustomPlot::mouseMove . Then use axes' coordToPixel to translate (cursor) pixel coords

Points moving along a curve within MATLAB

泄露秘密 提交于 2019-11-28 07:59:47
问题 I have managed to edit a piece of code that was given to me in order to show a point moving along a curve. I am trying to find a way to edit this in order to create two independent points moving along this curve or to create a second figure that shows another point moving along a graph. The main point is that the points need to be independent of one another so that an algorithm can be applied to them. I currently have the following code which gives a single point moving along the curve: %#

Fast algorithm to find the x closest points to a given point on a plane

限于喜欢 提交于 2019-11-28 07:02:26
I would like to find a fast algorithm in order to find the x closest points to a given point on a plane. We are actually dealing with not too many points (between 1,000 and 100,000), but I need the x closest points for every of these points. (where x usually will be between 5 and 20.) I need to write it in C#. A bit more context about the use case: These points are coordinates on a map. (I know, this means we are not exactly talking about a plane, but I hope to avoid dealing with projection issues.) In the end points that have many other points close to them should be displayed in red, points

How do I find all the Points in a Path in Android?

橙三吉。 提交于 2019-11-28 06:58:25
Awhile back I asked a question to see if I was able to find a pair of specific points in a path; however, this time I want to know if there is a way to know all points in a path? (I couldn't find a method that did so, which is unfortunate because Java provides a way to do this, just not Android?) The reason I ask this is because I have multiple geometric graphs and I want to compare the points to see where they intersect. I appreciate any helpful responses If you have created a Path that means that in some point of your code, you know the exact (Geo)point. Why don't you put this point(s) on a

How to make UIImageView automatically resize to the size of the image loaded

瘦欲@ 提交于 2019-11-28 05:56:14
I have put an UIImageView control on my view with IB. The size of the control is just something I decided upon, pretty random size really What I want to do is the control to resize automatically whenever I set the image property to a new image. I want it to actually resize to the size of the image. Can it be done automatically ? without any code intervention ? If not - what will the best approach be in this case ? What happens today is strange. I load images into the ImageView and I see the images getting displayed properly even though the size of the ImageView is not changed. This interferes

Algorithm for generating a triangular mesh from a cloud of points

寵の児 提交于 2019-11-28 03:51:48
In some simulation program we generate object surfaces in terms of points, each point has 3D coordinates and the vector that represents the normal to the surface at that point. For visualization purposes we would like to generate a mesh composed of triangles; each three close points form one triangle with its normal. Then we can send this information to some standard visualization programs that render the surface like VMD (Visual Molecular Dynamics). We wonder which is the fastest/available algorithm for doing this. Take a look at Jonathan Shewchuk 's work, especially on his (together with his

Hexagonal Grids, how do you find which hexagon a point is in?

懵懂的女人 提交于 2019-11-28 03:34:53
I have a map made up of rows and columns of hexagons This isn't an actual image of the hex-map I am using, but uses the same size and shape hexagons I need to be able to tell which one the mouse is over when the user clicks, Each Hexagon is represented by an instance of a "Tile" class, however this doesn't hold any location specific data, or even a polygon, so basically the only way to tell where a particular hexagon is, is to know it's position in the 2D array. I have used a square grid before, and it was relatively easy to figure out which square was selected, because pixels are also square,

How to make the + operator work while adding two Points to each other?

笑着哭i 提交于 2019-11-28 01:57:57
Is there any way to get the + operator to work for the Point object? Take, for example, this tiny snippet: this.cm1.Show((MouseEventArgs)e.Location+this.i_rendered.Location); You see, I try to add two points to eachother. It just does not work (which was expected). I'd love to get this working. Any ideas? Cody Gray It's not going to happen the way you expect. The only overload that the Point structure provides for the + (addition) operator is one that translates the coordinates of the Point by a Size . There's no way to add two Point structures together, and I'm not even sure what that would