To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > General Help > Math and Physics

Reply
 
Thread Tools Search this Thread Display Modes
Old 11-25-2009, 05:38 PM   #1
dtone314
</hate>
 
dtone314's Avatar
 
Join Date: Jun 2005
Location: CA
Posts: 253
Arc based on Start/End points and Radius- Mostly done

Hi everyone. I'm trying to create an arc based on start and end points, and a radius.

I've been working on this for a few days now, and I can get close, but not quite there. I did some searching and found some code to help me, which connects 3 points by drawing an arc, but I need to be able to specify the radius of the arc and have it connect two points based on that.

The complex math is done, I'm just not sure how to tweak the code to let me specify a radius to connect two points. If someone wouldn't mind taking a look at the attached FLA, and pointing me in the right direction, it would be much appreciated! Thanks!
Attached Files
File Type: fla arc.fla (32.5 KB, 9 views)
__________________
-dtøne-
Flash CS4 | AS2
Life is a journey, not a destination.
dtone314 is offline   Reply With Quote
Old 11-26-2009, 03:38 AM   #2
realMakc
Senior Member
 
Join Date: Oct 2002
Posts: 444
cough
__________________
My flash stuff
realMakc is offline   Reply With Quote
Old 11-26-2009, 03:03 PM   #3
dtone314
</hate>
 
dtone314's Avatar
 
Join Date: Jun 2005
Location: CA
Posts: 253
Touché, thanks. Brilliant Google page, never seen that before
__________________
-dtøne-
Flash CS4 | AS2
Life is a journey, not a destination.
dtone314 is offline   Reply With Quote
Old 11-26-2009, 05:58 PM   #4
Nialsh
Sporadic FK User
 
Nialsh's Avatar
 
Join Date: Dec 2003
Location: Houston
Posts: 317
If I'm not mistaken, you're on the wrong track. Constructing an arc from two points and a radius is a very different problem from the three-point construction.

Given two points and a radius, there are 4 different arcs you can make (that lie on 2 circles). Here's some code that finds the centers of the 2 circles that the arcs can lie on:

Code:
//points (x1,y1) and (x2,y2)
//radius r
var mx = (x1+x2)/2;
var my = (y1+y2)/2;

var leg1x = mx-x1;
var leg1y = my-y1;
var leg1 = Math.sqrt(leg1x*leg1x + leg1y*leg1y);

if(leg1 > Math.abs(r))
	return; //no solution

var leg2 = Math.sqrt(r*r - leg1*leg1);
var leg2x = leg1y*leg2/leg1;
var leg2y = -leg1x*leg2/leg1;

var c1x = mx+leg2x;
var c1y = my+leg2y;

var c2x = mx-leg2x;
var c2y = my-leg2y;
You can probably work from that to construct the arc you want.
__________________
undefined
Nialsh is offline   Reply With Quote
Reply

Tags
arc, radius

Go Back   Flash Kit Community Forums > General Help > Math and Physics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:17 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.