Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
zoetang
zoetang's Profile
2
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
help me please
[1 Reply]
11-Oct-2011 10:12 AM
Forum:
Programming Questions
Hi all
Here is my script!!! How can I get position of Coordinate?
public static int NUM_LINES = 50;
class Ball {
float xpos;
float ypos;
float zpos;
float lnlength;
float[] rotY = new float[NUM_LINES];
float[] rotZ = new float[NUM_LINES];
Ball(int tempYpos, float tempSpeed) {
xpos = int(random(0, width));
ypos = tempYpos;
zpos = int(random(0, 899));
lnlength = int(random(20, 60));
for (int i = 0 ; i < NUM_LINES ; i++) {
rotY[i] = random(TWO_PI);
rotZ[i] = random(TWO_PI);
}
}
void display() {
strokeWeight(4);
PVector linep = new PVector (xpos,ypos,zpos);
point(linep.x, linep.y, linep.z);
stroke(255);
pushMatrix();
translate(linep.x, linep.y,linep.z);
for (int i = 0; i < NUM_LINES; i++) {
rotateY(rotY[i]);
rotateZ(rotZ[i]);
line(0,0,0,lnlength,lnlength,lnlength);
stroke(255);
strokeWeight(.5);
}
popMatrix();
}
boolean isNear(Ball k) {
stroke(225);
strokeWeight(4);
if (dist(xpos, ypos,zpos, k.xpos, k.ypos, k.zpos) < 200) {
return true;
}else{
return false;
}
}
}
Thx u very much
Position of Coordinate
[1 Reply]
25-Sep-2011 09:57 AM
Forum:
Programming Questions
Hi!! I'm a new Processing user.
How can I get the position of Coordinate after translate it?
-Thanks
«Prev
Next »
Moderate user : zoetang
Forum