finding uniformly spaced points on Arc2D

Discussion in 'Java' started by Jeff Higgins, Jan 8, 2007.

  1. Jeff Higgins

    Jeff Higgins Guest

    Hi,
    I would like to use java.awt.geom.Arc2D.Double
    to draw an arc. I would now like to draw tic marks
    onto the arc at uniformly spaced points.

    Can someone explain how I might find the uniformly
    spaced points on the arc?

    Thanks,
    Jeff Higgins
    Jeff Higgins, Jan 8, 2007
    #1
    1. Advertising

  2. Jeff Higgins wrote:

    > Can someone explain how I might find the uniformly
    > spaced points on the arc?


    Do you mean points that are an equal distance apart
    for an hypothetical traveller following the path, or points
    that are equally distant 'as the crow flies' (in a straight
    line from point A to point B)?

    Note that your words imply the second, but an arc
    might have any number of points that are 'uniformly
    spaced' from any given point.

    Andrew T.
    Andrew Thompson, Jan 8, 2007
    #2
    1. Advertising

  3. Jeff Higgins

    Jeff Higgins Guest

    Andrew Thompson wrote:
    > Jeff Higgins wrote:
    >
    >> Can someone explain how I might find the uniformly
    >> spaced points on the arc?

    >
    > Do you mean points that are an equal distance apart
    > for an hypothetical traveller following the path, or points
    > that are equally distant 'as the crow flies' (in a straight
    > line from point A to point B)?
    >

    Hi Andrew,
    Sorry for being unclear. Equal distance apart, as
    in the traveller. I'm attempting to draw a scale, much
    like the scale of a voltmeter.

    Thanks for any help you can give me,
    Jeff Higgins
    Jeff Higgins, Jan 8, 2007
    #3
  4. Jeff Higgins

    Googmeister Guest

    Jeff Higgins wrote:
    > Hi,
    > I would like to use java.awt.geom.Arc2D.Double
    > to draw an arc. I would now like to draw tic marks
    > onto the arc at uniformly spaced points.
    >
    > Can someone explain how I might find the uniformly
    > spaced points on the arc?


    It's an arc of a circle, say of d degrees. Just divide
    the arc into segments of d/n degrees to get n+1
    equally spaced points (both as-the-crow-flies
    and as-the-traveler-walks).
    Googmeister, Jan 8, 2007
    #4
  5. Googmeister wrote:
    > Jeff Higgins wrote:
    >
    >>Hi,
    >> I would like to use java.awt.geom.Arc2D.Double
    >>to draw an arc. I would now like to draw tic marks
    >>onto the arc at uniformly spaced points.
    >>
    >>Can someone explain how I might find the uniformly
    >>spaced points on the arc?

    >
    > It's an arc of a circle, say of d degrees. Just divide
    > the arc into segments of d/n degrees to get n+1
    > equally spaced points (both as-the-crow-flies
    > and as-the-traveler-walks).


    Equally-spaced both ways, but not quite the same distances. For a
    subtended angle of theta between successive ticks and a radius of rho
    for the full circle, the traveller walks a distance of

    rho*theta

    while the crow flies only

    rho*sqrt((cos(theta) - 1)^2 + sin(theta)^2)

    Note that the latter square root is of

    cos^2(theta) + sin^2(theta) - 2cos(theta) + 1

    which equals

    2 - 2cos(theta)

    so the crow flies rho*sqrt(2 - 2cos(theta))

    I leave proving sqrt(2 - 2cos(theta)) < theta as an exercise for the reader.
    John Ersatznom, Jan 8, 2007
    #5
  6. Jeff Higgins

    Daniel Pitts Guest

    Jeff Higgins wrote:
    > Hi,
    > I would like to use java.awt.geom.Arc2D.Double
    > to draw an arc. I would now like to draw tic marks
    > onto the arc at uniformly spaced points.
    >
    > Can someone explain how I might find the uniformly
    > spaced points on the arc?
    >
    > Thanks,
    > Jeff Higgins


    One solution might be to set up your graphics2d object to use a Stroke:

    <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/BasicStroke.html>

    graphics.setStroke(dashedStroke);
    Daniel Pitts, Jan 8, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer

    HTML seems double-spaced

    VB Programmer, Jun 9, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    4,640
    Kevin Spencer
    Jun 9, 2004
  2. bad_knee
    Replies:
    0
    Views:
    516
    bad_knee
    Jul 13, 2003
  3. bad_knee
    Replies:
    2
    Views:
    548
    bad_knee
    Jul 14, 2003
  4. Thomas Weidenfeller

    Re: JTextArea text is double-spaced?

    Thomas Weidenfeller, Jul 16, 2003, in forum: Java
    Replies:
    2
    Views:
    449
    Thomas Weidenfeller
    Jul 17, 2003
  5. Karsten

    vertically spaced div's

    Karsten, Apr 14, 2005, in forum: HTML
    Replies:
    4
    Views:
    373
    Duncan Greenhill
    Apr 16, 2005
Loading...

Share This Page