|
-
May 11th, 2004, 08:30 PM
#1
Thread Starter
PowerPoster
Finding Chord Coordinate(s) {RESOLVED}
I know the center (X,Y) of the circle and the radius.
I also know one point (x,y) on a chord. I would like to draw a horizontal line from this chord point until it intersects the circle.
How do I find where (x,y) this chord intersects the circle???
Any forumla or ideas appreciated.
Thanks
David
Last edited by dw85745; Jun 4th, 2004 at 01:15 PM.
-
May 11th, 2004, 10:05 PM
#2
Fanatic Member
Get the angle from the center of the circle to the point on the cord, then use trig along with the radius to figure out the XY of the point along this angle on the circle.
Don't pay attention to this signature, it's contradictory.
-
May 12th, 2004, 08:59 AM
#3
Thread Starter
PowerPoster
BUT --
HOW do I determine the angle?
If I get the distance from the radius to the line, this would form a right angle, but depending on this distance (where the chord is)
the angle will vary!!!
-
May 12th, 2004, 03:48 PM
#4
Fanatic Member
You have two sides of a triangle, as well as one angle. You can figure out the remaining values with trigonometry. (You know trig, right?)
Hint: You have the hypotenus and the adjacent, you want the angle. Use ArcCos.
Then the problem of waht angle the triangle is actually tilted comes in.. I'm still thinking about that..
Don't pay attention to this signature, it's contradictory.
-
May 12th, 2004, 05:22 PM
#5
-
May 12th, 2004, 10:08 PM
#6
Thread Starter
PowerPoster
Thanks for responding guys:
I agree there could be an infinite number of chords
EXCEPT I only want the cord which is HORIZONTAL(in NotLKH example this would be chord1). The problem I see is that while the chord distance (y) is easily determined, the intersection of the chord with the circle (either x1 or x2) is not -- because the angle will change depending on the chord distance from the center of the circle.
THe only thing I can think of so far is to create a loop and walk a +/- x value looking for the circle color to indicate that the circle has been encountered. This presents other problems if the circle color is also used by other objects which may intersect or bisect the circle.
Any other ideas?
THanks
David
-
May 15th, 2004, 01:28 PM
#7
Fanatic Member
hmmm
This is what i'm thinking:
1) You know the center and radius
... Therefore, you know the equation.
2) You know the a point P = (px, py)
... Therefore you know the horizontal line through it is y = py
Putting these two together, solve simultaneously for x, remembering to use BOTH -ve and +ve roots.
I.e. centre = (X, Y) radius = R, point P = (px, py)
... equation of circle: (x - X)2 + (y - Y)2 = R2
... equation of line: y = py
... substituting gives:
(x - X)2 = R2 - (py - Y)2
(x - X) = +/- sqrt(R2 - (py - Y)2)
x = X +/- sqrt(R2 - (py - Y)2)
So, the two points are:
(X + sqrt(R2 - (py - Y)2), py), and
(X - sqrt(R2 - (py - Y)2), py),
sql_lall 
-
May 18th, 2004, 06:51 PM
#8
Thread Starter
PowerPoster
Thanks for responding sql_lall:
Will give your idea a chance.
Sorry for a late response but for some reason been having difficulty accessing forum last several days.
David
-
Jun 4th, 2004, 01:15 PM
#9
Thread Starter
PowerPoster
sql_lall:
Know I'm late with a thank you but got pulled off on another project. Just tried your code and WORKED PERFECTLY.
GOOD JOB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|