point

Run Dijkstra's Algorithm on a List<Point> in C#

 ̄綄美尐妖づ 提交于 2019-12-23 04:41:26
问题 I have a list of Point types in C#. I want to run Dijkstra's algorithm on this list of points where the first entry in the list is the starting location. Is there a way of doing this using an existing library? If such library doesn't exist, is there a way of calculating the distance between two points with x and y coordinates. For example, calculate the distance between point A (x coordinate =2, y coordinate = 4) and point B ((x coordinate =9, y coordinate = 7). I have used the ZedGraph

get the position of picturebox that has been clicked

霸气de小男生 提交于 2019-12-23 02:18:21
问题 I want to get the position of the picturebox that has been cliked by the mouse,but i don't know how?? I mean the position of picturebox not the form that the picturebox on it. thanks. 回答1: MUGAN's close. The Point you'll get from MouseEventArgs is the "screen" point of the mouse, where 0,0 is the top left of the entire monitor or desktop (however you want to think of it). To convert that to a "client" point within the PictureBox control, where 0,0 is the top left of that PictureBox, you'll

Do OpenGL Point Sprites work in Android?

邮差的信 提交于 2019-12-22 08:27:29
问题 I'm developing on a Droid, version 2.1-update1. My supported GL extensions include GL_OES_point_sprite and GL_OES_point_size_array. I am unable to get point sprites to render. The code below throws UnsupportedOperationException from GLWrapperBase at the glTexEnvi call. If I disable textures and comment out the glTexEnvi all, it throws the same exception further down, at glPointSizePointerOES(). Are point sprites properly supported in Android? Has anyone gotten them working? Or is there an

Javascript function to determine if a point is in between a rectangle

流过昼夜 提交于 2019-12-22 00:09:53
问题 I have a Javascript function that isn't returning the result I expected. I am trying to determine if an x,y point exists within a rectangle based on 2 other x,y points. In my code x and y are the original point in question. z1 and z2 are the top left coordinates of the rectangle and z3 and z4 are the bottom right coordinates. function isInside(x,y,z1,z2,z3,z4){ x1 = Math.min(z1, z3); x2 = Math.max(z1, z3); y1 = Math.min(z2, z4); y2 = Math.max(z2, z4); if ((x1 <= x <= x2) && (y1 <= y <= y2)) {

Find Coordinates for point on screen?

南楼画角 提交于 2019-12-21 20:36:47
问题 The thing is I have some graphics shown in a form, rectangle for example, and I want to capture when the point gets over thees fields. So I Thoght I try to find the corrrdinates for thees rectangles, but as thay are the coords in the form it dose not match the ones with the mouse location. So I wonder is there a way to find what coord on the screen a Point has on the screen and not in the form or controller? 回答1: Each control hs PointToFoo methods for conversion. Note that you should call

What is an appropriate `GetHashCode()` algorithm for a 2D point struct (avoiding clashes)

纵然是瞬间 提交于 2019-12-19 14:59:42
问题 Consider the following code: struct Vec2 : IEquatable<Vec2> { double X,Y; public bool Equals(Vec2 other) { return X.Equals(other.X) && Y.Equals(other.Y); } public override bool Equals(object obj) { if (obj is Vec2) { return Equals((Vec2)obj); } return false; } // this will return the same value when X, Y are swapped public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode(); } } Beyond the conversation of comparing doubles for equality (this is just demo code), what I am

What is an appropriate `GetHashCode()` algorithm for a 2D point struct (avoiding clashes)

二次信任 提交于 2019-12-19 14:59:12
问题 Consider the following code: struct Vec2 : IEquatable<Vec2> { double X,Y; public bool Equals(Vec2 other) { return X.Equals(other.X) && Y.Equals(other.Y); } public override bool Equals(object obj) { if (obj is Vec2) { return Equals((Vec2)obj); } return false; } // this will return the same value when X, Y are swapped public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode(); } } Beyond the conversation of comparing doubles for equality (this is just demo code), what I am

Calculate curvature for 3 Points (x,y)

走远了吗. 提交于 2019-12-19 10:45:17
问题 I have a two dimensional euclidean space. Three points are given. For example (p2 is the middle point): Point2D p1 = new Point2D.Double(177, 289); Point2D p2 = new Point2D.Double(178, 290); Point2D p3 = new Point2D.Double(178, 291); Now i want to calculate the curvature for these three points. double curvature = calculateCurvature(p1, p2, p3); How to do this? Ist there a existing method (no java external libraries)? Curvature: https://en.wikipedia.org/wiki/Curvature Menger Curvature: https:/

Matlab: I have two points in a 3D plot and i want to connect them with a line

我的未来我决定 提交于 2019-12-19 04:48:27
问题 I have a 3D plot and two points coordinates A(0,0,0) and B(13,-11,19). I just want to plot a visible line connecting this two points ... I tried plot3(0,0,0, 13,-11,19) and other stuff but everything i tried failed miserably. 回答1: Here's how: % Your two points P1 = [0,0,0]; P2 = [13,-11,19]; % Their vertial concatenation is what you want pts = [P1; P2]; % Because that's what line() wants to see line(pts(:,1), pts(:,2), pts(:,3)) % Alternatively, you could use plot3: plot3(pts(:,1), pts(:,2),

How to use a timer inside a vertex shader to animate point sizes in OpenGL

随声附和 提交于 2019-12-19 04:22:25
问题 I'm trying to implement a point cloud where the different points shall vary in size based on an uncertainty value associated with them. Let's say, if this value is zero, the size should be constant, if it's approaching 1, the radius of those points should vary more and more. First, the points should gain in size and after reaching a maximum, they should decrease until a minimum, and so on. A function to describe this phenomenon could be: pointSize = x +/- c * pointUncertainty, where x =