coordinates

gluUnProject always returns zero

久未见 提交于 2019-12-12 19:09:17
问题 I need gluUnProject to convert screen coordinates to world coordinates and right now I just about have it working. When my app runs it accurately tells me the coordinates on screen which I know are stored in my renderer thread and then pumps out screen coordinates. Unfortunately the screen coordinates seem to have no effect of world coordinates and the world coordinates remain at zero. Here is my gluUnProject method public void vector3 (GL11 gl){ int[] viewport = new int[4]; float[] modelview

Find if the current location is along a straight line, drawn between two points on a map.

一个人想着一个人 提交于 2019-12-12 17:41:23
问题 I've draw a line on a map between two GeoPoints , and I have retrieved the current location. I want to know if the user's current position is along the drawn line or not? If I get the latitude and longitude of the drawn line, how can I check the user is in the drawing path? I've used below code to draw a line between geo points import java.util.List; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.DashPathEffect; import android.graphics.Paint; import

valid way to calculate angle between 2 CLLocations?

牧云@^-^@ 提交于 2019-12-12 14:22:56
问题 Is this a valid way to calculate an angle (in radians) from one CLLocation to another? -(float)angleFromLocation:(CLLocationCoordinate2D)start toLocation:(CLLocationCoordinate2D)end { float deltaX = start.latitude - end.latitude; float deltaY = start.longitude - end.longitude; float ang = atan2(deltaY, deltaX); return ang;} Please advise! Any help will be much appreciated. 回答1: I used a variant of this question and answer and it works well: double DegreesToRadians(double degrees) {return

find closest point from users coordinates

◇◆丶佛笑我妖孽 提交于 2019-12-12 13:09:42
问题 I would like to know how to use find the closes point using coordinates. i am using a Hashmap which holds coordinates and strings. i have allowed the user to input an x and y axis and store them as int a and int b but i don't know where to go from there. thanks for looking import java.util.HashMap; import java.util.Scanner; public class Coordinate { static class Coords { int x; int y; public boolean equals(Object o) { Coords c = (Coords) o; return c.x == x && c.y == y; } public Coords(int x,

How to create adjacency matrix from grid coordinates in R?

会有一股神秘感。 提交于 2019-12-12 13:01:54
问题 I'm new to this site. I was wondering if anyone had experience with turning a list of grid coordinates (shown in example code below as df). I've written a function that can handle the job for very small data sets but the run time increases exponentially as the size of the data set increases (I think 800 pixels would take about 25 hours). It's because of the nested for loops but I don't know how to get around it. ## Dummy Data x <- c(1,1,2,2,2,3,3) y <- c(3,4,2,3,4,1,2) df <- as.data.frame

Javascript: IE8 event coordinates

无人久伴 提交于 2019-12-12 11:15:36
问题 I can't seem to find a way to get coordinates of event in IE8, it just triggers errors like... pageX undefined, clientX undefined etc. While it works find in other browsers. This is what I was trying to do: document.onmousemove=setcoord; function setcoord(e){ var xxcoord = e.pageX||(e.clientX+document.body.scrollLeft); var yycoord = e.pageY||(e.clientY+document.body.scrollTop); } Is there any workaround to get that mouse position ?.. 回答1: The following seems to work. I'm not sure its is the

store X and Y coordinates

五迷三道 提交于 2019-12-12 11:08:46
问题 Hi im new to this site and need help with a program im working on. the problem im having is that i cant seem to store string and two integers (as the coordinates). i have looked at other code but dont see how the values are stored. below is the code ive been using. the code seems to be fine but when trying to stored the values i cant put multiply integers. thanks for your time import java.util.HashMap; public class map { class Coords { int x; int y; public boolean equals(Object o) { Coords c

Understanding Qt's QTransform rotate function

China☆狼群 提交于 2019-12-12 10:54:22
问题 As a result of this question, I'd like to understand more about Qt's QTransform::rotate function. In the documentation, it says: QTransform & QTransform::rotate ( qreal angle, Qt::Axis axis = Qt::ZAxis ) Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix. Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.

Check coordinate point between two points

人盡茶涼 提交于 2019-12-12 10:09:51
问题 I need to verify if a coordinate LAT/LNG point is between other two points (a segment line like a road). I followed THIS topic with no success. function inRange(start, point, end) { start_x = start.lat(); start_y = start.lng(); end_x = end.lat(); end_y = end.lng(); point_x = point.lat(); point_y = point.lng(); var dx = end_x - start_x; var dy = end_y - start_y; var innerProduct = (point_x - start_x)*dx + (point_y - start_y)*dy; return 0 <= innerProduct && innerProduct <= dx*dx + dy*dy; }

Detect if a co-ordinate falls within a longitude and latitude boundary box

有些话、适合烂在心里 提交于 2019-12-12 09:27:07
问题 Maths has never been my strong point and I'm struggling with a task. I need to determine if a set of longitude and latitude co-ordinates fall inside a box, where the max/min longitude and max/min latitude have been given. Any help would be appreciated. ** EDITED ** I'm using GPS co-ordinates, so the minimum longitude could be larger than the maximum longitude. i.e if the box is over date line. 回答1: Given minlat , maxlat , minlong and maxlong (ie the 4 corners of your box) then it's a simple