将点击数据保存到 table(处理中)
Saving click data to an table (Processing)
我试过查找问题,但遗憾的是我无法在其他线程中找到问题的答案。 :(
我的问题如下:
我已经掌握了将点击数据传输到热图中的代码。
现在我需要的是一种将所述点击数据传输到记录坐标的 table 的方法。
这是代码中的(希望)相关部分:
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);
代码用于软件"Processing"。
我希望我的问题足够具体。
提前致谢! =)
这是一个示例 Processing sketch,它将记录每次鼠标单击的坐标列表:
// 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
来访问它,它首先从[=12=获取位置0的PVector ],然后获取与该 PVector 对象关联的 x
值。
希望对您有所帮助!
您可以阅读 PVector class here
我试过查找问题,但遗憾的是我无法在其他线程中找到问题的答案。 :(
我的问题如下:
我已经掌握了将点击数据传输到热图中的代码。 现在我需要的是一种将所述点击数据传输到记录坐标的 table 的方法。 这是代码中的(希望)相关部分:
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);
代码用于软件"Processing"。 我希望我的问题足够具体。 提前致谢! =)
这是一个示例 Processing sketch,它将记录每次鼠标单击的坐标列表:
// 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
来访问它,它首先从[=12=获取位置0的PVector ],然后获取与该 PVector 对象关联的 x
值。
希望对您有所帮助!
您可以阅读 PVector class here