47
edits
QianqianLI (talk | contribs) No edit summary |
QianqianLI (talk | contribs) No edit summary |
||
Line 15: | Line 15: | ||
*Groups of persons mode: Measuring the pairwise distances between root nodes of three persons.<br> | *Groups of persons mode: Measuring the pairwise distances between root nodes of three persons.<br> | ||
== Process: == | == Process: == | ||
**Collecting the correlative data for the speed: Through the connecting of OSC and Motion Tracking platform, the root position and the updated data of one person could be obtained. The shifting distance and the relevant time decides the speed of the root node. | |||
**Collecting the correlative data for the speed: Through the connecting of OSC and Motion Tracking platform, the root position and the updated data of one person could be obtained. | Getting data from theCaputry then calculating the speed of the root<br> | ||
<source : "lang=java"> | |||
public void updateRoot(float x, float y, float z) { | |||
x2 = abs(x - x1); | |||
y2 = abs(y - y1); | |||
z2 = abs(z - z1); | |||
x1 = this.x; | |||
y1 = this.y; | |||
z1 = this.z; | |||
float distance = sqrt(sq(x2)+sq(y2)+sq(z2)); | |||
//Record the duration time that this bone move from the first point to the second point | |||
temptime = millis(); | |||
time2 = (temptime - time1)/1000; | |||
//Calculate the velocity of this bone | |||
vel = (distance/time2)*100; | |||
} | |||
</source> | |||
2. Calculating the speed of the root node; | |||
The shifting distance and the relevant time decides the speed of the root node. For the node vector, the movement in x,y,z position should be all considered. <br> | |||
<source : "lang=java"> | |||
float speed (Sphere sphere1) | |||
{ | |||
float vel2 = sphere1.vel-vel1; | |||
vel1 = sphere1.vel; | |||
return vel2; | |||
} | |||
<source> | |||
3.Calculating the distance between two root points. | |||
<source : "lang=java"> | |||
float distance (Sphere sphere1,Sphere sphere2) | |||
{ | |||
float distance = sqrt(sq(sphere1.x-sphere2.x)+sq(sphere1.y-sphere2.y)+sq(sphere1.z-sphere2.z)); | |||
float dis2; | |||
dis2 = distance; | |||
distance = distance-dis1; | |||
dis1 = dis2; | |||
return distance; | |||
} | |||
<source> | |||
4.Calculating the area of the triangle make up by three root points. | |||
<source : "lang=java"> | |||
float triangleSize(Sphere sphere1,Sphere sphere2,Sphere sphere3) | |||
{ | |||
float side_a = sqrt(sq(sphere1.x-sphere2.x)+sq(sphere1.y-sphere2.y)+sq(sphere1.z-sphere2.z)); | |||
float side_b = sqrt(sq(sphere1.x-sphere3.x)+sq(sphere1.y-sphere3.y)+sq(sphere1.z-sphere3.z)); | |||
float side_c = sqrt(sq(sphere2.x-sphere3.x)+sq(sphere2.y-sphere3.y)+sq(sphere2.z-sphere3.z)); | |||
float s = (side_a+side_b+side_c)/2; | |||
float triangleSize = sqrt(s*(s-side_a)*(s-side_b)*(s-side_c)); | |||
float size2; | |||
size2 = triangleSize; | |||
triangleSize = triangleSize-size1; | |||
size1 = size2; | |||
return triangleSize; | |||
} | |||
<source> | |||
Three root positions could form a triangle in the space. With the help of Heron’s formula, the area of the triangle could be calculated. | |||
5.According to the speed, distance, area giving different background color. | |||
<source : "lang=java"> | |||
//the maximum area is 6*6/2=18m^2,mapping the value of the area to the color of the background | |||
float size = triangleSize(sphere1,sphere2,sphere3); | |||
size = map(size,0,18,0,255); | |||
size = ceil(size); | |||
background(size); | |||
//the maximum distance is 6m,mapping the value of the distance to the color of the background | |||
float dis = ditance(sphere1,sphere2); | |||
dis = map(dis,0,6,0,255); | |||
dis = ceil(dis); | |||
background(dis); | |||
//the maximum speed of human is 10m/s,mapping the value of the speed to the color of the background | |||
float speed = speed(sphere1); | |||
speed = map(speed,0,10,0,255); | |||
speed = ceil(speed); | |||
background(speed); | |||
<source> |
edits