projection

Projecting 3D Point onto Viewport, Dealing With Negative Depth

两盒软妹~` 提交于 2019-12-06 15:03:25
I did a lot of searching but didn't find any solutions to this problem. I have a viewport where the center (where we are looking from) is always at (0,0,0). We are always looking in the direction of (0,0,1). After doing all my math, it simplified to: Projected X = 3D X Coordinate / 3D Z Coordinate Projected Y = 3D Y Coordinate / 3D Z Coordinate And it works perfectly. Every point is correctly projected onto the plane at z=1. But there is an issue with negatives depths. I could just not render polygons with negative depth points, but what if the triangle has other vertices that reach into the

How to change longitude range in a NetCDF

梦想的初衷 提交于 2019-12-06 11:13:30
My NetCDF file has 4 dimensions (longitude, latitude, time, level pressure) and several variables. I want to replace the longitude data which is [340 342 344 ... 360 0 2 4 ... 18 20] by [-20 -18 -16 ... -2 0 2 4 ... 18 20]. In fact the longitude is counted from 0° to 360° but I need to have it from -180° to 180°. I have found some ideas on Internet but I don't know how to apply them. Here an explanation: "Some netcdf files contain strictly positive values [0,360] which are not compatible with the way gdal/QGis treat longitude values - they do not wrap around the dateline. This also causes

Parse style attribute collection using linq

江枫思渺然 提交于 2019-12-06 11:04:14
I want to parse an SVG style attribute, which is just a delimited string, e.g. "fill:#e2b126;stroke:#010101;stroke-width:0.3177;stroke-miterlimit:10" into a Dictionary<string,string> so that I can perform some processing on it. Here's what I have, which does the job, but I'd like to make it neater using a linq projection, just can't seem to get the syntax. I tried using .Select().ToDictionary etc, but no joy. Thanks: string attributes = "fill:#e2b126;stroke:#010101;stroke-width:0.3177;stroke-miterlimit:10"; var pairs = attributes.Split(';').ToList(); var dic = new Dictionary<string, string>();

Calculation of a perspective transformation matrix

女生的网名这么多〃 提交于 2019-12-06 10:28:00
问题 Given a point in 3D space, how can I calculate a matrix in homogeneous coordinates which will project that point into the plane z == d , where the origin is the centre of projection. 回答1: OK, let's try to sort this out, expanding on Emmanuel's answer. Assuming that your view vector is directly along the Z axis, all dimensions must be scaled by the ratio of the view plane distance d to the original z coordinate. That ratio is trivially d / z , giving: x' = x * (d / z) y' = y * (d / z) z' = z *

Java: Convert lat/lon from EPSG:4236 to EPSG: 3857

丶灬走出姿态 提交于 2019-12-06 08:19:02
问题 How would I convert my lat lon to EPSG 3857 projection using geotools or another java library? I'm having trouble finding the proper methods to use. I know OpenLayers (javascript) can do it easily, but I don't see a clear path to getting these coordinates transformed. I would like to see this transformation source lon, lat: -71.017942, 42.366662 destination lon, lat: -71 1.25820, 42 22.0932 So I have created my CRS final CoordinateReferenceSystem source = CRS.decode( "EPSG:4236" ); final

How project Velodyne point clouds on image? (KITTI Dataset)

只愿长相守 提交于 2019-12-06 08:16:11
Here is my code to project Velodyne points into the images: cam = 2; frame = 20; % compute projection matrix velodyne->image plane R_cam_to_rect = eye(4); [P, Tr_velo_to_cam, R] = readCalibration('D:/Shared/training/calib/',frame,cam) R_cam_to_rect(1:3,1:3) = R; P_velo_to_img = P*R_cam_to_rect*Tr_velo_to_cam; % load and display image img = imread(sprintf('D:/Shared/training/image_2/%06d.png',frame)); fig = figure('Position',[20 100 size(img,2) size(img,1)]); axes('Position',[0 0 1 1]); imshow(img); hold on; % load velodyne points fid = fopen(sprintf('D:/Shared/training/velodyne/%06d.bin',frame

minimize euclidean distance from sets of points in n-dimensions

浪尽此生 提交于 2019-12-06 07:50:18
Let's look at m points in n-d space- (A solution for 4 points in 3-d space is here: minimize distance from sets of points ) a= (x1, y1, z1, ..) b= (x2, y2 ,z2, ..) c= (x3, y3, z3, ..) . . p= (x , y , z, ..) Find point q = c1* a + c2* b + c3* c + .. where c1 + c2 + c3 + .. = 1 and c1, c2, c3, .. >= 0 s.t. euclidean distance pq is minimized. What algorithms can be used ? Idea or pseudocode is enough. (Optimizing performance is a big issue here. Monte Carlo method with all vertices and changing coefficients would also give a solution.) We can assume p = 0 by subtracting p from all the other

Cartesian Coordinate System in Perspective Projection

最后都变了- 提交于 2019-12-06 07:43:18
I'm still implementing a perspective projection for my augmented reality application. I've already asked some questions about the viewport-calculation and other camera stuff, which is explained from Aldream in this thread However, I don't get any useful value at the moment and I think this depends on my calculation of the cartesian coordinate space. I had some different ways to transform latitude,longitude and altitude to a cartesian coordinate space, but nothing of them seems to work properly. Currently I'm using ECEF(earth centered), but I also tried different calculations like a combination

How can I find the 3D coordinates of a projected rectangle?

依然范特西╮ 提交于 2019-12-06 07:42:24
问题 I have the following problem which is mainly algorithmic. Let ABCD be a rectangle with known dimensions d1, d2 lying somewhere in space. The rectangle ABCD is projected on a plane P (forming in the general case a trapezium KLMN). I know the projection matrix H. I can also find the 2D coordinates of the trapezium edge points K,L,M,N. The Question is the following : Given the Projection Matrix H, The coordinates of the edges on the trapezium and the knowledge that our object is a rectangle with

Error when re-projecting spatial points using spTransform in rgdal R

你。 提交于 2019-12-06 07:03:07
问题 G'day, I have a large number of lon/lat coordinates that are in the CRS Australian Geodetic Datum 66/84 (AGD66 for brevity). I want to change these coordinates from AGD66 to WGS84 because there is about a 200m difference between them and I have other coordinates and layers in WGS84. I have tried to do this by: lon lat 147.1428 -43.49083 library(rgdal) pts<-read.table(file.choose(),header=TRUE,sep=',') # I first project the pts in their original CRS pts66<-project(cbind(pts$lon,pts$lat), "