coordinate-transformation

Calculate transformation which is needed to transform a rectangle into its perspective form

白昼怎懂夜的黑 提交于 2019-12-13 09:54:52
问题 I have the same rectangle in an untransformed form and in a perspective form. Both, the coordinates from the untransformed form as well as from the perspective form are in the untransformed coordinate system. Is there a way to reconstruct the transformation matrix which leads to this transformation? I think it should be possible to do that by solving the 4 equations given by the 4 corners but I am not sure where to start. // Edit: It looks like I am victim of a xy problem here. All answers

How to cut/hide projected area from bottom and top of GLControl - openTK

荒凉一梦 提交于 2019-12-13 01:18:44
问题 With the help of this link, I can project an image in cylindrical shape. Can I able to remove or hide the projected area from top and bottom of image as shown in the image below? 回答1: You have to discard fragmnts dependent on the u ( .y ) texture coordinate. According to the fragment shader of the original question How to project top and bottom area of openGL control: precision highp float; uniform sampler2D sTexture; varying vec2 vTexCoord; void main() { vec2 pos = vTexCoord.xy * 2.0 - 1.0;

Convert WGS84 to OSGB36

笑着哭i 提交于 2019-12-13 00:28:22
问题 Is there any known java library which allows me to convert WGS 84 cords to OSGB36 or if there is a good formula I can use? I am currently using this one, but it's not very accurate so I'm wondering if there's a better one I can use. private static double[] Wgs84ToBNG(double inLat, double inLon) { double lat = inLat * Math.PI / 180.0; double lon = inLon * Math.PI / 180.0; double a = 6377563.396; // Airy 1830 major & minor semi-axes double b = 6356256.910; double F0 = 0.9996012717; // NatGrid

How to map 2D display coordinate to 3D OpenGL space

谁说胖子不能爱 提交于 2019-12-12 21:09:19
问题 I am working on a 3D game that is ported on Android and I want to work with touch events in 3D course of a game. I need point in 3D space, right on near clipping plane, but all I can get is a 2D coordinates from an Android display. So, is there any way to map these (x, y) coordinates to (x, y, z) coordinates in 3D space? EDIT Well, I am working on a racing game, and I want to insert some items on a course, depending on where I click. I have this function: void racing_mouse_cb(int button, int

Decomposing svg transformation matrix

心不动则不痛 提交于 2019-12-12 16:27:32
问题 I have a polyline(1) that is withing group that is within another group. Both of these groups are transformed in every way. I need to get the exact locations of the polyline points after the transformations but it isn't easy since there is only transform attribute at hand. I'm trying to replicate these transformations to another polyline(2) so I would get the transformed point locations. I get the globalMatrix from the polyline(1) and with the help of this: http://svg.dabbles.info/snaptut

Projection matrix from OpenGL to DirectX

两盒软妹~` 提交于 2019-12-12 01:00:40
问题 I have an application which uses openGL and i have to port it to DirectX. To sum up my issue : How can I port a rotation matrix based on a right-handed coordinate system to a left-handed coordinate system ? This is what i found on MSDN: Flip the order of triangle vertices so that the system traverses them clockwise from the front. In other words, if the vertices are v0, v1, v2, pass them to Direct3D as v0, v2, v1. Use the view matrix to scale world space by -1 in the z-direction. To do this,

Coordinate transformation in OpenCV

自作多情 提交于 2019-12-11 19:49:21
问题 I have a polyline figure, given as an array of relative x and y point coordinates (0.0 to 1.0). I have to draw the figure with random position, scale and rotation angle. How can I do it in the best way? 回答1: You could use a simple transformation with RT matrix. Let X = (x y 1)^t be coordinates of one point of your figure. Let R be a 2x2 rotation matrix, and T be 2x1 translation vector of the transformation You plan to make. RT matrix A will have the form of A = [R T;0 0 1] . To get

Convert Latitude/Longitude to decimal degrees

爷,独闯天下 提交于 2019-12-11 19:19:40
问题 i need to convert a large txt file with latitudes, and a large txt file with longitudes into decimal degrees. The data i have is in the current format: 7d44'31.495"W for longitude and 41d3'40.313"N for latitude i need to convert both of this files to decimal degrees (using a script preferably). How can i do this? 回答1: Knowing nothing about *itudes, I can only give you a general idea about how to solve your problem: Use a RegExp to cut the numbers from your data and feed them in a trusted

How to get N number of coordinates around center coordinate and radius

半世苍凉 提交于 2019-12-11 15:53:02
问题 I got a center coordinate and a distance/radius, I need to get N number of coordinates from center using radius, for example how to get 12 coordinates of red dots in following image. 回答1: you can use the Great-circle_distance calculation to get the points. I first calculate the bearings from the center point needed then foreach loop them and pass them to the function. function destinationPoint($lat, $lng, $brng, $dist) { $rad = 6371; // earths mean radius $dist = $dist/$rad; // convert dist

Mouse picking miss

ⅰ亾dé卋堺 提交于 2019-12-11 08:04:44
问题 I did mouse picking with terrain for these lessons (but used c++) https://www.youtube.com/watch?v=DLKN0jExRIM&index=29&listhLoLuZVfUksDP http://antongerdelan.net/opengl/raycasting.html The problem is that the position of the mouse does not correspond to the place where the ray intersects with the terrane: There's a big blunder on the vertical and a little horizontal. Do not look at the shadows, this is not a corrected map of normals. What can be wrong? My code: void MousePicker::update() {