We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Newbie with need of help on project
Page Index Toggle Pages: 1
Newbie with need of help on project (Read 439 times)
Newbie with need of help on project
Apr 17th, 2008, 12:22am
 
I am trying to control a set of gages on my GUI and i need help controlling the needle in the center of it based on the values created in a database in MYSQL. If any one has any advice or can help please contact me.

Thanks...

Re: Newbie with need of help on project
Reply #1 - Apr 20th, 2008, 5:50pm
 
You might try to elaborate a little and maybe provide some sample code, that's why 40 people have looked at your post but no one has replied.
Re: Newbie with need of help on project
Reply #2 - Apr 24th, 2008, 1:43pm
 
Sorry im new at this but i kinda figured it out but i have another question regarding how to modify an existing program. The program is Movingoncurves and i am trying to modify it so that it moves according to coordinents from an array instead of using the mouse. I kinda have an idea but maybe some one can suggest something or can help me out. The code is below...

float beginX = 20.0;  // Initial x-coordinate
float beginY = 10.0;  // Initial y-coordinate
float endX = 170.0;   // Final x-coordinate
float endY = 180.0;   // Final y-coordinate
float distX;          // X-axis distance to move
float distY;          // Y-axis distance to move
float exponent = 4;   // Determines the curve
float x = 0.0;        // Current x-coordinate
float y = 0.0;        // Current y-coordinate
float step = 0.01;    // Size of each step along the path
float pct = 0.0;      // Percentage traveled (0.0 to 1.0)

void setup()
{
 size(200, 200);
 noStroke();
 smooth();
 distX = endX - beginX;
 distY = endY - beginY;
}

void draw()
{
 fill(0, 2);
 rect(0, 0, width, height);
 pct += step;
 if (pct < 1.0) {
   x = beginX + (pct * distX);
   y = beginY + (pow(pct, exponent) * distY);
 }
 fill(255);
 ellipse(x, y, 20, 20);
}

void mousePressed() {
 pct = 0.0;
 beginX = x;
 beginY = y;
 endX = mouseX;
 endY = mouseY;
 distX = endX - beginX;
 distY = endY - beginY;
}
Page Index Toggle Pages: 1