coordinate-transformation

How do I compute the linear index of a 3D coordinate and vice versa?

被刻印的时光 ゝ 提交于 2019-12-03 06:41:40
If I have a point (x, y z), how do I find the linear index, i for that point? My numbering scheme would be (0,0,0) is 0, (1, 0, 0) is 1, . . ., (0, 1, 0) is the max-x-dimension, .... Also, if I have a linear coordinate, i, how do I find (x, y, z)? I can't seem to find this on google, all the results are filled with other irrelevant stuff. Thank you! Kevin There are a few ways to map a 3d coordinate to a single number. Here's one way. some function f(x,y,z) gives the linear index of coordinate(x,y,z). It has some constants a,b,c,d which we want to derive so we can write a useful conversion

how to scale the element by keeping the fixed position in svg

佐手、 提交于 2019-12-03 00:14:51
i want to scale the below element in fixed position. <path id="container_svg_rectsymbol1" fill="red" stroke-width="1" stroke="Gray" d="M 73.1111111111111 -71.75 L 83.1111111111111 -71.75 L 83.1111111111111 -61.75 L 73.1111111111111 -61.75 L 73.1111111111111 -71.75" transform="scale(1)"/> when am start scaling it moves from one location to another location. i don't want to move the object i just want to enlarge the size of object. i have referred following link. http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Transforming_the_Coordinate_System how to do fixed scaling ? i want to

Stretching Issue with Custom View Matrix

徘徊边缘 提交于 2019-12-02 07:57:12
I'm currently working on my own 2D Maths library for my project to improve my understanding of the underlying matrix math. In the past I've use libraries such as GLM but I felt like it might be worth looking into as a learning experience. Most of this has been straightforward and the majority of my Maths classes integrate and work well with OpenGL, however my view matrix appears to be stretching my quad at the edges of the window. Note this isn't an issue of perspective, not only am I using an Orthographic Matrix but I've separated this from the MVP, using the view matrix in the place of the

How to project a point on to a sphere

六眼飞鱼酱① 提交于 2019-12-01 15:20:33
If i have a point (x,y,z) how to project it on to a sphere(x0,y0,z0,radius) (on its surface). My input will be the coordinates of point and sphere. The output should be the coordinates of the projected point on sphere. Just convert from cartesian to spherical coordinates? Stephen Canon For the simplest projection (along the line connecting the point to the center of the sphere): Write the point in a coordinate system centered at the center of the sphere (x0,y0,z0): P = (x',y',z') = (x - x0, y - y0, z - z0) Compute the length of this vector: |P| = sqrt(x'^2 + y'^2 + z'^2) Scale the vector so

How to switch between Perspective and Orthographic cameras keeping size of desired object

谁都会走 提交于 2019-12-01 11:50:56
问题 I try to switch between Perspective and Orthographic cameras in my script. I want object on some depth to keep it's projection size. I gave up to understand the geometry... Could you provide some link to a simple tutorial this is too complicated for me. For object with position.z==0 i have: perspCamera = new THREE.PerspectiveCamera(45, W / H, 1, 1000); perspCamera.position.z = 100; var S=Math.tan((45/180)*Math.PI)*100; orthoCamera = new THREE.OrthographicCamera( -S, S, S, -S, 1, 1000 ); It is

Gyro Sensor drift and Correct angle Estimation

痞子三分冷 提交于 2019-11-30 21:23:01
I am using LG Optimus 2x smartphone(Gyroscope and Accelerometer sensor) for positioning. I want to get correct rotation angles from gyroscope that can be used later on for body to earth coordinate transformation. My question is that How I can measure and remove the drift in gyro sensor. The one way is to take the average of gyro samples (when mobile is in static condition) for some time and subtracting from current sample, which is not good way. When the mobile is in rotation/motion how to get the drift free angles? As far as I know, either the Kalman filter or something similar is implemented

ECEF from Azimuth, Elevation, Range and Observer Lat,Lon,Alt

随声附和 提交于 2019-11-30 15:49:46
I'm trying to write a basic python script that will track a given satellite, defined with tle's, from a given location. I'm not a asto/orbital person but am trying to become smarter on it. I am running into a problem when I try to convert the azimuth, elevation, range values to a ECEF position. I'm using PyEphem to get the observation values and spg4 to get the real location to verify. I'm also using the website, http://www.n2yo.com/?s=25544 , the verify the values. I'm getting the observed azimuth, elevation and range with: def get_ob(epoch, sv, obsLoc): site = ephem.Observer() site.lon = str

CSS3 zooming on mouse cursor

岁酱吖の 提交于 2019-11-30 11:24:25
问题 My goal is to create a plugin that enables zooming & panning operations on a page area, just like how Google Maps currently works (meaning: scrolling with the mouse = zooming in/out of the area, click & hold & move & release = panning). When scrolling, I wish to have a zoom operation centered on the mouse cursor. For this, I use on-the-fly CSS3 matrix transformations. The only, yet mandatory, constraint is that I cannot use anything else than CSS3 translate & scale transformations, with a

How to project top and bottom area of openGL control

我只是一个虾纸丫 提交于 2019-11-30 09:33:57
问题 Using below code I can display an image in openGL control. Which is in rectangular shape. Now I want to project top and bottom area of this rectangular to a cylindrical shape.I mean need to perform a rectangular to cylidrical projection on openGL. How can I achieve this? private void CreateShaders() { /***********Vert Shader********************/ vertShader = GL.CreateShader(ShaderType.VertexShader); GL.ShaderSource(vertShader, @"attribute vec3 a_position; varying vec2 vTexCoord; void main() {

Python - Batch convert GPS positions to Lat Lon decimals

南笙酒味 提交于 2019-11-30 09:12:48
问题 Hi I have a legacy db with some positional data. The fields are just text fields with strings like this 0°25'30"S, 91°7'W . Is there some way I can convert these to two floating point numbers for Decimal Latitude and Decimal Longitude ? EDIT: So an example would be: 0°25'30"S, 91°7'W -> 0.425 , 91.116667 where the original single field position yields two floats. Any help much appreciated. 回答1: This approach can deal with seconds and minutes being absent, and I think handles the compass