coordinates

Generating triangular/hexagonal coordinates (xyz)

假装没事ソ 提交于 2019-11-26 15:18:49
问题 I'm trying to come up with an iterative function that generates xyz coordinates for a hexagonal grid. With a starting hex position (say 0,0,0 for simplicity), I want to calculate the coordinates for each successive "ring" of hexagons, as illustrated here: So far, all I've managed to come up with is this (example in javascript): var radius = 3 var xyz = [0,0,0]; // for each ring for (var i = 0; i < radius; i++) { var tpRing = i*6; var tpVect = tpRing/3; // for each vector of ring for (var j =

How to position a DIV in a specific coordinates?

巧了我就是萌 提交于 2019-11-26 15:06:30
问题 I want to position a DIV in a specific coordinates ? How can I do that using Javascript ? 回答1: Script its left and top properties as the number of pixels from the left edge and top edge respectively. It must have position: absolute; var d = document.getElementById('yourDivId'); d.style.position = "absolute"; d.style.left = x_pos+'px'; d.style.top = y_pos+'px'; Or do it as a function so you can attach it to an event like onmousedown function placeDiv(x_pos, y_pos) { var d = document

Is OpenGL coordinate system left-handed or right-handed?

廉价感情. 提交于 2019-11-26 14:53:12
I am trying to understand the OpenGL coordinate system. However, some tutorials say the default coordinate system is left handed (see http://www.c-sharpcorner.com/UploadFile/jeradus/OpenGLBasics11172005014307AM/OpenGLBasics.aspx ) and others say it is right handed (see http://www.falloutsoftware.com/tutorials/gl/gl0.htm ). Which is correct? I understand that we can transform one to the other by mirroring but I would like to know the default coordinates. There is some confusion here. OpenGL is right handed in object space and world space. But in window space (aka screen space) we are suddenly

Converting 3D position to 2d screen position [r69!]

╄→尐↘猪︶ㄣ 提交于 2019-11-26 14:24:33
I need Three.js code to convert 3D object coordinates to 2d ones in a 'div' element so that I can place text labels where they need to be (without those labels scaling/moving/rotating along with the 3D movement). Unfortunately, all of the examples that I have seen and tried so far seem to be using obsolete functions/techniques. In my case, I believe that I am using r69 of Three.js. Here is an example of an 'older' technique that just produces errors for me: Three.js: converting 3d position to 2d screen position Here is a snippet of some newer code (?) that doesn't provide sufficient context

Convert Lat/Longs to X/Y Co-ordinates

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 13:59:45
问题 I have the Lat/Long value of an small area in Melbourne; -37.803134,145.132377 and also a flat image of that,that I exported from openstreet map( Osmarender Image ). Image width : 1018 and Height:916 I would like to be able to convert, using C++, the Lat/Long to an X,Y coordinate where the point would reflect the location. I used various formula's that I found in web like one given below but nothing helps. var y = ((-1 * lat) + 90) * (MAP_HEIGHT / 180); var x = (lon + 180) * (MAP_WIDTH / 360)

Drawing part of a Bézier curve by reusing a basic Bézier-curve-function?

岁酱吖の 提交于 2019-11-26 13:08:15
问题 Assuming I\'m using some graphic API which allows me to draw bezier curves by specifying the 4 necessary points: start, end, two control points . Can I reuse this function to draw x percent of the \'original\' curve (by adjusting the control points and the end point)? Or is it impossible? Unnecessary information, should someone care: I need the whole thing to draw every n % of the original bezier curve with different color and/or line style I\'m using Java\'s Path2D to draw bezier curves:

Converting Longitude & Latitude to X Y on a map with Calibration points

我与影子孤独终老i 提交于 2019-11-26 12:11:33
问题 If i have a jpeg map with size sizeX, sizeY and some calibration points on the map (X, Y, Lon, Lat) What would be the algorithm for calculating the corresponding XY point in the map with a given Longitude / Latitude pair? 回答1: Here's what worked for me, without so much bs. int x = (int) ((MAP_WIDTH/360.0) * (180 + lon)); int y = (int) ((MAP_HEIGHT/180.0) * (90 - lat)); The lat,lon coordinates were given to me by Android devices. So they should be in the same standard used by all Google Earth

Convert Lat/Longs to X/Y Co-ordinates

独自空忆成欢 提交于 2019-11-26 12:02:12
问题 I have the Lat/Long value of New York City, NY; 40.7560540,-73.9869510 and a flat image of the earth, 1000px × 446px. I would like to be able to convert, using Javascript, the Lat/Long to an X,Y coordinate where the point would reflect the location. So the X,Y coordinate form the Top-Left corner of the image would be; 289, 111 Things to note: don\'t worry about issues of what projection to use, make your own assumption or go with what you know might work X,Y can be form any corner of the

How to draw lines in Java

送分小仙女□ 提交于 2019-11-26 10:51:24
问题 I\'m wondering if there\'s a funciton in Java that can draw a line from the coordinates (x1, x2) to (y1, y2)? What I want is to do something like this: drawLine(x1, x2, x3, x4); And I want to be able to do it at any time in the code, making several lines appear at once. I have tried to do this: public void paint(Graphics g){ g.drawLine(0, 0, 100, 100); } But this gives me no control of when the function is used and I can\'t figure out how to call it several times. Hope you understand what I

Convert long/lat to pixel x/y on a given picture

こ雲淡風輕ζ 提交于 2019-11-26 10:07:28
问题 I have a city map of Moscow. We modified a Google Maps image with some artistic elements, but the relation between GPS coordinates and pixels remains the same. Problem: How do I convert GPS coordinates from various data points we have into pixel coordinates in the image? Ideally I can do this in Javascript, but PHP would be OK. I know that on small scales (for example on city scales) it to make simply enough (it is necessary to learn what geographic coordinates has one of picture corners,