Drawing an arc dynamically
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Drawing an arc dynamically

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Location
    Mamallapuram
    Posts
    4

    Drawing an arc dynamically

    Hi guys,
    I want to draw a dynamic arc on mouse move using Actionscript. If, I click and drag on stage, allow him to draw anything and in the end when mouse is released, i want to make that as arc. I can get the start and end point at mousedown and mouseup, point is how to calculate the angle and make it as arc on mouseup. will curveTo will help.

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    661
    flash's curveTo draws bezier arc. it looks like this:

    so yes, if that's what you mean by arc, it will help. if you mean circle arc, you still could use multiple curveTo-s to draw it approximately. in either case, you will first have to decide how to deal with user input that does not resemble arc. commonly used method for this is least squares, but I bet the formula will turn out rather complex for the arc (edit: check this paper), so you should try something else.
    Last edited by realMakc; 10-07-2013 at 11:44 AM.

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    661
    Quote Originally Posted by realMakc View Post
    if you mean circle arc, you still could use multiple curveTo-s to draw it approximately
    like this

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    661
    Quote Originally Posted by realMakc View Post
    like this
    wait, that's lineTo-s

  5. #5
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    661
    Had enough inspiration to actually try and do this: http://wonderfl.net/c/5B1p/read It does full circle (not arc) but I'm sure it's enough to get you started

  6. #6
    Junior Member
    Join Date
    Apr 2009
    Location
    Mamallapuram
    Posts
    4
    Quote Originally Posted by realMakc View Post
    flash's curveTo draws bezier arc. it looks like this:

    so yes, if that's what you mean by arc, it will help. if you mean circle arc, you still could use multiple curveTo-s to draw it approximately. in either case, you will first have to decide how to deal with user input that does not resemble arc. commonly used method for this is least squares, but I bet the formula will turn out rather complex for the arc (edit: check this paper), so you should try something else.
    Hi, thanks for reply, will try if i can get any from the link you posted, thanks a lot.

Tags for this Thread

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


HTML5 Development Center

Poll by Flashkit.com