0
votes

This question is a bit specific. Assume for simplicity that I have a unit circle, i.e. a circle centered on the origin (0,0) with radius 1. On this circle I have three points: A, B, and C. Assume that B and C are fixed, and that A can be moved along the circle's circumference.

Question: What conditions can I check efficiently to ensure that A is not moved outside the arc between B and C originally containing it?

As a point of clarification: I do not just wish to detect whether the point is on this arc or not (i.e., get a boolean), but to have a quantifiable measure (for example, of distance) so I can prevent it from being moved outside. You can imagine my setup like this, restricting point A to the red arc:

enter image description here

Here are some ideas I have pondered so far, but none were successful:

  • Limit the angle alpha of A = [cos(alpha),sin(alpha)] to the origin between the angles beta and gamma of B=[cos(beta),sin(beta)] and C=[cos(gamma),sin(gamma)], where alpha, beta, and gamma are angles in radians. Unfortunately, this naive case only works in scenario (a) above. If the arc to which A is restricted crosses the (in my case, western) discontinuity from +pi/-pi, a naive upper and lower bound won't do.
  • Calculate the length of the arcs between A-to-B and A-to-C, then ensure that as A is moved this sum does not change. Unfortunately, I have only found this solution to calculate the arcs between two points, and it always calculates the shorter arc. In scenario (c), however, the correct arc A-to-B is the larger one.
2
Wrong forum, this would belong on math.stackexchange :) I dont understand your problem either, try to really point down what you are after. You have two points B and C, that are fixed. What so you want to do with A? Is it given, or are you trying to calculate a valid A, i dont get it.skalet

2 Answers

2
votes

Given any two points on a circle, in your case B and C, there are of course two possible arcs. We use A to select between the two options. You say you want to prevent a point, say D, from moving outside this arc. I'm interpreting this to mean that we want a function which, if D lies on the arc defined by BC and A, returns D, otherwise it returns B or C, depending on which is nearer to D.

We can define the following function to implement this scheme:

def contstrainPoint(A, B, C, D)
  M = midpoint(B, C)
  If dot(MA, MD) >= 0 
    return D
  else if(dot(MB, MD) >= 0 
    return B
  else
    return C

Where M is the midpoint of the chord BC and dot is the dot product function.

enter image description here

1
votes

Take the cross product (A-B)x(A-C). This will have one non-zero component, normal to the plane. That component will vary smoothly, positive when A is on one arc, negative when it is on the other, and zero when it crosses B or C.