Hi
I have been trying this for two days...
How to convert this "example code of make a cuve" into a PVector class and get the new location or velocity from the other PVector class, I think someone ask a bout two objects question, I don't know if it the same.
I don't know what should be in constructor, and why? like this:
Ball(PVector P) {
velocity = new PVector();
location =new PVector();
PVector acceleration=PVector.sub(location,velocity) ;
}
or
Ball(float _x,float _y) {
x = _x;
y=_y;
}
@ class is art @ (@_@) this problem had bother me long enough ...> <
here is my bad code :
....~'"~|||....#_# never work .....
here is the simple example which is worked with only one line, and no class
The idea is: I have a map, they have points in (x,y) creat I want to have a train or car drive on this route.
xPosition.txt
{
1408.0
1317.391112
1394.302423
1509.650022
1475.176701
1440.958262
1350.16011
1273.364917
1304.509774
1274.0
}
yPosition.txt
{
950.0
1053.201979
1126.070458
1164.261628
1294.595287
1425.331547
1528.800457
1640.490372
1771.466451
1905.0
}
my Xmas tree was made by this long way without class
http://www.openprocessing.org/sketch/48335
sorry the question is so long...
Hope some one know how to make it. .
Hi
I want to rotate one class of balls
I saw this
but still don't know how to deal with that if I have a class;
////////Here is my class code
class Station {
int radius;
int numberSt;
int xx, yy;
Station(int n, int centx, int centy, int rad) {
xx = centx;
yy = centy;
numberSt = n;
radius = rad;
ellipseMode(CENTER);
}
void display() {
float degreeInc = 2.0*( PI / numberSt);
int count = -1;
int[] pointsx = new int[ numberSt + 1];
int[] pointsy = new int[ numberSt + 1];
int smallRad = 10;
for ( float deg = 0; deg < 2*PI; deg = deg + degreeInc)
{
int dy = int(radius * sin(deg));
int dx = int(radius * cos(deg));
ellipse(xx+dx, yy+dy, smallRad, smallRad);
count++;
pointsx[count] = xx+dx;
pointsy[count] = yy+dy;
}
}
}
/////main code is
int numberSt=3;
int numStations =4;
Station[] stations= new Station[numStations];
void setup() {
size(600, 600);
background(0);
smooth();
ellipseMode(CENTER);
stations[0] = new Station(numberSt, 100, 100, 50);
stations[1] = new Station(numberSt, 300, 100, 50);
stations[2] = new Station(numberSt, 100, 300, 50);
stations[3] = new Station(numberSt, 300, 300, 50);
}
void draw() {
fill(0, 20);
rect(0, 0, width, height);
for (int i = 0; i <numStations; i++)
{
for (float c=0; c<2*PI; c+= 0.01){
pushMatrix();
translate(100,100);
rotate(c);
fill(255, 100);
stations[0].display();
popMatrix();
}
for (float c=0; c<2*PI; c+= 0.01){
pushMatrix();
translate(300,100);
rotate(c);
fill(255, 100);
stations[1].display();
popMatrix();
}
for (float c=0; c<2*PI; c+= 0.01){
pushMatrix();
translate(100,300);
rotate(c);
fill(255, 100);
stations[2].display();
popMatrix();
}
for (float c=0; c<2*PI; c+= 0.01){
pushMatrix();
translate(300,300);
rotate(c);
fill(255, 100);
stations[3].display();
popMatrix();
}
}
}
I try to put rotate(); inside the class, but didn't workout (-"-)
I am interested in following video,
I don't know how make the movement along the curve or some trajectory like "train", basicly, I tried to move point "like" curvy, but if I have specific line, I want the particles going alone this line, only I can get jumping behavior...not so smooth...I want the train.....
please (;-;) someone tell me how can I do it?