想结识几个vb高手。。问几个计算机图形学的问题。谢谢。。

kkk328 2009-12-30 01:22:11

1.如何在屏幕上输出阿基米德曲线。
2.如何在屏幕上输出抛物线。
3.实现平面三角形的旋转。
4.像素,颜色值的消隐。。

希望有高手能帮我一下。这几天就要考试了,老师要求用VB,没有接触过。希望高手帮忙。。在线等。。。
...全文
326 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
fzx4936 2010-01-26
  • 打赏
  • 举报
回复
上学时就头疼这些
友情up一次
lyserver 2010-01-26
  • 打赏
  • 举报
回复
liguicd 2010-01-03
  • 打赏
  • 举报
回复
跟着围歼
嗷嗷叫的老马 2010-01-03
  • 打赏
  • 举报
回复
继续
zzyong00 2010-01-01
  • 打赏
  • 举报
回复
第三个问题
zzyong00 2010-01-01
  • 打赏
  • 举报
回复
Option Explicit
Const pi = 3.1415926
Private Type point2d
x As Single
y As Single
End Type
Dim pt(2) As point2d
Private Sub Command1_Click()
pt(0).x = -1500
pt(0).y = 1000
pt(1).x = 1500
pt(1).y = 500
pt(2).x = 1000
pt(2).y = -1500
'首先清除picture1内的图形
Picture1.Cls
Picture1.Scale (-2000, 2000)-(2000, -2000)
'设置绘线宽度
Picture1.DrawWidth = 1
DrawTriangle pt
Timer1.Interval=100
Timer1.Enabled = True
Picture1.ForeColor = vbBlue
End Sub


Private Sub ChangCoord(ByRef pt() As point2d, Angle As Single)
Dim i As Long, x As Single, y As Single
For i = 0 To UBound(pt)
x = pt(i).x * Cos(Angle) - pt(i).y * Sin(Angle)
y = pt(i).y * Cos(Angle) + pt(i).x * Sin(Angle)
pt(i).x = x
pt(i).y = y
Next i
End Sub

Private Sub DrawTriangle(ByRef pt() As point2d)
If UBound(pt) <> 2 Then Exit Sub
Picture1.Line (pt(0).x, pt(0).y)-(pt(1).x, pt(1).y), vbBlue
Picture1.Line -(pt(2).x, pt(2).y), vbBlue
Picture1.Line -(pt(0).x, pt(0).y), vbBlue

End Sub


Private Sub Timer1_Timer()
ChangCoord pt, pi / 50
Picture1.Cls
DrawTriangle pt

End Sub

放三个控件,pictruebox ,timer,command
SYSSZ 2010-01-01
  • 打赏
  • 举报
回复
什么是-------------像素,颜色值的消隐?
SYSSZ 2010-01-01
  • 打赏
  • 举报
回复
'旋转三角形
Const n = 3.14159 / 4
Private Sub Form_Load()
Picture1.Width = Picture1.Height
Picture1.AutoRedraw = True
Picture1.Scale (-100, -100)-(100, 100)
Picture1.Line (-70, 70)-(80, 70), vbRed
Picture1.Line -(-20, -50), vbRed
Picture1.Line -(-70, 70), vbRed
End Sub
'X =x*cos(n)+y*sin(n)
'Y =y*cos(n)-x*sin(n)
Private Sub Picture1_Click()
Picture1.Cls
X1 = -70 * Cos(n) + 70 * Sin(n)
Y1 = 70 * Cos(n) + 70 * Sin(n)
X2 = 80 * Cos(n) + 70 * Sin(n)
Y2 = 70 * Cos(n) - 80 * Sin(n)
X3 = -20 * Cos(n) - 50 * Sin(n)
Y3 = -50 * Cos(n) + 20 * Sin(n)
Picture1.Line (X1, Y1)-(X2, Y2), vbRed
Picture1.Line -(X3, Y3), vbRed
Picture1.Line -(X1, Y1), vbRed
End Sub
kkk328 2010-01-01
  • 打赏
  • 举报
回复
还有2道题啊。。高手继续出现哈。。。谢谢哈。。
paul_lsx 2009-12-31
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 asftrhgjhkjlkttttttt 的回复:]
我不是高手,给你个画抛物线的,在picture里画,想改成在屏幕上画,换成screen

Const pi = 3.14159
Dim a
Private Sub Command1_Click()
    '首先清除picture1内的图形
    Picture1.Cls
    'Scale方法设定用户坐标系,坐标原点在Picture1中心
    Picture1.ScaleMode = 0
    Picture1.ScaleMode = 3
    Picture1.Scale (-20, 20)-(20, -20)
    '设置绘线宽度
    Picture1.DrawWidth = 1
    '绘坐标系的X轴及箭头线
    Picture1.Line (-20, 0)-(20, 0), vbBlue
    Picture1.Line (18, 1)-(20, 0), vbBlue
    Picture1.Line -(18, -1), vbBlue
    Picture1.ForeColor = vbBlue
    Picture1.Print "X"
    '绘坐标系的Y轴及箭头线
    Picture1.Line (0, 20)-(0, -20), vbBlue
    Picture1.Line (1, 18)-(0, 20), vbBlue
    Picture1.Line -(-1, 18), vbBlue
    Picture1.Print "Y"
    '指定位置显示原点O
    Picture1.CurrentX = 1
    Picture1.CurrentY = -1
    Picture1.Print "O"
    '重设绘线宽度
    Picture1.DrawWidth = 2
    '用For循环绘点,使其按抛物线规律变化。步长值很小,使之形成动画效果
    For a = -10 To 10 Step pi / 6000
        Picture1.PSet (a, a ^ 2 / 5), vbRed
    Next a
    '指定位置显示描述文字
    Picture1.CurrentX = pi / 2
    Picture1.CurrentY = -7
    Picture1.ForeColor = vbBlack
    Picture1.Print "抛物线示意"
End Sub

[/Quote]



试过,有用~
舉杯邀明月 2009-12-30
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 linc_m 的回复:]
不记得什么是什么阿碁米 up
[/Quote]
“阿米” ?

偶从来没听说过 .........

贝隆 2009-12-30
  • 打赏
  • 举报
回复
linc_M 2009-12-30
  • 打赏
  • 举报
回复
不记得什么是什么阿碁米 up
孤独剑_LPZ 2009-12-30
  • 打赏
  • 举报
回复
我不是高手,给你个画抛物线的,在picture里画,想改成在屏幕上画,换成screen

Const pi = 3.14159
Dim a
Private Sub Command1_Click()
'首先清除picture1内的图形
Picture1.Cls
'Scale方法设定用户坐标系,坐标原点在Picture1中心
Picture1.ScaleMode = 0
Picture1.ScaleMode = 3
Picture1.Scale (-20, 20)-(20, -20)
'设置绘线宽度
Picture1.DrawWidth = 1
'绘坐标系的X轴及箭头线
Picture1.Line (-20, 0)-(20, 0), vbBlue
Picture1.Line (18, 1)-(20, 0), vbBlue
Picture1.Line -(18, -1), vbBlue
Picture1.ForeColor = vbBlue
Picture1.Print "X"
'绘坐标系的Y轴及箭头线
Picture1.Line (0, 20)-(0, -20), vbBlue
Picture1.Line (1, 18)-(0, 20), vbBlue
Picture1.Line -(-1, 18), vbBlue
Picture1.Print "Y"
'指定位置显示原点O
Picture1.CurrentX = 1
Picture1.CurrentY = -1
Picture1.Print "O"
'重设绘线宽度
Picture1.DrawWidth = 2
'用For循环绘点,使其按抛物线规律变化。步长值很小,使之形成动画效果
For a = -10 To 10 Step pi / 6000
Picture1.PSet (a, a ^ 2 / 5), vbRed
Next a
'指定位置显示描述文字
Picture1.CurrentX = pi / 2
Picture1.CurrentY = -7
Picture1.ForeColor = vbBlack
Picture1.Print "抛物线示意"
End Sub
SYSSZ 2009-12-30
  • 打赏
  • 举报
回复

'在屏幕上输出阿基米德曲线
Private Const PI = 3.141593
Private Sub Form_Load()
Me.Scale (-600, -600)-(600, 600)
Me.Show
Me.DrawWidth = 3
Me.AutoRedraw = True
Dim t As Single
Dim r As Single
Dim x As Single
Dim y As Single

For t = 0 To 20 * PI Step 0.01
r = 10 * (1 + t)
x = r * Cos(t)
y = r * Sin(t)
PSet (x, y), vbRed
Next

End Sub
舉杯邀明月 2009-12-30
  • 打赏
  • 举报
回复
友情Up...............
kkk328 2009-12-30
  • 打赏
  • 举报
回复
哦。。试试看。。。谢谢。。
  • 打赏
  • 举报
回复
建议楼主搜索下vb做的屏保的代码,应该不少。
kkk328 2009-12-30
  • 打赏
  • 举报
回复
感谢关注。。。。。继续期待。。。。。
  • 打赏
  • 举报
回复
不会。
googled
http://zhidao.baidu.com/question/73147707.html?fr=qrl&cid=867&index=1&fr2=query
加载更多回复(3)

7,765

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧