Jump to content
  • Advertisement
Sign in to follow this  
Knight Chat X

[.net] What is proj(0, 0) for projection matrix?

This topic is 4977 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm trying to work out pick ray method using a bounding sphere and sometimes in the C++ examples online I see "proj(0, 0)" for a projection matrix, what is the (0,0) for and what would the conversion of it be in VB.Net or C#? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Calculate Picking Ray Converted from Game Programming Book.

VB.Net Sample:
Public Function CalculatePickingRay(ByVal x As Integer, ByVal y As Integer) As Ray
Dim px As Single = 0.0F
Dim py As Single = 0.0F
Dim vp As Microsoft.DirectX.Direct3D.Viewport = Direct3DDevice.Viewport

'The default view transformation matrix is the identity matrix.
Dim proj As Matrix = mobjDX9.Transform.Projection

'This may be a problem...
'==CODE HERE INVALID==.
px = (((2.0F * x) / vp.Width) - 1.0F) / proj(0, 0)
py = (((-2.0F * y) / vp.Height) + 1.0F) / proj(1,1)

'Note:
'proj(0, 0) and proj(1, 1) cannot be used in the lines above therefore it is invalid.
'==END OF INVALID CODE==.

Dim ray As Ray
ray.origin = New Vector3(0.0F, 0.0F, 0.0F)
ray.direction = New Vector3(px, py, 1.0F)
Return ray
End Function

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!