A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: Area of polygon - then something extra

  1. #21
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Hi Level,
    Hmmm, just thinking...
    Back in a few hours.

    M@)

  2. #22
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Think there may be some over engineering here. Solution shortly...

  3. #23
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Oh my god. It has taken me 12 hours to integrate the function with my own.

    But - even though is 04:30 in the morning. I am now a very happy man.

    Thank you Thank you Thank you...

    M@

  4. #24
    Member
    Join Date
    May 2002
    Posts
    97
    Well? What'd you do?

  5. #25
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Well, it does have to be complex. You can't just multiply things. Imagine you had an irregular shape with 15 sides.

    This has to be accurate. (up to about 10cm squared)

    But, its easier using the area of a polygon equation.

    In the end it took me a long time to integrate the code - but it is fairly straight forward. I'm still working on other bits now (30 hours and counting)...

    Ericlin's function starts at the top left and works its way round - drawing an inside shape. The main shape already exists. But to work out the area you must work your way round from the bottom right.

    The complexity came in because I have lots of different structures and array to integrate - not to mention the dynamic addition and removal of pegs - and showing the area and the margin shape all in real-time.

    Was fun - BUT DONE>...

    Will be presenting the work in site check soon.

    I love this project - I'm really happy with it. Hope it will be well received...

    Thanks for all you help so far guys. As with most good work, its hard graft, lost of book learnin, and a leg up form all you experts on flash kit forums!

    M@)

  6. #26
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Originally posted by ericlin
    Here is a try.

    The area should subtract the arc part.
    Hi Again ericlin,
    Before I start on a workaround - I thought, as the margin architect, id ask you first.

    If the peg is dragged so that the distance between it and the edge of the area is less than the margin - its starts to look a bit strange.

    What I was going to do was not let people drag pegs so that the angle between the walls goes below a defined minimum.

    What do you think would be best?

    Example:
    http://www.3ainteractive.com/example.jpg

    M@?

  7. #27
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    It wasn't too hard to add in. I just loop through checking each angle. If they go below 9 degrees, it goes back to the previous position.

    M@)

  8. #28
    Senior Member
    Join Date
    May 2001
    Posts
    1,838

    Well, there are many exceptions if the user is able to drag the pegs freely without limitation.

    For example, if user arranges the pegs to created an area like "8" with very narrowed neck then after we remove a boder of 10 pixels wide, the result might be just two un-connected circle area.

  9. #29
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    The angle thing is working good. To sove the other issue - I'm adding a detect that will not let people place any peg within [double the margin] of each other.

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