我已经尝试过查询这个问题,但遗憾的是我无法在其他帖子中找到我的问题答案。 :(
我的问题如下:
我已经掌握了将点击数据传输到热图的代码。 现在我需要的是一种将所述clickdata传输到记录坐标的表格的方法。 以下是代码中的(希望)相关部分:
void mouseReleased()
{
if (mouseX >= 0 && mouseX < backgroundImage.width && mouseY >= 0 && mouseY < backgroundImage.height)
{
// blit the clickmapBrush onto the (offscreen) clickmap:
clickmap.blend(clickmapBrush, 0,0,clickmapBrush.width,clickmapBrush.height,mouseX-clickmapBrush.width/2,mouseY-clickmapBrush.height/2,clickmapBrush.width,clickmapBrush.height,BLEND);
// blit the clickmapBrush onto the background image in the upper left corner:
image(clickmapBrush, mouseX-clickmapBrush.width/2, mouseY-clickmapBrush.height/2);
// render the heatmapBrush into the gradientMap:
drawToGradient(mouseX, mouseY);
该代码用于软件“处理”。 我希望我的问题足够具体。 提前致谢! =)
答案 0 :(得分:0)
以下是一个示例处理草图,它将记录每次鼠标点击的坐标列表:
// We will store a list of coordinates,
// each representing a single mouse click's position
ArrayList<PVector> clickData;
void setup() {
clickData = new ArrayList<PVector>();
// Do any aditional setup you need here
}
void draw() {
// Do any drawing here
}
// Called after each press and release of the mouse
void mouseClicked() {
// Add the mouse's position to our list of mouse click positions
clickData.add(new PVector(mouseX, mouseY));
}
例如,如果要获取第一次记录的鼠标点击的x值,可以通过调用clickData.get(0).x
来访问它,该clickData
首先从x
抓取位置0处的PVector,然后得到与该PVector对象关联的DLog(
{ () -> String in
var text = "Returning output list\n"
for outline in outlines {
text = text + outline.debugDescription + "\n";
}
return text
}
)
值。
希望有所帮助!
您可以阅读有关PVector类here
的信息