PDA

View Full Version : [GMOD] Expression 2 stuffs



DEElekgolo
September 13th, 2009, 03:30 PM
Post your E2 shit here.

I'll start:

Hi, I'm no math nut but when I tried making an EKG, I wanted to play around with some other equations I could use to make shapes on an oscilloscope. I've made plenty already but I will release them every few times. It doesn't exactly do much but look pretty. But some of you may make use of them someday. Like making something float over your head in some fancy way.
If you want to see the design, simply create an oscilloscope and wire the x and y values to that of the e2 chip.
Anyways, first few releases:



http://online.redwoods.cc.ca.us/instruct/darnold/CalcProj/Fall97/dwhite/epicycloid1.gif
http://img132.imageshack.us/img132/3522/gmwireconstructrc0000.jpg


@name Epicycloid(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Time Value for faster line draws.
Time+=1
#When editing A and B. Make sure that A+B is under 1, and that A and B arent the same.
A=0.6
B=0.2

X=((A+B)*cos(Time)) - (B*cos((A/B +1)*Time))
Y=((A+B)*sin(Time)) - (B*sin((A/B +1)*Time))
http://202.38.126.65/mirror/www-history.mcs.st-and.ac.uk/history/Curvepics/Nephroid/Nephroid1.gif
http://img196.imageshack.us/img196/1665/gmwireconstructrc0001t.jpg

@name Nephroid(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Time value for faster line draws
Time+=1
#Make sure that A or B are not 0
A=0.2
B=0.2

X=A*(3*cos(Time) - cos(3*Time))
Y=A*(3*sin(Time) - sin(3*Time))
http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Lissajous/Lissajous1.gif
http://img29.imageshack.us/img29/9968/gmwireconstructrc0003.jpg


@name Lissajous Curve(DEElekgolo)
@outputs X Y Timer
@persist Timer
runOnTick(1)
#Increase the Timer for faster line draws
Timer+=1
#Edit A and B to change the Lissajous ratio
#Values Must be under 1
#If ratio is 1:1 then a circle will be drawn
Scale=0.1
A=5*Scale
B=4*Scale

X=A*sin(A*Timer*pi())
Y=B*sin(B*Timer*pi())
http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Epitrochoid/Epitrochoid1.gif
http://img5.imageshack.us/img5/2172/gmwireconstructrc0004.jpg


@name Epitrochoid(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Timer for faster line draws
Time+=1
#When editing A,B, and C. Make sure that A,B, and C aren't the same
Scale=0.1
A=6*Scale
B=1*Scale
C=3*Scale

X=((A+B)*cos(Time)) - C*cos((A/B+1)*Time)
Y=((A+B)*sin(Time)) - C*sin((A/B+1)*Time)

http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Hypocycloid/Hypocycloid1.gif
http://img44.imageshack.us/img44/1803/gmwireconstructrc0006.jpg


@name Hypocycloid(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Timer for faster line draws
Time+=1
#Make sure that A does not equal B. And that A or B are not 0
A=0.5
B=0.3

X=((A - B)*cos(Time)) + (B*cos(((A/B) - 1)*Time))
Y=((A - B)*sin(Time)) - (B*sin(((A/B) - 1)*Time))
http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Hyperbolic/Hyperbolic1.gif
http://img10.imageshack.us/img10/6112/gmwireconstructrc0008.jpg


@name Hyperbolic Spiral(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Time value for faster line draws
Time+=1
A=200

X=A*(cos(Time)/Time)
Y=A*(sin(Time)/Time)
http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Talbots/Talbots1.gif
http://img40.imageshack.us/img40/5210/gmwireconstructrc0009.jpg


@name Talbot(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Timer for faster line draws
Time+=3
Scale=0.8

A=1.1*Scale
B=1*Scale
F=1*Scale

X=(A^2 + F^2*sin(Time)^2)*cos(Time)/A
Y=(A^2 - 2*F^2*sin(Time)^2)*sin(Time)/B
In that case, I'll post another!
http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Tricuspoid/Tricuspoid1.gif
http://img38.imageshack.us/img38/3313/gmwireconstructrc0010.jpg


@name Tricuspoid(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Timer for faster line draws
Time+=1
Scale=0.3

A=1.0*Scale

X=A*(2*cos(Time) + cos(2*Time))
Y=A*(2*sin(Time) - sin(2*Time))
And another!
http://www-groups.dcs.st-and.ac.uk/%7Ehistory/Curvepics/Involute/Involute1.gif
http://img44.imageshack.us/img44/8685/gmwireconstructrc0011.jpg
(It spirals outwards)


@name Involute of a Circle(DEElekgolo)
@outputs X Y
@persist Time
runOnTick(1)
#Increase the Timer Value to make it Faster
Time+=1
#Make sure that A does not equal B. And that A or B are not 0
Scale=0.001
A=1*Scale


X=A*(cos(Time) + Time*sin(Time))
Y=A*(sin(Time) - Time*cos(Time))

DEElekgolo
September 13th, 2009, 08:54 PM
A little 3d now.
http://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Helicoid.PNG/260px-Helicoid.PNG
http://img195.imageshack.us/img195/9607/gmwireconstructrc0012.jpg

@name Helicoid
@outputs X Y Z
@persist Time Theta
runOnTick(1)
if(first()){holoCreate(0),
holoModel(0,"sphere"),
holoEntity(0):setTrails(30,30,1,"trails/laser",vec(255,0,0),255)}
Entity=entity()
At=Entity:toWorld(Entity:boxCenter())

#Edit Theses Values
Time+=1.5
Distance=70
Radius=50
Pitch=10
#------------------


#Calculate X Y and Z
Theta=sin(Time)^2*Distance
X=Radius*cos(Pitch*Theta)
Y=Radius*sin(Pitch*Theta)
Z=Theta

#Move the Holo
holoPos(0,At+vec(X,Y,Z))

Con
September 13th, 2009, 09:42 PM
Hi, I'm no math nut but when I tried making an EKG...
An EKG? What was it going to measure :|

also, cool stuffs.

DEElekgolo
September 13th, 2009, 09:48 PM
An EKG? What was it going to measure :|

also, cool stuffs.

@name EKG
@inputs
@outputs Health Line X
@persist X
@trigger all
runOnTick(2)
if(first()){X=-1}
Health=owner():health()
Line=random(-Health/100,Health/100)

X+=0.005
if(X>=1)
{
X=-1
}