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

#1 2009-05-13 21:32:38

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

What formula does the distance block use?

Does it use x and y coordinates?

Offline

 

#2 2009-05-13 21:56:01

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: What formula does the distance block use?

It uses the pythagorean theorem most likely.

a squared plus b squared is equal to c squared.

So in programming you would do this

a= sprite1x-sprite2x
b=sprite1y-sprite2y
c=square root ((a*a)+(b*b))

The distance between sprite1 and sprite2 is the c variable.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2009-05-13 21:58:32

Sakani
Scratcher
Registered: 2007-07-09
Posts: 100+

Re: What formula does the distance block use?

archmage wrote:

It uses the pythagorean theorem most likely.

a squared plus b squared is equal to c squared.

So in programming you would do this

a= sprite1x-sprite2x
b=sprite1y-sprite2y
c=square root ((a*a)+(b*b))

The distance between sprite1 and sprite2 is the c variable.

archmage thank you for this bit of info but seriously are you a accountant or something for a living? Because that math just makes by brain hurt.

Last edited by Sakani (2009-05-13 21:59:17)


http://img4.imageshack.us/img4/1686/demonscratchcomingsoon.png

Offline

 

#4 2009-05-13 22:00:58

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: What formula does the distance block use?

Sakani, that is basic grade 9 math I think. It is pretty vital in programming because you can use it to find distances.

I think that I learned most of my algebra math in grade 9, and algebra is a vital thing to know for programming. What I explained was actually pretty simple but it is probably more difficult for those who have no concept of using variables or BEDMAS for mathematical equations.

Last edited by archmage (2009-05-13 22:05:05)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2009-05-13 22:23:29

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: What formula does the distance block use?

It works for me, thanks man.

Offline

 

#6 2009-05-13 22:40:55

ScratchX
Scratcher
Registered: 2009-05-05
Posts: 1000+

Re: What formula does the distance block use?

im in algebra2 already but you learn the pythagoream thorem in advanced math 6 well i did


Happy New Year!
http://i45.tinypic.com/1nyasi.pnghttp://i50.tinypic.com/219pez8.pnghttp://i49.tinypic.com/e5s4zr.pnghttp://i48.tinypic.com/23l18hf.jpghttp://i49.tinypic.com/66zymu.png

Offline

 

#7 2009-05-13 22:56:16

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: What formula does the distance block use?

I learn pythagorean theorem later this year. Im in 7th grade

Offline

 

#8 2009-05-14 14:16:49

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

Re: What formula does the distance block use?

ye, i learned it last year.

anyways, its basicly this formula:
(2) means to the power of 2

distance(2) = x(2)-y(2)
so, distance = sqrRoot(x(2)-y(2) )

Last edited by yambanshee (2009-05-14 14:17:36)

Offline

 

#9 2009-05-14 14:33:38

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: What formula does the distance block use?

I imagine they use The Distance Formula.


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#10 2009-05-14 14:36:00

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: What formula does the distance block use?

I learned Pythagorean thereom in 6th grade. Distance formula is basically the same, just in disguise.

Offline

 

#11 2009-05-14 17:47:00

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: What formula does the distance block use?

archmage wrote:

Sakani, that is basic grade 9 math I think. It is pretty vital in programming because you can use it to find distances.

I think that I learned most of my algebra math in grade 9, and algebra is a vital thing to know for programming. What I explained was actually pretty simple but it is probably more difficult for those who have no concept of using variables or BEDMAS for mathematical equations.

It was actually basic grade 7 math  tongue

Offline

 

#12 2009-06-05 12:59:31

evilcat94
Scratcher
Registered: 2009-02-25
Posts: 1

Re: What formula does the distance block use?

It uses:
the square root of (   ( (sprite 1 X - sprite 2 X) squared )  +  ( (sprite 1 Y -sprite 2 Y) squared )   )

Offline

 

#13 2009-06-05 13:28:12

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: What formula does the distance block use?

Grade 9...

What is the "default" age in grade 9? 14-15 or something?

Since in Belgium we have a completely different educational system...


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#14 2009-06-05 14:11:46

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: What formula does the distance block use?

For the US system, just add 5 to the grade number (plus or minus 1) for the age.


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#15 2009-06-06 08:21:31

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: What formula does the distance block use?

JSO wrote:

Grade 9...

What is the "default" age in grade 9? 14-15 or something?

Since in Belgium we have a completely different educational system...

It's 14-15 in Canada. A lot of people skip grades, though (I skipped a grade in Math, not the whole thing, so I'll be in grade 9 math next year even though I'll only be in grade 8).

Offline

 

Board footer