Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-09-2002, 01:11 AM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
Formulas.

-=Josey=-
Someone asked for the formula on a circle a while back, so I decided to start a thread on other formulas with the area and perimeter of an object. Please add to this thread so we can have more moving objects. ;D

A = Area
B = Base
C = Circumference
D = Diameter
S = Side
L = Lenght
H = Height
P = Perimemter
R = Radius
Pi = 3.14
* = Multiplied by

-=Areas=-

Square:
A = S*2

Rectangle:
A = L*W

Parallelogram:
A = B*H

Triangle:
A = .5*B*H

Circle:
A = Pi*R*2

-=Perimemter=-

Square:
P = 4*S

Rectangle:
P = 2*L+2+W

Triangle:
P = S1+S2+S3

Circumference of a circle:
C = Pi*D


These are all of the basic ones. If you have any, post em! ;D
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
Reply With Quote
  #2  
Old 02-09-2002, 01:42 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 is on a distinguished road
Please excuse me if some of these don't work. They should, but it's been a while since I've scripted.

New Variables in red.


Ang = Angle, in Degrees
Rad = Angle, in Radians


-= Degrees to Radians =-

Rad = Ang * Pi / 180
Ang = Rad * 180 / Pi

-= Location of a point on a circle =-

X = X of point on circle
Y = Y of point on circle

X = cos(Ang)*R
Y = sin(Ang)*R

-= Angle of a point on a circle (when angle is unknown) =-

OX = Origin X (center of circle)
OY = Origin Y (center of circle)

Rad = arctan( ( Y - OY ) / ( X - OX) ) + ( Pi * ( X < OX) )
Reply With Quote
  #3  
Old 02-09-2002, 01:54 AM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
-=Josey=-
- Digs out some old mathemetics books and starts to look for some. People better use these or this thread is useless. ;\
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
Reply With Quote
  #4  
Old 02-09-2002, 06:58 AM
Wes2000 Wes2000 is offline
Registered User
Join Date: Dec 2001
Posts: 57
Wes2000 is on a distinguished road
Send a message via AIM to Wes2000
Im pretty good at math, but sometimes i cant find a way to put the math into use in GScript. Could someone post a short example possibly moving a object with one of the formulas or anything real simple?
__________________
Reply With Quote
  #5  
Old 02-09-2002, 09:45 AM
Lomgren Lomgren is offline
Senior Member, Anti-Spam
Join Date: Mar 2001
Location: Missouri
Posts: 196
Lomgren is on a distinguished road
Talking Polar Coordinates!!

[EDIT] the forum replaced my theta with a sideways E so don't yell at me[/EDIT]

*sits down with dusty old book in lap*
Heh, these are fun indeed!
:New Variables:
Ø - theta (inner angle of a circle, 360 deg. 1 radian)
a - any real number
b - any real number
n - any positive integer

:Formulas:
-Rose-
R = a*cos(n*Ø)
R = a*sin(n*Ø)

-Lemniscate-
R^2 = a^2*cos(2*Ø)
R^2 = a^2*sin(2*Ø)

-Limaçon-
R = a + b*cos(Ø)
R = a + b*sin(Ø)

-Cardioid-
R = a + a*cos(Ø)
R = a + a*si(Ø)

-Spiral of Archimedes-
R = a*Ø

-convert polar to rectangle coordinates-
x = R*cos(Ø)
y = R*sin(Ø)
-or for graal's y scale-
y = -R*sin(Ø)

and for a simple script to test these formulas;
[script]
for (i=startx;i<=lastx;i+=interval) {
<insert formula here, but use i for the non-constant variable
<(Ø for most formulas, change all others to your descretion>
showimg i*(1/interval),kstar.gif,x+g,y-h;
}
[/script]

but change the startx, lastx, and interval to what you want,
and replace the x with g, and y with h in the formulas,
except for the polar graphs, just use the conversion formulas.


__________________
Lomgren - devoted to classic, even though I may be gone for months on end
Reply With Quote
  #6  
Old 02-09-2002, 09:58 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
Re: Re: Polar Coordinates!!

Quote:
Originally posted by Kaimetsu




You're saying that 360 degrees = 1 radian?
If I'm not mistaken, 6.28318530717958647692528676655901 radians equals 360 degrees.
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
Reply With Quote
  #7  
Old 02-09-2002, 09:59 AM
Lomgren Lomgren is offline
Senior Member, Anti-Spam
Join Date: Mar 2001
Location: Missouri
Posts: 196
Lomgren is on a distinguished road
Re: Re: Polar Coordinates!!

Quote:
Originally posted by Kaimetsu




You're saying that 360 degrees = 1 radian?
[Embarassment]
oops, I messed that up bad,hehe

2pi radians equals 360 degrees
[/Embarassment]

I tend to forget things, even if I just learned them six months ago!
__________________
Lomgren - devoted to classic, even though I may be gone for months on end
Reply With Quote
  #8  
Old 02-09-2002, 12:33 PM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
Kammy if im not mistaken.. in math
if u write
ab
that means the same as
a*b..
so 2pi=2*pi
because when u say 2 pi u mean u have 2 of pi. so that means u would multiply them.
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #9  
Old 02-09-2002, 01:06 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi is on a distinguished road
Send a message via AIM to G_yoshi
Quote:
Originally posted by dragoonvenganc
Kammy if im not mistaken.. in math
if u write
ab
that means the same as
a*b..
so 2pi=2*pi
because when u say 2 pi u mean u have 2 of pi. so that means u would multiply them.
correct
__________________
Reply With Quote
  #10  
Old 02-09-2002, 01:12 PM
Faheria_LAT1 Faheria_LAT1 is offline
Seraphim Warrior
Faheria_LAT1's Avatar
Join Date: Oct 2001
Location: QUÉBEC!!!!!!1
Posts: 2,040
Faheria_LAT1 is on a distinguished road
Send a message via ICQ to Faheria_LAT1 Send a message via AIM to Faheria_LAT1
Quote:
Originally posted by dragoonvenganc
Kammy if im not mistaken.. in math
if u write
ab
that means the same as
a*b..
so 2pi=2*pi
because when u say 2 pi u mean u have 2 of pi. so that means u would multiply them.
yeah but if you would read the quote it shows pi, not 2pi
__________________


"I like movies where the guy shoots stuff, and then it blows up, and then this other guy shoots him, and then the first guy drives through a Coke sign, and it blows up, and the car flips over in slow motion, and then the guy gets out and pops his arm back in place, and then they fight 'cause they're out of bullets, and the guy says something like "This is Walmart, boy...and you just got price-checked!" - Broken Saints

"There is no greater sorrow than to recall in misery when we were happy" - Dante

"If you know yourself but not the enemy, for every victory gained you will also suffer a defeat" - Sun Tzu, The Art Of War

"Kingdoms ...rising without word. Collapsing without warning." - Broken Saints

Account now used by Silver and Mmmmkay
yoshee15 account has run out :[[[
Reply With Quote
  #11  
Old 02-10-2002, 02:28 AM
Wes2000 Wes2000 is offline
Registered User
Join Date: Dec 2001
Posts: 57
Wes2000 is on a distinguished road
Send a message via AIM to Wes2000
For constant acceleration
d = d0 + vt + .5at^2
v = v0 + at
v^2 = 2ad

Acceleration on a cylinder (space colony, etc.) of radius r and
rotation period t:

a = 4 pi**2 r / t^2

For circular Keplerian orbits where:
Vc = velocity of a circular orbit
Vesc = escape velocity
M = Total mass of orbiting and orbited bodies
G = Gravitational constant (defined below)
u = G * M (can be measured much more accurately than G or M)
K = -G * M / 2 / a
r = radius of orbit (measured from center of mass of system)
V = orbital velocity
P = orbital period
a = semimajor axis of orbit

Vc = sqrt(M * G / r)
Vesc = sqrt(2 * M * G / r) = sqrt(2) * Vc
V^2 = u/a
P = 2 pi/(Sqrt(u/a^3))
K = 1/2 V**2 - G * M / r (conservation of energy)



Anyone think they can use those?
__________________
Reply With Quote
  #12  
Old 02-10-2002, 02:37 AM
KJL KJL is offline
Registered User
Join Date: Jan 2002
Location: Minnesota, USA
Posts: 33
KJL is on a distinguished road
Re: Formulas.

Quote:
Originally posted by joseyisleet
-=Josey=-
Someone asked for the formula on a circle a while back, so I decided to start a thread on other formulas with the area and perimeter of an object. Please add to this thread so we can have more moving objects. ;D

A = Area
B = Base
C = Circumference
D = Diameter
S = Side
L = Lenght
H = Height
P = Perimemter
R = Radius
Pi = 3.14
* = Multiplied by

-=Areas=-

Square:
A = S*2

Rectangle:
A = L*W

Parallelogram:
A = B*H

Triangle:
A = .5*B*H

Circle:
A = Pi*R*2

-=Perimemter=-

Square:
P = 4*S

Rectangle:
P = 2*L+2+W

Triangle:
P = S1+S2+S3

Circumference of a circle:
C = Pi*D


These are all of the basic ones. If you have any, post em! ;D
humm I beleve a square is

Square:
A = S^2 (not A=S*2)

and

Rectangle:
P = 2*L+2*W (not P = 2*L+2+W)
Reply With Quote
  #13  
Old 02-10-2002, 10:20 PM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
-=Chicken is confusled rofl=-

[confuzed]Im is Confused lol i have a learning Disablility Dislexia,and like rofl this shi*s hard core maths rofl but please correct me if im wrong but That square thingy mabob wouldnt in include 4 in dah formula case of 4sides for faces and yah like maybe 2*4+16 or some crap lol [/confuzed]
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
Reply With Quote
  #14  
Old 02-11-2002, 06:12 AM
joseyisleet joseyisleet is offline
Registered User
Join Date: Aug 2001
Posts: 378
joseyisleet is on a distinguished road
-=ohh um heh=-

Ohh,well i thought considering that theres like 4 sides 4 faces and Shiot that it would have something like that but ehh i was wrong and i was like 99.9 percent sure i was wrong rogl =D
__________________
Account used by Josey and Howard.
Ali G: 'Is it cause i Black?'
Reply With Quote
  #15  
Old 02-11-2002, 06:31 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
line in intercept slope form
y=mx+b

slope
m=(y2-y1)/(x2-x1)

y intercept
b=-m*x+y;

Distance formula
d=((y2-y1)^2+(x2-x1)^2)^.5
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
Reply


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 +2. The time now is 04:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.