I'm working as producer now; thats not really an easy job, no time for anything else a team of 20, but when I have some chance, I'm used to code anything.
This code was done really fast, it convert from any 3d coordenates to 2D, for instance, you can use that to do a 2D map which refers a 3D space.
Vector2D From3DTo2D( const Vector2D &currPos3D, const Vector2D &initialCoord3D, const Vector2D &finalCoord3D, const Vector2D &initialCoord2D, const Vector2D &finalCoord2D ) { Vector2D tmp(0,0); tmp.X = 1-(finalCoord3D.X-currPos3D.X)/(finalCoord3D.X-initialCoord3D.X); tmp.Y = 1-(finalCoord3D.Y-currPos3D.Y)/(finalCoord3D.Y-initialCoord3D.Y); tmp.X = ((finalCoord2D.X-initialCoord2D.X)*tmp.X)+initialCoord2D.X; tmp.Y = ((finalCoord2D.Y-initialCoord2D.Y)*tmp.Y)+initialCoord2D.Y; return tmp; }
No comments:
Post a Comment