coordinates

move values of 2D array knowing new coordinates with mask

随声附和 提交于 2019-12-24 05:30:10
问题 I would like to "move" elements of a 2D array to new coordinates which are stored in 2 other arrays. I'm looking to automate this, because in reality my arrays are large (400x200x100). Some values wont find his coordinates and wont be used, Some of these coordinates are masked, which I have indicated in the example below by using the value 0. If the coordinate is masked, the elements in the array I want to reshuffle won't be used. import numpy as np #My new coordinates in X and Y directions

Crossing axis and labels in matlab

浪子不回头ぞ 提交于 2019-12-24 04:49:05
问题 I just can't find it. How to set up axis and labels in matlab so they cross at zero point, with the labels just below the axis not on left/bottom of the plot ? If I didn't make myself clear - I just want the plot to look like like we all used to draw it when in school. Axes crossing, 4 quadrants, labels right below axis, curve ... as it goes. Anyone knows how to set it up ? 回答1: You should check out two submissions on The MathWorks File Exchange: PlotAxisAtOrigin by Shanrong Zhang axescenter

Remove string quotes from array in Python

余生长醉 提交于 2019-12-24 03:44:16
问题 I'm trying to get rid of some characters in my array so I'm just left with the x and y coordinates, separated by a comma as follows: [[316705.77017187304,790526.7469308273] [321731.20991025254,790958.3493565321]] I have used zip() to create a tuple of the x and y values (as pairs from a list of strings), which I've then converted to an array using numpy . The array currently looks like this: [['316705.77017187304,' '790526.7469308273,'] ['321731.20991025254,' '790958.3493565321,']] I need the

How to get pixel coordinates from canvas polygon (filled area)

左心房为你撑大大i 提交于 2019-12-24 03:29:51
问题 I am creating an interface that enables user to hightlight custom area in map with overlay canvas polygons . as in figure. then, I want to get all filled pixels from canvas with specified color so that I can transform that pixel values into geo LAT-LONG values. I want to create custom database that hold LAT-LONG values ranges with tagged custom known names. It's ok to create overlay canvas polygons by mouse-dragging. But I have a problem in retrieving filled area from canvas as pixel array. I

How to find out whether an affine transformed rectangle contains a certain point, in Java?

夙愿已清 提交于 2019-12-24 02:23:42
问题 I'm trying to make an interactive GUI but I need to move a certain object whenever that rectangle is clicked + dragged. Basically I wanna know whether a rectangle, that has been affine transformed, contains a specific point (x, y). Is there a way to do this? I have tried using contains() method but it doesn't work for a rectangle that has been affine transformed. I checked the Java tutorials but the user interactive GUIs don't use affine transformation. Can someone point me to a tutorial that

Realloc double 2D array in C

大兔子大兔子 提交于 2019-12-24 02:17:26
问题 I wrote an function which should realloc the array for each input. I think that function works well, but when I'm trying to work with the array I got segmentation fault. Input: [1,2] [6,3] [2.5,3.5] I have to check if the user enters input in the correct form '[' number ',' number ']' . I have to have at least 2 entries. The end of input isn't new line, but EOF ( CTRL + D or CTRL + Z ). My code: double ** allocation (double ** field, int i) { double x = 0, y = 0; char obr[1], cbr[1], col[1];

Get absolute pixel coordinates from LatLng

感情迁移 提交于 2019-12-24 02:11:57
问题 I need the absolute pixel coordinates from a LatLng coordinate in Leaflet. Just to make it clear, these coordinates are the pixel distance from the upper left corner till a LatLng coordinate on the map. I read the The pixel origin chapter from the extending Leaflet Tutorial but I don't get it. latLngToLayerPoint or project conversion methods should do it - but I don't get the real pixel position: const pixelPoint = map.project(feature.geometry.coordinates[0], map.getZoom()); const pixelOrigin

BoundingBox around a geo coordinate

烂漫一生 提交于 2019-12-24 01:28:01
问题 I am currently playing a bit with Android and GPS tracking and so forth. I found out, that I have to call the OSM API with the corner points of the bounding I want to get POIs for example. I would like to achieve, that I get my current cooredinates from the handset (which allready works) and then get some pois from OSM for the bounding box where my current position is the center. I could imagine a function like that: public Map getBoundingBox(Double long, Double lat, int meters); BUT I do not

How to index observable coordinates in an astropy Table

不打扰是莪最后的温柔 提交于 2019-12-24 00:58:29
问题 I asked this question (How to sort through a list of observable coordinates?) yesterday about sorting a list of coordinates to remove certain values below a threshold, I got a great answer from @MSeifert but I have a table in which these coordinate values are matched up with other properties of the targets (e.g. apparent magnitude and Alt/Az coordinates), so what I am asking for now is a way to do this masking technique in an astropy.table rather than an astropy.coordinates.SkyCoord list from

Check if coordinate in selected area

只愿长相守 提交于 2019-12-24 00:57:46
问题 I have 4 coordinates of area: x1,y1 ... etc. And have one more position x0,y0 . How to check if my coordinate in selected area? 回答1: I will explain you how to check that (x0,y0) lies "below" the line through (x1,y1) and (x2,y2). Essentially, you want that the vector (x0-x1,y0-y1) points "to the right" of (x2-x1, y2-y1). This is equivalent to saying that the matrix x0-x1 y0-y1 x2-x1 y2-y1 has a negative determinant. So your condition becomes (x0-x1)(y2-y1) < (y0-y1)(x2-x1). You get such a