00001 /*-----------------------------------------------------------------------* 00002 Project:Nintendo Augmented Reality Library. 00003 File:narMtx33.h 00004 00005 Copyright (C)2011-2012 Nintendo Co., Ltd. All rights reserved. 00006 00007 These coded instructions, statements, and computer programs contain 00008 proprietary information of Nintendo and/or its licensed developers 00009 and are protected by national and international copyright laws. They 00010 may not be disclosed to third parties or copied or duplicated in any 00011 form, in whole or in part, without the prior written consent of 00012 Nintendo. 00013 The content herein is highly confidential and should be handled 00014 accordingly. 00015 *-----------------------------------------------------------------------*/ 00016 00018 00023 #ifndef NAR_MTX_33_H__ 00024 #define NAR_MTX_33_H__ 00025 00026 #include "narPort.h" 00027 #include "narMath.h" 00028 00029 namespace mw { namespace nar 00030 { 00034 struct Mtx33RF_st 00035 { 00036 static const int c_RowNum = 3; 00037 static const int c_ColNum = 3; 00038 00042 void MultVec( Vec3F_st & r, const Vec3F_st & cr ) 00043 { 00044 r.Set( maa_[ 0 ][ 0 ] * cr.X() + maa_[ 0 ][ 1 ] * cr.Y() + maa_[ 0 ][ 2 ] * cr.Z(), 00045 maa_[ 1 ][ 0 ] * cr.X() + maa_[ 1 ][ 1 ] * cr.Y() + maa_[ 1 ][ 2 ] * cr.Z(), 00046 maa_[ 2 ][ 0 ] * cr.X() + maa_[ 2 ][ 1 ] * cr.Y() + maa_[ 2 ][ 2 ] * cr.Z() ); 00047 } 00051 void MakeRotateXYZ( u16 xaxis, u16 yaxis, u16 zaxis ) 00052 { 00053 #ifdef NAR_CTR__ 00054 f32 cosx = nn::math::CosIdx( xaxis ); 00055 f32 sinx = nn::math::SinIdx( xaxis ); 00056 f32 cosy = nn::math::CosIdx( yaxis ); 00057 f32 siny = nn::math::SinIdx( yaxis ); 00058 f32 cosz = nn::math::CosIdx( zaxis ); 00059 f32 sinz = nn::math::SinIdx( zaxis ); 00060 #else 00061 fixme 00062 #endif 00063 maa_[ 0 ][ 0 ] = cosy * cosz; 00064 maa_[ 0 ][ 1 ] = -cosy * sinz; 00065 maa_[ 0 ][ 2 ] = siny; 00066 00067 maa_[ 1 ][ 0 ] = cosx * sinz + sinx * siny * cosz; 00068 maa_[ 1 ][ 1 ] = cosx * cosz - sinx * siny * sinz; 00069 maa_[ 1 ][ 2 ] = -sinx * cosy; 00070 00071 maa_[ 2 ][ 0 ] = sinx * sinz - cosx * siny * cosz; 00072 maa_[ 2 ][ 1 ] = sinx * cosz + cosx * siny * sinz; 00073 maa_[ 2 ][ 2 ] = cosx * cosy; 00074 } 00075 00076 union 00077 { 00078 f32 ma_[ c_RowNum * c_ColNum ]; 00079 f32 maa_[ c_RowNum ][ c_ColNum ]; 00080 }; 00081 }; 00082 } 00083 } 00084 #endif 00085
© 2011-2012 Nintendo. All rights reserved.
CONFIDENTIAL