如何在知道二维坐标的情况下确定三维三角形中的点的三维坐标

时间:2014-07-28 23:16:05

标签: 3d transformation projection back-projection

我在VB类中有这个代码,它将3D点转换为2D点以在屏幕上绘制:

Dim N As Point3D, Triangle As Point3D

N.X = 20: N.Y = 30: N.Z = 40

For I = 0 To 2

    With N
        ZX = .X * CosZ - .Y * SinZ - .X
        ZY = .X * SinZ + .Y * CosZ - .Y

        YX = (.X + ZX) * CosY - .Z * SinY - (.X + ZX)
        YZ = (.X + ZX) * SinY + .Z * CosY - .Z

        XY = (.Y + ZY) * CosX - (.Z + YZ) * SinX - (.Y + ZY)
        XZ = (.Y + ZY) * SinX + (.Z + YZ) * CosX - (.Z + YZ)

        .X = YX + ZX + .X
        .Y = ZY + XY + .Y
        .Z = XZ + YZ + .Z

        'Add Depth and Coordinates
        Triangle.T2D(I).X = .X * 0.999 ^ (.Z + Me.Z) + Me.X * 2
        Triangle.T2D(I).Y = .Y * 0.999 ^ (.Z + Me.Z) + Me.Y * 2
    End With
Next

使用此代码我转换三个3D点&在Triangle中存储为2D点以绘制3D三角形。

从溺水三角形,如何转换三角形内部的2D点(Xp,Yp)并将其转换为3D点?

0 个答案:

没有答案