is there no 3d supported ´qith android? otherwise you could just use a circle and rotate it in 3d instead if simulating a ball with bezier shapes in 2d.
the constrain function works like following:
you could constrain mouseX for example:
if you'D write
x = constrain(mouseX,0,50);
x would be the same as mouseX as long as its inbetween 0 and 50. as soon as mouseX is greater than 50, x just stays 50.
(example: mouseX = 23 -> x = 23 ; mouseX = 67 -> x = 50) same thing would happen if mouseX would be below zero
so you would have x staying in a range that you know. you could then map the values to something usefull for you, using tha map(); function.
if you write:
mappedX = map(x,0,50,0,1)
values from 0 to 50 are mapped onto values from 0 to 1
this could be something like what you wanted. you would have to figure out something better for the mapping, or try to build your bezierson the base of that code.
void setup(){
size(400,400,P3D);
background(255);
smooth();
}
void draw(){
background(255,100);
stroke(0);
fill(255);
ellipse(width/2,height/2,200,200);
stroke(255,0,0);
noFill();
//ellipse rotating depending on mouseX
pushMatrix();
translate(width/2,height/2,0);
float x = constrain(mouseX,width/2-100,width/2+100);
float constrainedX = map(x,width/2-100,width/2+100,0,PI);
rotateY(constrainedX);
ellipse(0,0,200,200);
popMatrix();
//ellipse rotating depending on mouseY
pushMatrix();
translate(width/2,height/2,0);
float y = constrain(mouseY,height/2-100,height/2+100);
float constrainedY = map(y,height/2-100,height/2+100,PI,0);
rotateX(constrainedY);
ellipse(0,0,200,200);
popMatrix();
}