تبلیغات
حرفای نگفته ی من - 27 آذر
 

27 آذر

نوشته شده توسط :سولیست سولی
شنبه 9 بهمن 1389-06:59 ب.ظ

P1x = 50

P1y = 50

P2x = 150

P2y = 50

P3x = 75

P3y = 75

DrawTriangle()

Tx = 0

Ty = 0

'MoveTriangle()

Xr = 75

Yr = 75

 

 

For teta = 1 To 45

t = -teta * (Math.Pi / 180)

RotateTriangle()

Program.Delay(100)

GraphicsWindow.Clear()

EndFor

'=================================================

'================ ROTATE TRIABGLE ==================

'=================================================

Sub RotateTriangle

x1 = Math.Cos(t) * P1x - Math.Sin(t) * P1y + Xr * (1 - Math.Cos(t)) + Yr * Math.Sin(t)

y1 = Math.Sin(t) * P1x + Math.Cos(t) * P1y + Yr * (1 - Math.Cos(t)) - Xr * Math.Sin(t)

x2 = Math.Cos(t) * P2x - Math.Sin(t) * P2y + Xr * (1 - Math.Cos(t)) + Yr * Math.Sin(t)

y2 = Math.Sin(t) * P2x + Math.Cos(t) * P2y + Yr * (1 - Math.Cos(t)) - Xr * Math.Sin(t)

DDA()

'------------------------- Khat 2

x1 = Math.Cos(t) * P2x - Math.Sin(t) * P2y + Xr * (1 - Math.Cos(t)) + Yr * Math.Sin(t)

y1 = Math.Sin(t) * P2x + Math.Cos(t) * P2y + Yr * (1 - Math.Cos(t)) - Xr * Math.Sin(t)

x2 = Math.Cos(t) * P3x - Math.Sin(t) * P3y + Xr * (1 - Math.Cos(t)) + Yr * Math.Sin(t)

y2 = Math.Sin(t) * P3x + Math.Cos(t) * P3y + Yr * (1 - Math.Cos(t)) - Xr * Math.Sin(t)

DDA()

'------------------------- Khat 3

x1 = Math.Cos(t) * P1x - Math.Sin(t) * P1y + Xr * (1 - Math.Cos(t)) + Yr * Math.Sin(t)

y1 = Math.Sin(t) * P1x + Math.Cos(t) * P1y + Yr * (1 - Math.Cos(t)) - Xr * Math.Sin(t)

x2 = Math.Cos(t) * P3x - Math.Sin(t) * P3y + Xr * (1 - Math.Cos(t)) + Yr * Math.Sin(t)

y2 = Math.Sin(t) * P3x + Math.Cos(t) * P3y + Yr * (1 - Math.Cos(t)) - Xr * Math.Sin(t)

DDA()

EndSub

'=================================================

'================ DRAW TRIABGLE ==================

'=================================================

Sub DrawTriangle

'------------------------- Khat 1

x1 = P1x

y1 = P1y

x2 = P2x

y2 = P2y

DDA()

'------------------------- Khat 2

x1 = P2x

y1 = P2y

x2 = P3x

y2 = P3y

DDA()

'------------------------- Khat 3

x1 = P1x

y1 = P1y

x2 = P3x

y2 = P3y

DDA()

EndSub

'=================================================

'================ MOVE TRIANGLE ==================

'=================================================

Sub MoveTriangle

'------------------------- Khat 1

x1 = P1x + Tx

y1 = P1y + Ty

x2 = P2x + Tx

y2 = P2y + Ty

DDA()

'------------------------- Khat 2

x1 = P2x + Tx

y1 = P2y + Ty

x2 = P3x + Tx

y2 = P3y + Ty

DDA()

'------------------------- Khat 3

x1 = P1x + Tx

y1 = P1y + Ty

x2 = P3x + Tx

y2 = P3y + Ty

DDA()

EndSub

'=================================================

'================ DRAW LINE ==================

'=================================================

Sub DDA

dx = x2 - x1

dy = y2 - y1

If Math.Abs(dx) > Math.Abs(dy) Then

steps = Math.Abs(dx)

Else

steps = Math.Abs(dy)

EndIf

xinc = dx / steps

yinc = dy / steps

x = x1

y = y1

GraphicsWindow.SetPixel(Math.Round(x), Math.Round(y), "Blue")

For i = 0 To steps

x = x + xinc

y = y + yinc

GraphicsWindow.SetPixel(Math.Round(x), Math.Round(y), "Blue")

EndFor

EndSub

 





نظرات() 


What makes you grow taller during puberty?
سه شنبه 17 مرداد 1396 10:15 ق.ظ
Remarkable issues here. I'm very glad to look your article.
Thanks so much and I am having a look ahead to touch you. Will
you please drop me a mail?
Foot Complaints
جمعه 13 مرداد 1396 04:45 ب.ظ
Aw, this was a very nice post. Taking the time and actual effort to produce a superb article… but what can I say… I
procrastinate a lot and never manage to get anything done.
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر


درباره وبلاگ:



آرشیو:


طبقه بندی:


آخرین پستها:


پیوندها:


نویسندگان:


ابر برچسبها:


آمار وبلاگ:







The Theme Being Used Is MihanBlog Created By ThemeBox