Advertisement

空间点像素索引(三)

阅读量:

空间点像素索引(三)

  1. 点与坐标轴点相互转换

在S2算法中,默认将Cell划分为等级为30;即该区域被划分为(2^30 × 2^30)个小区域。那么如何将s,t映射到该区域,并进行相应的转换呢?

在这里插入图片描述

s,t的值域是[0,1],现在值域要扩大到[0,230-1]。

// stToIJ converts value in ST coordinates to a value in IJ
coordinates.

func stToIJ(s float64) int {

return clamp(int(math.Floor(maxSize*s)),
0, maxSize-1)

}

C ++ 的实现版本也一样

inline int S2CellId::STtoIJ(double s) {

// Converting from floating-point to integers via
static_cast is very slow

// on Intel processors because it requires changing the

全部评论 (0)

还没有任何评论哟~