Jump to content
  • Advertisement
Sign in to follow this  
Altemia

Returning y value from 1D array of 'vector 3's

This topic is 2591 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

I have a vector 3 (x,y,z) 1D dynamic array full of vertex positions.

How would I return the y value at a given x and z coordinate?


Using C++ and compiling in Visual Studio 2008

Share this post


Link to post
Share on other sites
Advertisement
I don't think there's enough information there to answer the question. What do the vertex positions represent? Are they mesh vertices? Do you also have a set of triangle indices available?

Share this post


Link to post
Share on other sites
Unless your x n z combination values are completely unique... ie there is never a duplicate, you can't. Is what you described what you're actually trying to do? Ie are you looking for

float y = Array.GetY(x, z);

Or are you trying to use a 1D array to rpresent a 3D array... ie Array[ ] instead of Array[ ][ ][ ]?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!