Skip to content

Instantly share code, notes, and snippets.

@tri-man
Created July 19, 2012 01:51
Show Gist options
  • Save tri-man/3140256 to your computer and use it in GitHub Desktop.
Save tri-man/3140256 to your computer and use it in GitHub Desktop.
C版のコード
struct VECTOR
{
float x;
float y;
float z;
};
VECTOR VSet( float x, float y, float z )
{
VECTOR rtn;
rtn.x = x;
rtn.y = y;
rtn.z = z;
return rtn;
}
VECTOR VAdd( const VECTOR& in_val )
{
VECTOR rtn;
rtn.x = in_val.x + 1.0f;
rtn.y = in_val.y + 1.0f;
rtn.z = in_val.z + 1.0f;
return rtn;
}
int main()
{
VECTOR vec = VAdd( VSet( 0.0f, 1.0f, 0.0f) );
printf( "vec(%f,%f,%f)", vec.x, vec.y, vec.z );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment