1
长坐标我想显示地图使用经度/纬度坐标从.csv
文件中的城市。这些值必须被转换成x
和y
值,以便使用处理在屏幕上显示。我的老师给了我这个代码,但是对于我的坐标,输出的地图旋转了90度。旋转LAT,已转换为像素
// 1. normalize the value between the minimum and maximum latitude or longitude values (new value between 0 and 1)
// 2. blow up the value between 0 and 1 by muliplying by the width or height of the screen (reduced by the margin 2 * 20 pixel)
// 3. shift the position by 20 pixel for the margin
float xPosition = 20 + (width-40) * norm(l.longitude, minLongCoord, maxLongCoord);
float yPosition = 20 + (height-40) * norm(l.latitude, minLatCoord, maxLatCoord);
有谁知道如何旋转x
和y
位置90度,并依次从坐标输出的地图吗?
编辑:随着翻译的问题是,如果我有一个鼠标点击功能看到鼠标是什么形状了,点击什么形状的鼠标在不对齐。
我试过,但问题是,地图包含一堆较小的形状。我正在使用beginShape()。这意味着每个单独的形状都会旋转,而不是整个地图。 – OptOut
@OptOut您可以围绕其中心旋转每个形状。或者你可以使用我提到的第二种方法。你也可以调用['PShape#rotate()'](https://processing.org/reference/PShape_rotate_.html)函数。 –
@OptOut beginShape()只是意味着该指令毕竟改造将在endShape()被重置,所以你可以把之前的旋转。 – Alex