1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - FX -
3   File:     fx_vec.h
4 
5   Copyright 2003-2008 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_FX_VEC_H_
19 #define NITRO_FX_VEC_H_
20 
21 #include <nitro/fx/fx.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 //----------------------------------------------------------------------------
28 // Type definition
29 //----------------------------------------------------------------------------
30 
31 //----------------------------------------------------------------------------
32 // Declaration of function
33 //----------------------------------------------------------------------------
34 
35 void    VEC_Add(const VecFx32 *a, const VecFx32 *b, VecFx32 *ab);
36 void    VEC_Subtract(const VecFx32 *a, const VecFx32 *b, VecFx32 *ab);
37 fx32    VEC_DotProduct(const VecFx32 *a, const VecFx32 *b);
38 void    VEC_CrossProduct(const VecFx32 *a, const VecFx32 *b, VecFx32 *axb);
39 fx32    VEC_Mag(const VecFx32 *v);
40 fx32    VEC_Distance(const VecFx32 *v1, const VecFx32 *v2);
41 void    VEC_Normalize(const VecFx32 *pSrc, VecFx32 *pDst);
42 void    VEC_MultAdd(fx32 a, const VecFx32 *v1, const VecFx32 *v2, VecFx32 *pDest);
43 void    VEC_MultSubtract(fx32 a, const VecFx32 *v1, const VecFx32 *v2, VecFx32 *pDest);
44 
45 
46 void    VEC_Fx16Add(const VecFx16 *a, const VecFx16 *b, VecFx16 *ab);
47 void    VEC_Fx16Subtract(const VecFx16 *a, const VecFx16 *b, VecFx16 *ab);
48 fx32    VEC_Fx16DotProduct(const VecFx16 *a, const VecFx16 *b);
49 void    VEC_Fx16CrossProduct(const VecFx16 *a, const VecFx16 *b, VecFx16 *axb);
50 fx32    VEC_Fx16Mag(const VecFx16 *v);
51 fx32    VEC_Fx16Distance(const VecFx16 *v1, const VecFx16 *v2);
52 void    VEC_Fx16Normalize(const VecFx16 *pSrc, VecFx16 *pDst);
53 
54 //----------------------------------------------------------------------------
55 // Implementation of inline function
56 //----------------------------------------------------------------------------
57 
58 /*---------------------------------------------------------------------------*
59   Name:         VEC_Set
60 
61   Description:  Set values to VecFx32
62 
63   Arguments:    x, y, z :   set values
64 
65   Returns:      a       :   pointer of VecFx32 for set values.
66  *---------------------------------------------------------------------------*/
VEC_Set(VecFx32 * a,fx32 x,fx32 y,fx32 z)67 SDK_INLINE void VEC_Set(VecFx32 *a, fx32 x, fx32 y, fx32 z)
68 {
69     SDK_NULL_ASSERT(a);
70 
71     a->x = x;
72     a->y = y;
73     a->z = z;
74 }
75 
76 /*---------------------------------------------------------------------------*
77   Name:         VEC_Fx16Set
78 
79   Description:  Set values to VecFx16
80 
81   Arguments:    x, y, z :   set values
82 
83   Returns:      a       :   pointer of VecFx16 for set values.
84  *---------------------------------------------------------------------------*/
VEC_Fx16Set(VecFx16 * a,fx16 x,fx16 y,fx16 z)85 SDK_INLINE void VEC_Fx16Set(VecFx16 *a, fx16 x, fx16 y, fx16 z)
86 {
87     SDK_NULL_ASSERT(a);
88 
89     a->x = x;
90     a->y = y;
91     a->z = z;
92 }
93 
94 
95 
96 #ifdef __cplusplus
97 }/* extern "C" */
98 #endif
99 
100 #endif
101