coordinate-systems

Finding UV coordinates of a point on material rendered on 3D cube in threejs

天大地大妈咪最大 提交于 2019-12-13 03:44:18
问题 I want to calculate the UV co-ordinates of a single point of a material rendered on 3D cube. I am finding the mouse pointer intersection with the camera ray using THREE.Raycaster as: mouse.x = (event.clientX / window.innerWidth) * 2 - 1; mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; var vector = new THREE.Vector3(mouse.x, mouse.y, 1); vector.unproject(camera); var raycaster = new THREE.Raycaster(camera.position, vector.sub(camera.position).normalize()); var intersects = raycaster

Convert UIKit coordinates to SpriteKit coordinates

风格不统一 提交于 2019-12-12 10:47:12
问题 I am trying to convert normal uikit coordinates (top left origin, width and height go right and down) to Sprite Kit coordinates (origin is at center of node, left and down are negative, right and up are positive). Does anyone know how to do this? Unfortunately I can't work around this to my knowledge because I am using QuartzCore for drawing on a SKNode. Without converting, I am getting really off drawings. 回答1: According to the docs, SKView has methods for Converting Between View and Scene

2D Isometric(diamond shape) game engine - Reversed sprites

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:06:48
问题 All my sprites are reversed when I try to draw my isometric map. Here is the tileset.png mentionned in the following code : Object.h/Object.cpp I can use them to draw tiles, UI element, etc. ... #pragma once class Object { public: //FUNCTIONS Object(); void addComponent(float value); int getComponent(float index); void editComponent(float index, float value); void deleteComponent(float index); private: vector<int> components; }; #include "Object.cpp" - #pragma once //FUNCTIONS Object::Object(

Libgdx - Converting 2D map coords to 3D space coords

家住魔仙堡 提交于 2019-12-12 02:45:56
问题 I have an object moving about in a flat 2D coordinate system (0-1000,0-1000). In a 3D space coordinate system, I have a sphere and a camera looking at the sphere. I then want to convert these 2D coordinates to the 3D world/space coordinates and then move this object around the surface of the sphere. So, it's basically like converting Lat/Long into a 3D spacial coordinate. Currently I'm using setFromSpherical() but maybe I'm using it the wrong way. Vector3 my3DVector = new Vector3(0,0,0);

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,

Finding a gps location at a certain time given two points?

霸气de小男生 提交于 2019-12-11 23:35:53
问题 If I have two known locations and a known speed, how can I calculate the current position at distance d (in km)? For example, given: Two gps locations in ES4236: 37.783333, -122.416667 # San Francisco 32.715, -117.1625 # San Diego Traveling at 1km/min in a straight line (ignoring altitude) How can I find the gps coordinate at a certain distance? A similar SO question uses VincentyDistance in geopy to calculate the next point based on bearing and distance. I guess, more specifically: How can I

Ellipsoid creation in Python

☆樱花仙子☆ 提交于 2019-12-11 20:04:37
问题 I have ran into a problem relating to the drawing of the Ellipsoid. The ellipsoid that I am drawing to draw is the following: x**2/16 + y**2/16 + z**2/16 = 1. So I saw a lot of references relating to calculating and plotting of an Ellipse void and in multiple questions a cartesian to spherical or vice versa calculation was mentioned. Ran into a website that had a calculator for it, but I had no idea on how to successfully perform this calculation. Also I am not sure as to what the linspaces

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

Finding closest 90 degree angle spot

故事扮演 提交于 2019-12-11 18:25:34
问题 I've gotten pretty far but something just doesn't seem to work. A = 50.88259382849774,6.003988087177277 B = 50.88269282423443,6.0036662220954895 C = 50.882530369581545,6.003847271203995 The C coordinate is a little off from the 90 degree line (x) and this function I made should position C on the closest way to the x line. this.snapCoords = function(a, b, c){ var result = (b.x-a.x)*(c.x-b.x)+(b.y-a.y)*(c.y-b.y); var negative = false; if(result < 0){ result = result*-1; negative = true; }

Change origin of canvas

 ̄綄美尐妖づ 提交于 2019-12-11 17:54:31
问题 I have to create a canvas that contains object with position in binding with latitude and longitude. My canvas support element's drag and zooming but until now I have used always standard coordinate (from 0,0) Now I have GPS coords and all objects overlap each other because GPS coord is for example between 45°11'00'N and 45°11'60N... so is basically 1px of distance if I can't solve this conversion... also canvas starts from 0,0 and I have always 45 pixel of white space I can retrive minimum