1

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?

datenwolf
  • 159,371
  • 13
  • 185
  • 298
Abuzanona
  • 27
  • 5
  • 2
    I don't think you can. You have to know something about its depth. E.g is it on the plane of the triangle? Or can it be at any distance? – Nathan Wride Jul 28 '14 at 23:18
  • @NathanWride Yes, it is on the plane of the triangle. The depth of the point is equal to the depth of the triangle. – Abuzanona Jul 28 '14 at 23:49
  • 1
    In that case. Look at the normal equation for a plane (its really easy, you'll love it), since you already have all the points for the plane. I'll expand on this later for a more mathematical and comprehensive answer – Nathan Wride Jul 28 '14 at 23:54

0 Answers0