标签: coordinates

将坐标从矩形转换为平行四边形

我陷入了一个简单但令人烦恼的基本几何问题。太糟糕了,我不记得我高中时的坐标几何并寻求帮助。

我的问题如下图所示:一个矩形旋转、缩放并扭曲成平行四边形 http://img248.imageshack.us/img248/8011/transform.png

我正在努力将坐标从矩形转换为调整大小的平行四边形。任何提示、指针和/或代码示例都会很棒!

谢谢,M。

c# geometry coordinates

2
推荐指数
1
解决办法
3545
查看次数

如何计算处理中两个给定点之间的点?

我有两个给定的坐标,例如 (20,30) 和 (90,40)。我怎样才能在这两个点之间的线上找到一个点?

我需要在处理过程中做到这一点,但一般的数学解决方案也会对我有所帮助。

java math processing line coordinates

2
推荐指数
1
解决办法
1663
查看次数

在 gnuplot 中的两点之间绘制一条线

我有一个 csv 文件,其格式如下,有四列(作为MWE):

xcoord1,ycoord1,xcoord2,ycoord2
0.1,0.2,0.4,0.3
0.5,0.3,0.7,0.5
Run Code Online (Sandbox Code Playgroud)

我想从每个xcoord1,ycoord1xcoord2,ycoord2使用 gnuplot绘制一条线。例如,在这种情况下,我将从0.1,0.2to0.4,0.30.5,0.3to画两条线0.7,0.5

这怎么可能?

plot gnuplot line coordinates

2
推荐指数
1
解决办法
6862
查看次数

从 R 中的已知中心点查找半径内的纬度/经度

我有一个已知经度和纬度的已知点(中心),我在 df 中有一些坐标(以纬度/经度表示),我想查看哪些坐标在距中心点 5 公里或更小的半径范围内。

中心

mylon <- c(-2.106472)
mylat <- c(57.14455)
Run Code Online (Sandbox Code Playgroud)

坐标

longitude latitude
 [1,] -2.141177 57.16278
 [2,] -2.090960 57.18079
 [3,] -2.118894 57.12292
 [4,] -2.140090 57.13763
 [5,] -2.113988 57.13855
 [6,] -2.123892 57.13585
 [7,] -2.144685 57.17207
 [8,] -2.220046 57.19150
 [9,] -2.114343 57.09301
[10,] -2.285314 57.20138
[11,] -2.092354 57.14279
[12,] -2.149571 57.15334
[13,] -2.126605 57.15615
[14,] -2.097045 57.10443
[15,] -2.183441 57.15051
[16,] -2.166915 57.15089
[17,] -2.133863 57.15201
[18,] -2.100909 57.18968
[19,] -2.106770 57.15670
[20,] -2.251495 57.19315
[21,] -2.118894 57.12292
[22,] -2.140090 …
Run Code Online (Sandbox Code Playgroud)

r coordinates coordinate-systems

2
推荐指数
2
解决办法
1702
查看次数

使用原始点列表在 Python/cv2 中查找重叠矩形的区域

我有一个矩形的坐标x1, y1, x2,y2和其他矩形的其他坐标列表。

我想将我已经拥有的值与其他值进行比较,以查看它们是否比50%原始矩形重叠更多。

我检查了其他资源,但仍然可以理解它:

python opencv coordinates python-3.x cv2

2
推荐指数
1
解决办法
4835
查看次数

单位球体上两个“P = (x, y, z)”点之间的大圆距离

我需要使用单位球体上的坐标 ( x, y, z )来计算两点之间的距离。

两个半正弦波和大弧线距离使用(经度和纬度)。我如何为x, y, z编写这些公式?

python trigonometry distance coordinates

2
推荐指数
1
解决办法
1984
查看次数

Python:Web Scraping - Airbnb 获取列表的纬度和经度值

我正在尝试获取出现在 Airbnb 中的房源的纬度和经度,我认为该信息位于嵌入式谷歌地图中。当我尝试通过使用 lxml 库或 Beautiful Soup 复制完整的 Xpath 来抓取该对象时,我无法获得它。例如列表https://www.airbnb.co.uk/rooms/15307317,在地图中心具有经度和纬度信息的对象,带有标签 div img 和属性 data-veloute = "map/GoogleMapStatic ",我尝试使用以https://maps.googleapis.com/maps/api/staticmap?center=开头的链接,但我无法用我的代码识别正确的对象。

url = 'https://www.airbnb.co.uk/rooms/15307317'
response = http.request('GET', url)
soup = BeautifulSoup(response.data, 'lxml')
soup.find("div", {"data-veloute":"map/GoogleMapStatic"})
soup.find("img", {"data-veloute":"map/GoogleMapStatic"})
Run Code Online (Sandbox Code Playgroud)

或使用下一个代码:

resp = requests.get(url, headers=headers)
tree = html.fromstring(resp.content)
tree.xpath('/html/body/div[5]/div/main/div/section/div/div[2]/div/div[2]/div[1]/div/div[10]/div/div/div/div/div/section/div[2]/div[2]/div[2]/img')
Run Code Online (Sandbox Code Playgroud)

有没有可能得到这些信息?

python coordinates web-scraping airbnb-js-styleguide

2
推荐指数
1
解决办法
1072
查看次数

在 HashSet 中存储坐标

我正在尝试将坐标存储在 HashSet 中并检查我的集合中是否存在坐标。

    HashSet<int[]> hSet = new HashSet<>();
    hSet.add(new int[] {1, 2});
    hSet.add(new int[] {3, 4});
    System.out.println(hSet.contains(new int[] {1, 2}));

>>> false
Run Code Online (Sandbox Code Playgroud)

我对 Java 比较陌生,根据我的理解,上面的输出为 false 是由于比较了 int[] 数组的引用,而不是它们值的逻辑比较。但是,使用 Arrays.equals() 不会使用散列集的散列,因为我必须遍历其所有元素。

我还阅读了其他问题,不建议在集合中使用数组。

因此,如果我希望在 HashSet 中存储坐标对,我应该使用什么数据结构,以便我可以使用哈希码搜索元素?

java hashset coordinates

2
推荐指数
1
解决办法
555
查看次数

How to generate array of n equidistant points along a line segment of length x?

I ported this function from a python answer to a similar question on this site. However, although the points are equidistant from each other, they are not centered on the line.

The first point is at 0 while the last is at 83 (the end of the line segment is 100).

How do I center this row of points?

Specifically, I want the first point to be the same distance from 0 that the last point is from 100 …

javascript algorithm point line coordinates

2
推荐指数
1
解决办法
288
查看次数

在 annotate() 中使用 npc 单位

我有一个 ggplot 对象。我想添加一些带有 的文本annotate(),并且我想以 npc 单位指定文本的坐标。这可能吗?

这个最小的例子演示了文本通常是如何定位的annotate()

library(ggplot2)
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
p + annotate("text", x = 30, y = 4.5, label = "hello")
Run Code Online (Sandbox Code Playgroud)

我想达到相同的效果,但不是在本地坐标中指定xy,我想用 npc 坐标指定它们。出于本示例的目的,我并不担心准确地转换x = 30y = 4.5转换为 npc 单位。我只是想知道是否可以使用npc单位annotate()

有两种相关的策略,但它们并不完全令人满意:

  1. 人们可以通过将它们指定为,例如,来使用 npc 单位grid::textGrob()。然后可以将grob放置在annotation_custom(),如@baptiste 的这个答案中所示。但是这个解决方案比我想要的要麻烦一些。

  2. “ggpmisc”包包括geom_text_npc(). 但它还不适用于annotate(). 也就是说,annotate("text_npc", ...)似乎不起作用。[编辑:它现在可以工作了。见下面佩德罗·阿法洛的消息。]

还有很多相关的帖子。特别是,Greg Snow 建议使用网格创建一个具有 …

grid r coordinates ggplot2 ggpmisc

2
推荐指数
1
解决办法
334
查看次数