# Retrieving the perpendicular angle from an arc

**URL:** <https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711>\
**Category:** Uncategorized\
**Created:** [March 17, 2003, 11:03am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711 "2003-03-17T11:03:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![upuaut](https://avatars.discourse-cdn.com/v4/letter/u/9fc348/32.png) [@upuaut](https://forum.kirupa.com/u/upuaut)\
**Post date:** [March 17, 2003, 11:03am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/1 "2003-03-17T11:03:34Z")

</div>

ok… I’m working on the pinball game. I need to come up with a way of retreiving the right angle from an curved line.  
The idea is to have the ball follow a curve around the upper border of the game field. The ball itself is going to be a point, which the ball follows, so that I can use the shape of the object when doing hit detection. I’m not sure if that’s relivant to the subject or not… but it gives some idea of where I’m going with this.

I’m open for suggestions.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 11:22am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/2 "2003-03-17T11:22:41Z")

</div>

Howdy…

I guess Kitiara will love it when the game is done… 😉

Anyways… I found a couple of things that might help you to please her… 😛

[Gravity Ball by FlashGuru](http://www.actionscripts.org/showMovie.php?id=12)  
[Billiard Ball Physics at FlashKit](http://www.flashkit.com/board/showthread.php?threadid=281136&pagenumber=1)Hope to see a good game… 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 11:55am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/3 "2003-03-17T11:55:59Z")

</div>

thanks… I’ll look into these.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 1:42pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/4 "2003-03-17T13:42:20Z")

</div>

not anything I haven’t accomplished already… but thanks cyanblue. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 7:48pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/5 "2003-03-17T19:48:49Z")

</div>

I’ll let you know if I find something else… 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 8:16pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/6 "2003-03-17T20:16:40Z")

</div>

haha… I TOLD YOU… you’re going to need to know the equation for the curve…

maybe if you draw it in actionscript, kinda like lost’s besier curve thing on his site, you can figure out the equation from there…

but in order to get the normal, you need to find out the tangent of the curve…

BUT to make a pinball game, you don’t NEED to do a curve… have you played the altoids one? I think they ran into that same problem too, and decide to do away with curved surfaces

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 9:51pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/7 "2003-03-17T21:51:17Z")

</div>

I’m not sure if it’s worth doing without the curve lavaboy. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 10:01pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/8 "2003-03-17T22:01:37Z")

</div>

ok well, if you want an irregular curve, you’re going to end up using calculus, no matter what…

however, if you want to use the inside edge of a circle as a curve, there are some tricks I can think about… I’ll write them when I get home

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 10:44pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/9 "2003-03-17T22:44:15Z")

</div>

I’d be more than happy to hear them.

I was also thinking the same thing as you… that ploting out the points in a list or arrray, which coincide with the actual curve… might be the way to go. I’m not quite ready to go to that extreme yet… but maybe soon. 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 11:16pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/10 "2003-03-17T23:16:15Z")

</div>

well… lets think about how we might have calculated this in pre-newtonian times…

if you have an irregular curve, you could have some hidden straight lines, like 4 or 5, that follow the contour of the curve. You would definitely be able to set the angular response to those… and the ball would simulate to a degree the path it would take along that curve.

I dont think you need to go as far as the pixel on this.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 17, 2003, 11:54pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/11 "2003-03-17T23:54:45Z")

</div>

[http://flash-france.com/fla.php?op=viewfilm&film\_id=318](http://flash-france.com/fla.php?op=viewfilm&film_id=318)

And you can also check all the fla’s from Alcys, he’s incredibly talented. Tell me if you need a translation 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 12:49am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/12 "2003-03-18T00:49:32Z")

</div>

WOW…

that’s all I have to say.  
and yes… I need a translation

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 2:54am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/13 "2003-03-18T02:54:40Z")

</div>

Yeah I need a translation as well. That’s exactly the math I’m looking for.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 7:56am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/14 "2003-03-18T07:56:10Z")

</div>

I think what that FLA is doing is determining where in the contour the ball hits, and hten checking where the coordinates of the surrounding pixels are… then it determines the normal from there…

but I dont think you need to go into that much detail… I think if you’re doing an irregular surface (not as irregular as the ones in the example) you should be ok with 4 or 5 invisible lines…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 8:03am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/15 "2003-03-18T08:03:59Z")

</div>

ehh… I’m not so sure about that. In the case of a pinball… we want it to run up a vertical and then bend as it reaches the arc. That’s not going to be accomplished by invisible lines.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 12:12pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/16 "2003-03-18T12:12:06Z")

</div>

I’ll make up an example later on on what I’m talking about…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 4:36pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/17 "2003-03-18T16:36:33Z")

</div>

I drew a simple picture in photoshop, so that you can see what I’m talking about… this is my solution to the curve problem

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 5:02pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/18 "2003-03-18T17:02:30Z")

</div>

Well, Alcys did post an explanation on my french board. I’ll try to translate his explanation late tonight. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 18, 2003, 5:10pm UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/19 "2003-03-18T17:10:51Z")

</div>

thanks! I’m really interested as to how it works.

But David, you also have to think about this… the ball is only going to pass through that area less than 5% of the time (by my estimate…) is a behavior that requires so many hit tests per area necessary?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 19, 2003, 9:05am UTC](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711/20 "2003-03-19T09:05:16Z")

</div>

well the ball really only has one behavior. And probebly there will never be more than 5 balls in play no matter what game you make. I don’t think that the hit tests will be nearly as slugging to the system as you think they are going to be.

and how may hit tests. It’s one per ball, per frame… and possibly only every other frame. Am I thinking about that incorrectly?

[Next page](https://forum.kirupa.com/t/retrieving-the-perpendicular-angle-from-an-arc/15711.md?page=2)
