coordinate-systems

Difference between layerX and offsetX in JavaScript

◇◆丶佛笑我妖孽 提交于 2019-12-21 07:59:08
问题 There are different co-ordinate system for JavaScript, such as e.clientX, e.screenX. I understand those two well, but there are some like e.layerX and e.offsetX. These two are not very clear to me. Can someone explain those two co-ordinates for me? 回答1: offsetX / offsetY are a neat extension by Microsoft to mouse event objects, and mean the position of the mouse pointer relatively to the target element. Sadly, they're not implemented by Firefox, and there's discordance among the other

How do I convert a geodetic location to an ECF position that works with the terrain model in Cesium

妖精的绣舞 提交于 2019-12-21 05:48:14
问题 I'm trying to put a point at the top of Mount Everest in Cesium. My most likely candidate as of last night was the code I borrowed to do geodetic to ecef conversion (from PySatel.coord). Upon review this morning, it appears to be correct: a = 6378.137 b = 6356.7523142 esq = 6.69437999014 * 0.001 e1sq = 6.73949674228 * 0.001 f = 1 / 298.257223563 def geodetic2ecef(lat, lon, alt): """Convert geodetic coordinates to ECEF. Units are degrees and kilometers. """ lat, lon = radians(lat), radians(lon

Determining a homogeneous affine transformation matrix from six points in 3D using Python

☆樱花仙子☆ 提交于 2019-12-21 02:52:23
问题 I am given the locations of three points: p1 = [1.0, 1.0, 1.0] p2 = [1.0, 2.0, 1.0] p3 = [1.0, 1.0, 2.0] and their transformed counterparts: p1_prime = [2.414213562373094, 5.732050807568877, 0.7320508075688767] p2_prime = [2.7677669529663684, 6.665063509461097, 0.6650635094610956] p3_prime = [2.7677669529663675, 5.665063509461096, 1.6650635094610962] The affine transformation matrix is of the form trans_mat = np.array([[…, …, …, …], […, …, …, …], […, …, …, …], […, …, …, …]]) such that with

OpenCV: solvePnP tvec units and axes directions

夙愿已清 提交于 2019-12-20 14:43:47
问题 I'm trying to find the relative position of the camera to the chessboard (or the other way around) - I feel OK with converting between different coordinate systems, e.g. as suggested here. I decided to use chessboard not only for calibration but actual position determination as well at this stage, since I can use the findChessboardCorners to get the imagePoints (and this works OK). I've read a lot on this topic and feel that I understand the solvePnP outputs (even though I'm completely new to

Longitude, Latitude to XY coordinate conversion

荒凉一梦 提交于 2019-12-20 05:56:06
问题 I want to now how to convert longitude, latitude to its equivalent xy coordinate components in iPhone programming. (I am using only CoreLocation programming, and want to show a point on iPhone screen without any map). thanks 回答1: Well the exact conversion depends on exactly which part of the Earth you want to show, and the stretching along longitude varies according to latitude, at least in Mercator. That being said, even if you don't want to display an actual MapKit map, it would probably be

opengl: Change the origin to upper left corner

丶灬走出姿态 提交于 2019-12-19 10:21:15
问题 I am having trouble setting the openGL origin to the upper left corner of the view. So, in my window resize handler, I do something as; // ox and oy are some offsets and width and height are the // required viewport width and height glViewport(ox, oy, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, 0, height, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); This keeps the origin at bottom left and I can render my texture as: glBegin(GL_QUADS);

How to find the coordinate that is closest to the point of origin?

别说谁变了你拦得住时间么 提交于 2019-12-18 07:05:38
问题 I know there are many many questions about sorting javascript arrays by multiple values, but none of the answers solved my problem. I have an array of coordinates like: x | y -------- 10 20 12 18 20 30 5 40 100 2 How can I get the coordinate that is closest to the point of origin? 回答1: Calculate the distance of each point using Math.sqrt( Math.pow(x, 2) + Math.pow(y, 2) ); Take the result that's the lowest var points = [ {x: 10, y: 20}, {x: 12, y: 18}, {x: 20, y: 30}, {x: 5, y: 40}, {x: 100,

Draw cube vertices with fewest number of steps

依然范特西╮ 提交于 2019-12-14 04:22:23
问题 What's the fewest number of steps needed to draw all of the cube's vertices, without picking up the pen from the paper? So far I have reduced it to 16 steps: 0, 0, 0 0, 0, 1 0, 1, 1 1, 1, 1 1, 1, 0 0, 1, 0 0, 0, 0 1, 0, 0 1, 0, 1 0, 0, 1 0, 1, 1 0, 1, 0 1, 1, 0 1, 0, 0 1, 0, 1 1, 1, 1 I presume it can be reduced less than 16 steps as there are only 12 vertices to be drawn You can view a working example in three.js javascript here: http://jsfiddle.net/kmturley/5aeucehf/show/ 回答1: Well I

Creating stereoParameters class in Matlab: what coordinate system should be used for relative camera rotation parameter?

徘徊边缘 提交于 2019-12-14 03:41:42
问题 stereoParameters takes two extrinsic parameters: RotationOfCamera2 and TranslationOfCamera2 . The problem is that the documentation is a not very detailed about what RotationOfCamera2 really means, it only says: Rotation of camera 2 relative to camera 1, specified as a 3-by-3 matrix. What is the coordinate system in this case ? A rotation matrix can be specified in any coordinate system. What does it exactly mean "the coordinate system of Camera 1" ? What are its x,y,z axes ? In other words,

Coordinate system transformation, 3d projection to 2d plane

こ雲淡風輕ζ 提交于 2019-12-13 11:23:58
问题 I have a global coordinates system (X, Y, Z), and a triangle with points (A, B, C and Center). I know all coordinates of those points. I need to move global coordinates system from (0; 0; 0) to the triangle center, so that all the points: A, B, C and Center would have new coordinates where Z = 0. After that i need to know new coordinates of those points in the relation with new coordinates system. The orientation of new coordinate system is not important. Also, if there is a possibility to