I have this code in a VB Class which converts a 3D point to 2D point to draw on screen:
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
With this code I convert three 3D points & store as 2D points in Triangle to draw a 3D triangle.
From the Drown Triangle, How can I convert a 2D point (Xp,Yp) that is inside the Triangle and convert it to a 3D point?