intersection between bisector and ellipse
in
Programming Questions
•
2 months ago
Hello,
I try to find the intersection point between bisector and the ellipse. In my sketch this point is the intersection of the red line start from the center of the ellipse pass by the red point C to the radius ellipse. I hope is clear.
I find no equation to calculate this point on internet. So if any body have an idea, thanks
Stan
I try to find the intersection point between bisector and the ellipse. In my sketch this point is the intersection of the red line start from the center of the ellipse pass by the red point C to the radius ellipse. I hope is clear.
I find no equation to calculate this point on internet. So if any body have an idea, thanks
Stan
- PVector pointA, pointB, pointC ;
void setup()
{
pointA = pointB = pointC =new PVector (0,0) ;
size( 400,400) ;
}
void draw()
{
background(0) ;
float size = 200 ;
noFill() ;
stroke(255) ;
ellipse(width/2, height/2, size, size) ;
//point A
pointA = new PVector (0,0) ;
pointA.x = AxisRotationPos(mouseX, width, size /2).x + width /2 ;
pointA.y = AxisRotationPos(mouseX, width, size /2).z +height/2 ;
ellipse (pointA.x, pointA.y, 10, 10 ) ;
//pointB
pointB = new PVector (0,0) ;
pointB.x = AxisRotationPos(mouseY, height, size /2).x + width /2 ;
pointB.y = AxisRotationPos(mouseY, height, size /2).z +height/2 ;
ellipse (pointB.x, pointB.y, 10, 10 ) ;
//line
line(pointA.x, pointA.y, pointB.x, pointB.y) ;
stroke(250,35,35) ;
line(width/2, height/2, pointC.x, pointC.y) ;
//point C bisector
pointC = new PVector(0,0) ;
noStroke() ;
fill(250,35,35) ;
pointC.x = bisector(pointA,pointB).x ;
pointC.y = bisector(pointA, pointB).y ;
ellipse(pointC.x, pointC.y, 20,20) ;
}
//ANNEXE VOID
float rotationPlan ;
PVector AxisRotationPos(int posMouse, int dist, float distanceToFocus)
{
PVector pos = new PVector (0,0,0) ;
rotationPlan = map(posMouse, 0, dist, 0, TAU) ;
PVector marge = new PVector((width -distanceToFocus *2.0) *.5,(height -distanceToFocus *2.0) *.5) ;
float dataPosXY = cos(rotationPlan) *distanceToFocus ;
float dataPosZ = sin(rotationPlan) *distanceToFocus ;
pos = new PVector ( dataPosXY, dataPosXY, dataPosZ ) ;
return pos ;
}
PVector bisector(PVector p1, PVector p2)
{
PVector b ;
b = PVector.add(p1, p2);
b.div(2) ;
return b ;
}
1