Results 1 to 9 of 9

Thread: Finding Chord Coordinate(s) {RESOLVED}

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    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.

  2. #2
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    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!!!

  4. #4
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    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.

  5. #5
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Hmmm.
    Seems to me you can have an infinite number of chords going thru 1 specified point.



    How do you know which chord you're investigating, given only 1 point and the radius of a circle?
    Attached Images Attached Images  

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    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

  7. #7
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking 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

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    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

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    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
  •  



Click Here to Expand Forum to Full Width