Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Math [Constants].c
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/* == Common ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Data - Math */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#define TgPP_KVAL_PI_F                      3.141592653589793238462643383279F
#define TgPP_KVAL_SQRT3_F                   1.732050807568877293527446341505F
#define TgPP_KVAL_SQRT2_F                   1.414213562373095048801688724209F
#define TgPP_KVAL_SQRT5_F                   2.236067977499789696409173668731F

TgALIGN(16) C_TgFLOAT32                     KTgF_PI_F32             = TgPP_KVAL_PI_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_TWO_PI_F32         = 2.0F * TgPP_KVAL_PI_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_HALF_PI_F32        = 0.5F * TgPP_KVAL_PI_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_INVPI_F32          = 1.0F / TgPP_KVAL_PI_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_SQRT2_F32          = TgPP_KVAL_SQRT2_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_SQRT3_F32          = TgPP_KVAL_SQRT3_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_SQRT5_F32          = TgPP_KVAL_SQRT5_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_THIRD_F32          = 1.0F / 3.0F;
TgALIGN(16) C_TgFLOAT32                     KTgF_TWENTYSEVENTH_F32  = 1.0F / 27.0F;
TgALIGN(16) C_TgFLOAT32                     KTgF_SQRT1_2_F32        = 1.0F / TgPP_KVAL_SQRT2_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_DEG_TO_RAD_F32     = TgPP_KVAL_PI_F / 180.0F;
TgALIGN(16) C_TgFLOAT32                     KTgF_RAD_TO_DEG_F32     = 180.0F / TgPP_KVAL_PI_F;
TgALIGN(16) C_TgFLOAT32                     KTgF_GOLDEN_RATIO_F32   = (1.0F + TgPP_KVAL_SQRT5_F) * 0.5F;

#define TgPP_KVAL_PI                        3.141592653589793238462643383279
#define TgPP_KVAL_SQRT3                     1.732050807568877293527446341505
#define TgPP_KVAL_SQRT2                     1.414213562373095048801688724209
#define TgPP_KVAL_SQRT5                     2.236067977499789696409173668731

TgALIGN(16) C_TgFLOAT64                     KTgF_PI_F64             = TgPP_KVAL_PI;
TgALIGN(16) C_TgFLOAT64                     KTgF_TWO_PI_F64         = 2.0 * TgPP_KVAL_PI;
TgALIGN(16) C_TgFLOAT64                     KTgF_HALF_PI_F64        = 0.5 * TgPP_KVAL_PI;
TgALIGN(16) C_TgFLOAT64                     KTgF_INVPI_F64          = 1.0 / TgPP_KVAL_PI;
TgALIGN(16) C_TgFLOAT64                     KTgF_SQRT2_F64          = TgPP_KVAL_SQRT2;
TgALIGN(16) C_TgFLOAT64                     KTgF_SQRT3_F64          = TgPP_KVAL_SQRT3;
TgALIGN(16) C_TgFLOAT64                     KTgF_SQRT5_F64          = TgPP_KVAL_SQRT5;
TgALIGN(16) C_TgFLOAT64                     KTgF_THIRD_F64          = 1.0 / 3.0;
TgALIGN(16) C_TgFLOAT64                     KTgF_TWENTYSEVENTH_F64  = 1.0 / 27.0;
TgALIGN(16) C_TgFLOAT64                     KTgF_SQRT1_2_F64        = 1.0 / TgPP_KVAL_SQRT2;
TgALIGN(16) C_TgFLOAT64                     KTgF_DEG_TO_RAD_F64     = TgPP_KVAL_PI / 180.0;
TgALIGN(16) C_TgFLOAT64                     KTgF_RAD_TO_DEG_F64     = 180.0 / TgPP_KVAL_PI;
TgALIGN(16) C_TgFLOAT64                     KTgF_GOLDEN_RATIO_F64   = (1.0 + TgPP_KVAL_SQRT5) * 0.5;

TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_FFFF               = { { { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_FFF0               = { { { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_FF0F               = { { { 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_FF00               = { { { 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_F0FF               = { { { 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_F0F0               = { { { 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_F00F               = { { { 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_F000               = { { { 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_0FFF               = { { { 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_0FF0               = { { { 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_0F0F               = { { { 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_0F00               = { { { 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_00FF               = { { { 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_00F0               = { { { 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_000F               = { { { 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_0000               = { { { 0x00000000, 0x00000000, 0x00000000, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_NaN                = { { { 0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_SgnM               = { { { 0x80000000, 0x80000000, 0x80000000, 0x80000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_INF                = { { { 0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_PNNP               = { { { 0x00000000, 0x80000000, 0x80000000, 0x00000000 } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_YZXW               = { { { 0x04050607, 0x08090a0b, 0x00010203, 0x0c0d0e0f } } };
TgALIGN(16) C_TgVECTOR_ALIAS_UNION          KTgV_ZXYW               = { { { 0x08090a0b, 0x00010203, 0x04050607, 0x0c0d0e0f } } };

TgALIGN(16) C_TgVEC_F32_03                  KTgV_ZERO_F32_03        = { { 0.0F, 0.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_03                  KTgV_ONE_F32_03         = { { 1.0F, 1.0F, 1.0F } };
TgALIGN(16) C_TgVEC_F32_03                  KTgV_UNIT_X_F32_03      = { { 1.0F, 0.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_03                  KTgV_UNIT_Y_F32_03      = { { 0.0F, 1.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_03                  KTgV_UNIT_Z_F32_03      = { { 0.0F, 0.0F, 1.0F } };

TgALIGN(16) C_TgVEC_F32_04                  KTgV_ZERO_F32_04        = { { 0.0F, 0.0F, 0.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_04                  KTgV_ONE_F32_04         = { { 1.0F, 1.0F, 1.0F, 1.0F } };
TgALIGN(16) C_TgVEC_F32_04                  KTgV_UNIT_X_F32_04      = { { 1.0F, 0.0F, 0.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_04                  KTgV_UNIT_Y_F32_04      = { { 0.0F, 1.0F, 0.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_04                  KTgV_UNIT_Z_F32_04      = { { 0.0F, 0.0F, 1.0F, 0.0F } };
TgALIGN(16) C_TgVEC_F32_04                  KTgV_UNIT_W_F32_04      = { { 0.0F, 0.0F, 0.0F, 1.0F } };

TgALIGN(16) C_TgVEC_F64_03                  KTgV_ZERO_F64_03        = { { 0.0, 0.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_03                  KTgV_ONE_F64_03         = { { 1.0, 1.0, 1.0 } };
TgALIGN(16) C_TgVEC_F64_03                  KTgV_UNIT_X_F64_03      = { { 1.0, 0.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_03                  KTgV_UNIT_Y_F64_03      = { { 0.0, 1.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_03                  KTgV_UNIT_Z_F64_03      = { { 0.0, 0.0, 1.0 } };

TgALIGN(16) C_TgVEC_F64_04                  KTgV_ZERO_F64_04        = { { 0.0, 0.0, 0.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_04                  KTgV_ONE_F64_04         = { { 1.0, 1.0, 1.0, 1.0 } };
TgALIGN(16) C_TgVEC_F64_04                  KTgV_UNIT_X_F64_04      = { { 1.0, 0.0, 0.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_04                  KTgV_UNIT_Y_F64_04      = { { 0.0, 1.0, 0.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_04                  KTgV_UNIT_Z_F64_04      = { { 0.0, 0.0, 1.0, 0.0 } };
TgALIGN(16) C_TgVEC_F64_04                  KTgV_UNIT_W_F64_04      = { { 0.0, 0.0, 0.0, 1.0 } };

TgALIGN(16) C_TgMAT_F32_34                  KTgX_IDENT_F32_34       = { {
                                                                        1.0F, 0.0F, 0.0F, 0.0F,
                                                                        0.0F, 1.0F, 0.0F, 0.0F,
                                                                        0.0F, 0.0F, 1.0F, 0.0F
                                                                      } };

TgALIGN(16) C_TgMAT_F32_44                  KTgX_IDENT_F32_44       = { {
                                                                        1.0F, 0.0F, 0.0F, 0.0F,
                                                                        0.0F, 1.0F, 0.0F, 0.0F,
                                                                        0.0F, 0.0F, 1.0F, 0.0F,
                                                                        0.0F, 0.0F, 0.0F, 1.0F
                                                                      } };