This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-08-15 18:17:40

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

formulas

I'm currently trying to make a circul on my paint project however I dont know what the formula is for finding the perfect arc connecting 3 or more points together.

Basicly, I'm using scripts that make multiple points (sprites) and another pen sprite that goes to the points with the pen down. I need to find a formula that goes from one sprite to another in a arc, with the depth of the arc being made by a 3rd sprite. Any help on how to calculate the formula or what it is would be great!

Offline

 

#2 2008-08-15 18:24:30

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: formulas

So you want us just to share formulas, not help? Because this is advanced topics. Normally, people will tell you different formulas cause it's here, but we are nice people.

All I know is it uses trig. Try download Paddle2See's Bezier Nose


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#3 2008-08-15 20:26:40

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: formulas

Yeah, the Bezier Nose isn't going to help much in this case....the Bezier curve I used there will pass through two end points with a given slope at each end, but they won't pass through a given point in the middle, which I think is what yambanshee is looking for.

I do have a curve that might work for you though.  My Perpetual Slinky project uses a parabola which it derives from three points.  Look at the stage script area, that is where the parabolas are derived and evaluated.  I also derive the slope of the curve, which you probably don't need.  Hope that helps!

http://scratch.mit.edu/projects/Paddle2See/151048


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2008-08-15 20:35:20

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: formulas

Paddle2See wrote:

Yeah, the Bezier Nose isn't going to help much in this case....the Bezier curve I used there will pass through two end points with a given slope at each end, but they won't pass through a given point in the middle, which I think is what yambanshee is looking for.

I do have a curve that might work for you though.  My Perpetual Slinky project uses a parabola which it derives from three points.  Look at the stage script area, that is where the parabolas are derived and evaluated.  I also derive the slope of the curve, which you probably don't need.  Hope that helps!

http://scratch.mit.edu/projects/Paddle2See/151048

Oh, than you're right. I just noticed how it made a curve, which seemed like what he wan'ts, but I konw nothing about this XD


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#5 2008-08-16 07:09:32

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: formulas

it depends what curve you want to fit through the points.  if you want a polynomial (eg quadratic, cubic, quartic etc) curve look up a method called lagranges method.  sorry but its not easy to explain online (you could also use newtons interpolating polyinomial but this is even more complex.  if you want to make a circle that goes through three points that is also possible but im afraid i cant remember the method.
  What type of curve do you need?


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#6 2008-08-16 12:36:44

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: formulas

bigB wrote:

it depends what curve you want to fit through the points.  if you want a polynomial (eg quadratic, cubic, quartic etc) curve look up a method called lagranges method.  sorry but its not easy to explain online (you could also use newtons interpolating polyinomial but this is even more complex.  if you want to make a circle that goes through three points that is also possible but im afraid i cant remember the method.
  What type of curve do you need?

im trying to make a circul

Offline

 

#7 2008-08-16 22:57:45

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: formulas

I read your last post to mean that you are looking for a way to determine the equation of a circle given three points on its circumference. Here's a link that explains how to do that pretty easily:

http://local.wasp.uwa.edu.au/~pbourke/geometry/circlefrom3/

Offline

 

#8 2008-08-22 19:51:29

TheFool
Scratcher
Registered: 2008-08-22
Posts: 2

Re: formulas

A circle from three points (A,B,C) is not complicated, just tedious.
generate a line from A to B
find the midpoint and generate a second line with an inverse negative slope ( old slope 2 ->  new slope -1/2 )
do the same thing for B and C
find the intersection of the two lines, this only works if the slopes are not the same,
This intersection becomes the center of the circle.
radius is distance form center to any of the points.
 
beware of advice from a fool

Offline

 

Board footer