3D Spring帮助 [英] 3D Spring Help

查看:106
本文介绍了3D Spring帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建具有特定长度和匝数的3D弹簧(螺旋,螺旋形,...).我已经编写了使用line_strip创建弹簧的代码,但是我想将其扩展为实际的3d表面(看起来像汽车上的真实弹簧).我认为可以使用quad_strip完成此操作,但是不确定创建此方法的最佳方法是什么.

有人这样做了吗?

I am trying to create a 3D spring (helix, Spiral, ...) with a specific length and number of turns. I have the code written to create a spring using a line_strip, but I want to extend it to be an actual 3d surface (look like a real spring on a car). I figure this can be done using a quad_strip, but not sure what the best way to create this is.

Has someone done this?

  Gl.glPushMatrix()
        Gl.glColor4f(0, 0.28, 0.48, Alpha)

        Dim length As Double = glVectorRotation(point1, point2, False)
    
        Dim coils As Integer = 5
        Dim segs As Integer = 100
        Dim Radius As Single = 2.5
        Dim pitch As Double = length / coils
        Gl.glBegin(Gl.GL_LINE_STRIP)
        For icoil As Integer = 0 To coils
            For iseg As Integer = 0 To segs
                Dim theta As Single = CSng((2 * PI) / segs * iseg)
                Dim z As Single = CSng((icoil + (iseg / segs)) * pitch)
                Dim x As Single = CSng(Radius * Cos(theta))
                Dim y As Single = CSng(Radius * Sin(theta))
                If z > length Then Exit For ''z = CSng(length)
                Gl.glVertex3d(x, y, z)
            Next
        Next
        Gl.glEnd()
GL.glPopMatrix()

推荐答案

尝试这些...我知道您在2009年发布了此内容....但您永远不知道...可能仍需要帮助吗?

http://www.opengl.org/discussion_boards/showthread. php/147620-how-to-draw-a-3D-spring [ http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId = 8223& lngWId = 3 [> http://stackoverflow.com/questions/4947733/how-to- Give-a-2d-structure-3d-depth [ ^ ]

http://stackoverflow.com/questions/1902365/how-to-draw- a-spiral-using-opengl [ ^ ]
Try these... I know you posted this in 2009.... But you never know... might still need the help?

http://www.opengl.org/discussion_boards/showthread.php/147620-how-to-draw-a-3D-spring[^]

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=8223&lngWId=3[^]

http://stackoverflow.com/questions/4947733/how-to-give-a-2d-structure-3d-depth[^]

http://stackoverflow.com/questions/1902365/how-to-draw-a-spiral-using-opengl[^]


这篇关于3D Spring帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆