1/*---------------------------------------------------------------------------*
2  Project:  Horizon
3  File:     math_Matrix33.ipp
4
5  Copyright (C)2009-2010 Nintendo Co., Ltd.  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  $Revision: 23346 $
14 *---------------------------------------------------------------------------*/
15#include <nn/math/math_Vector3.h>
16
17namespace nn {
18namespace math {
19
20/*!
21    @name    行列
22    @{
23*/
24
25/*!--------------------------------------------------------------------------*
26  @brief        行列が単位行列かどうか判定します。
27
28  @param[in]    p  判定対象の行列へのポインタ。
29
30  @return       p が単位行列であれば true そうでなければ false を返します。
31 *---------------------------------------------------------------------------*/
32NN_MATH_INLINE bool
33MTX33IsIdentity(const MTX33* p)
34{
35    return p->f._00 == 1.f && p->f._01 == 0.f && p->f._02 == 0.f &&
36           p->f._10 == 0.f && p->f._11 == 1.f && p->f._12 == 0.f &&
37           p->f._20 == 0.f && p->f._21 == 0.f && p->f._22 == 1.f;
38}
39
40
41/*!--------------------------------------------------------------------------*
42  @brief        零行列を作成します。
43
44  @param[out]   pOut  零行列を格納するバッファへのポインタ。
45
46  @return       pOut を返します。
47 *---------------------------------------------------------------------------*/
48NN_MATH_INLINE MTX33*
49MTX33Zero(MTX33* pOut)
50{
51    pOut->f._00 = pOut->f._01 = pOut->f._02 =
52    pOut->f._10 = pOut->f._11 = pOut->f._12 =
53    pOut->f._20 = pOut->f._21 = pOut->f._22 = 0.f;
54
55    return pOut;
56}
57
58/*!--------------------------------------------------------------------------*
59  @brief        単位行列を作成します。
60
61  @param[out]   pOut  単位行列を格納するバッファへのポインタ。
62
63  @return       pOut を返します。
64 *---------------------------------------------------------------------------*/
65NN_MATH_INLINE MTX33*
66MTX33Identity(MTX33* pOut)
67{
68    NN_NULL_ASSERT( pOut );
69
70    MTX33Copy(pOut, MTX33::Identity());
71
72    return pOut;
73}
74
75/*!
76    @}
77*/
78
79}  // namespace math
80}  // namespace nn
81