Author Topic: Smoothboard Order of Operations  (Read 6907 times)

Offline Wiweeyum

  • *
  • Posts: 203
  • Karma: +7/-0
    • View Profile
on: December 16, 2008, 10:28:50 AM
I'm writing a program that will be used as a digital guestbook at weddings that I'll post into the project forums once I actually have something more tangible than an idea.

My concern is this. I'm using Smoothboard as the tracking software, and I'm coding the guestbook in Processing. Being able to sign a guestbook is pretty important i think, which is why using the wiimote is perfect for this application. Anyway, the code I've been working on is to make a good input for handwriting.

When I draw with the mouse, it works perfectly. Separate lines.


When I run the program and use the IR pen, the left click seems to work a bit differently.

As you can see I can draw a line just fine, but when I place the pen to a new spot and click the button to 'left-click' again, a line is created between the last point and the current point. It's like Smoothboard activates the click just before it jumps to the new location. No good.

When I do the same thing in any other drawing program, such as Paint or Photoshop etc, it doesn't have this problem.

I have no idea where to start looking for the source of the problem. Maybe it's an operation order within Processing, maybe it's in Smoothboard. I'm not really sure. Any suggestions?


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher


Offline boonjin

  • *
  • Posts: 929
  • Karma: +28/-0
  • Smoothboard Developer
    • View Profile
    • Smoothboard
Reply #1 on: December 16, 2008, 06:32:14 PM
Hi Wiweeyum,

Most probably is the mouse simulation code that I am using, which looks like not truly compatible with your environment.

Can you give more details about your operating environment?

Regards,
Boon Jin

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url


Offline Wiweeyum

  • *
  • Posts: 203
  • Karma: +7/-0
    • View Profile
Reply #2 on: December 16, 2008, 07:42:19 PM
I'm running XP Home. Aside from that I'm not sure what other information you'd like. What else do you want to know specifically?


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher


Offline boonjin

  • *
  • Posts: 929
  • Karma: +28/-0
  • Smoothboard Developer
    • View Profile
    • Smoothboard
Reply #3 on: December 17, 2008, 06:36:30 PM
I'm running XP Home. Aside from that I'm not sure what other information you'd like. What else do you want to know specifically?

Your processing application.

I have not worked with many processing applications before.

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url


Offline Wiweeyum

  • *
  • Posts: 203
  • Karma: +7/-0
    • View Profile
Reply #4 on: December 18, 2008, 03:38:12 AM
Ah, I use this:
http://processing.org/download/index.html

If you want to mess with it yourself, the program I took screenshots of is one of the example scripts that came with the download.

Within Processing, click:
File > Examples > Topics > Drawing > ContinuousLines

For those screenshots, the code was entirely unaltered.

I was planning on testing to see if it does the same thing with Johnny's whiteboard software, but have not as of yet. I'll let you know when I do.


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher


Offline boonjin

  • *
  • Posts: 929
  • Karma: +28/-0
  • Smoothboard Developer
    • View Profile
    • Smoothboard
Reply #5 on: December 22, 2008, 06:11:33 PM
Hi,

I have modified the sample processing code.
The issue with it is because of the line() function previously it has been using.
It will always draw a line between the previous mouse location and the new mouse location. For a real mouse this is not an issue because the previous location.frame of the mouse pointer will be approximately the position of the current click position.

For the wiimote whiteboard or most touch surfaces, the previous mouse location will be previous click location.

I have modified the code to draw a point when the pointer is first clicked instead of a line.

It should work correctly now. :)

Regards,
Boon Jin

Code: [Select]
/**
 * Continuous Lines.
 *
 * Click and drag the mouse to draw a line.
 * Modified by Goh Boon Jin
 */
 boolean released = true;
 
void setup() {
  size(500, 500);
  background(102);
}

void draw() {
  stroke(255);
 
  if(mousePressed && this.released ==true) { //first click
     point(mouseX, mouseY);
    this.released = false;
  }
  else if (mousePressed && this.released == false) //dragging
  {
   line(mouseX, mouseY, pmouseX, pmouseY);
    this.released = false;
  }
  else if (!mousePressed && this.released ==false) //releasing key
  {
   this.released =true;
  }
}

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url


Offline Wiweeyum

  • *
  • Posts: 203
  • Karma: +7/-0
    • View Profile
Reply #6 on: December 25, 2008, 09:54:35 PM
Fantastic. Thanks Much Boonjin!


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher