Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21264

[RESOLVED] hi im having trouble converting frrom 2d screen coordinates to local coordinates

$
0
0
hi im not sure where to put this.
these are my local coordinates of 1 of my triangle points
Code:

    With ONEobject
    .LocalCoord(0).X = -1
    .LocalCoord(0).Y = -0.5
    .LocalCoord(0).z = 2.5
    End With

and this is how project the 3d coordinats on to a 2d plane
Code:


Private Sub LocaltoScreen()
 
  Dim lngIncr  As Long        'counter
  Dim tempcoord As Point3d      'buffer to hold temporary converted coordinates
 
    With ONEobject
        For lngIncr = 0 To .NumVertices
            'converts local coordinates into world ones relative to the supplied Canvas
            tempcoord.X = .rotatedLocalCoord(lngIncr).X + .CenterofWorld.X
            tempcoord.Y = .rotatedLocalCoord(lngIncr).Y + .CenterofWorld.Y
            tempcoord.z = .rotatedLocalCoord(lngIncr).z + .CenterofWorld.z
            'now we project the 3d coordinats on to a 2d plane with perspective
            .ScreenCoord(lngIncr).X = (tempcoord.X * HPC / tempcoord.z) + HCW
            .ScreenCoord(lngIncr).Y = (-tempcoord.Y * VPC * ASPECT_COMP / tempcoord.z) + HCH
        Next '  LNGINCR
    End With 'ONEobject
 
End Sub


using my mouse i will add three points to the screen ,how do i turn these screen coordinats
into local coordinats or is there a better way other than local coordinats?
thanks

Viewing all articles
Browse latest Browse all 21264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>