radial slider tuio
in
Contributed Library Questions
•
1 year ago
hi guy's
I have a problem, maybe someone can help me.
I have made an ellipse who slide on an arc with a tcur fonction in Tuio library
but it work with the height of the screen but I want to work with the height of de fiducial
How can I do this
thanks for your response
this is the code
I have a problem, maybe someone can help me.
I have made an ellipse who slide on an arc with a tcur fonction in Tuio library
but it work with the height of the screen but I want to work with the height of de fiducial
How can I do this
thanks for your response
this is the code
- void Tobject()
{
float obj_size = object_size*scale_factor;
Vector tuioObjectList = tuioClient.getTuioObjects();
for (int i=0;i<tuioObjectList.size();i++) {
TuioObject tobj = (TuioObject)tuioObjectList.elementAt(i);
noStroke();
if (+tobj.getSymbolID() == 0)
{
pushMatrix();
float a = map(tobj.getAngle(),0,6.30,1.5,4.8);
fill (0,0,255,100);
translate(tobj.getScreenX(width),tobj.getScreenY(height));
ypos = tobj.getY();
pushStyle();
noFill();
stroke(255,255,255,130);
strokeWeight(4);
strokeCap(ROUND);
arc(-obj_size/2+18,-obj_size/2+18,70,70,1.5,4.8);
arc(-obj_size/2+18,-obj_size/2+18,70,70,1.5,(a)%4.8);
pushStyle();
gain();
popStyle();
arc(-obj_size/2+18,-obj_size/2+18,70,70,5.5,7);
pushStyle();
noStroke();
fill(255,255,255,130);
ellipse(-obj_size/2+34,-obj_size/2+50,15,15);
popStyle();
popStyle();
rotate(tobj.getAngle());
bezierRect(-obj_size/2,-obj_size/2,obj_size,obj_size,2,2);
popMatrix();
println(ypos);
}
}
}
void bezierRect(float x, float y, float w, float h, float xr, float yr) {
float w2=w/2f, h2=h/2f, cx=x+w2, cy=y+h2;
beginShape();
vertex(cx,cy-h2);
bezierVertex(cx+w2-xr, cy-h2, cx+w2, cy-h2+yr, cx+w2, cy);
bezierVertex(cx+w2, cy+h2-yr, cx+w2-xr, cy+h2, cx, cy+h2);
bezierVertex(cx-w2+xr, cy+h2, cx-w2, cy+h2-yr, cx-w2, cy);
bezierVertex(cx-w2, cy-h2+yr, cx-w2+xr, cy-h2, cx, cy-h2);
endShape();
}
void octogone() {
float obj_size = object_size*scale_factor;
rect(-obj_size/2,-obj_size/2,obj_size,obj_size);
rotate(PI/4.0);
rect(-obj_size/2,-obj_size/2,obj_size,obj_size);
}
void gain() {
float obj_size = object_size*scale_factor;
fill(255,255,255,230);
noStroke();
float X = SIZE / 2 * cos(angle);
float Y = SIZE / 2 * sin(angle);
circleX = obj_size-38.5+X;
circleY = obj_size-39+Y;
ellipse(circleX, circleY, SIZE / 5, SIZE / 5);
Vector tuioCursorList = tuioClient.getTuioCursors();
for (int m=0;m<tuioCursorList.size();m++) {
TuioCursor tcur = (TuioCursor)tuioCursorList.elementAt(m);
angle = tcur.getY();
angle = map(angle,0,1.0,-0.7,0.6);
angle = constrain(angle,-0.7,0.6);
}}
1