亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? math3d.h

?? Direct3D游戲編程入門教程源代碼.rar
?? H
字號:
/*   ColDet - C++ 3D Collision Detection Library
 *   Copyright (C) 2000   Amir Geva
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 * 
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 *
 * Any comments, questions and bug reports send to:
 *   photon@photoneffect.com
 *
 * Or visit the home page: http://photoneffect.com/coldet/
 */
#ifndef H_MATH3D
#define H_MATH3D

#include <math.h>

struct Vector3D;
struct Matrix3;
struct Matrix3D;
struct Plane; 

inline float flabs(float f) { return (f>=0.0f?f:-f); }
const float epsilon=1e-8f;
inline bool IsZero(float f) { return flabs(f)<epsilon; }

Vector3D operator*(float scalar, const Vector3D& v);
/** Dot product. */
float    operator*(const Vector3D& v1, const Vector3D& v2);
Vector3D operator+(const Vector3D& v1, const Vector3D& v2);
Vector3D operator-(const Vector3D& v1, const Vector3D& v2);
Vector3D CrossProduct(const Vector3D& v1, const Vector3D& v2);
Matrix3D operator*(const Matrix3D& m1, const Matrix3D& m2);
Matrix3D operator*(float scalar, const Matrix3D& m);

struct Vector3D
{
  float x,y,z;
  static const Vector3D Zero;

  Vector3D() {}
  Vector3D(float X, float Y, float Z) : x(X), y(Y), z(Z) {}
  Vector3D(const Vector3D& v) : x(v.x), y(v.y), z(v.z) {}

  Vector3D& operator+=(const Vector3D& v) { x+=v.x; y+=v.y; z+=v.z; return *this; }
  Vector3D& operator*=(float s) { x*=s; y*=s; z*=s; return *this; }
  Vector3D& operator/=(float s) { return *this *= (1.0f/s); }
  bool      operator==(const Vector3D& v) { return x==v.x && y==v.y && z==v.z; }

  Vector3D operator-       () const { return Vector3D(-x,-y,-z); }
  float    SquareMagnitude () const { return x*x+y*y+z*z; }
  float    Magnitude       () const { return (float)sqrt(SquareMagnitude()); }
  Vector3D Normalized      () const { return (1.0f/Magnitude())*(*this); }
  float    operator[] (int i) const { return ((float*)&x)[i]; }
  float&   operator[] (int i)       { return ((float*)&x)[i]; }
};

#define _11 sclr.s11
#define _12 sclr.s12
#define _13 sclr.s13
#define _14 sclr.s14
#define _21 sclr.s21
#define _22 sclr.s22
#define _23 sclr.s23
#define _24 sclr.s24
#define _31 sclr.s31
#define _32 sclr.s32
#define _33 sclr.s33
#define _34 sclr.s34
#define _41 sclr.s41
#define _42 sclr.s42
#define _43 sclr.s43
#define _44 sclr.s44

/** 3x3 matrix */
struct Matrix3
{
  union {
    struct { float s11,s12,s13,
                   s21,s22,s23,
                   s31,s32,s33; } sclr;
    float m[3][3];
  };
  static const Matrix3 Identity;

  Vector3D& baseRow(int i) { return *((Vector3D*)m[i]); }
  float  operator() (int i, int j) const { return m[i][j]; }
  float& operator() (int i, int j)       { return m[i][j]; }
};

/** 4x4 matrix, used for transformations. */
struct Matrix3D
{
  union {
    struct { float s11,s12,s13,s14,
                   s21,s22,s23,s24,
                   s31,s32,s33,s34,
                   s41,s42,s43,s44; } sclr;
    float m[4][4];
  };
  static const Matrix3D Identity;

  Matrix3D() {}

  Matrix3D(float f11, float f12, float f13, float f14,
           float f21, float f22, float f23, float f24,
           float f31, float f32, float f33, float f34,
           float f41, float f42, float f43, float f44)
  {
    _11=f11; _12=f12; _13=f13; _14=f14;
    _21=f21; _22=f22; _23=f23; _24=f24;
    _31=f31; _32=f32; _33=f33; _34=f34;
    _41=f41; _42=f42; _43=f43; _44=f44;
  }

  Matrix3D& operator*= (const Matrix3D& m)
  {
    return *this = *this * m;
  }

  friend Matrix3D PitchMatrix3D(const float theta);
  friend Matrix3D YawMatrix3D(const float theta);
  friend Matrix3D RollMatrix3D(const float theta);
  void rotate(const Vector3D& v);

  Matrix3D Inverse() const;
  Matrix3D Adjoint() const;
  float Determinant() const;

  float  operator() (int i, int j) const { return m[i][j]; }
  float& operator() (int i, int j)       { return m[i][j]; }
};

/** 3D Plane.  Used in conjunction with triangles. */
struct Plane
{
  Vector3D normal;
  float    d;

  Plane(const Vector3D& a, const Vector3D& b, const Vector3D& c)
  {
    normal = CrossProduct(b - a, c - a).Normalized();
    d = -normal * a;
  }

  float Classify(const Vector3D& v)
  {
    return v * normal + d;
  }
};

inline Vector3D operator* (float scalar, const Vector3D& v)
{
  return Vector3D(scalar*v.x,scalar*v.y,scalar*v.z);
}

inline Vector3D operator+ (const Vector3D& v1, const Vector3D& v2)
{
  return Vector3D(v1.x+v2.x,v1.y+v2.y,v1.z+v2.z);
}

inline Vector3D operator- (const Vector3D& v1, const Vector3D& v2)
{
  return Vector3D(v1.x-v2.x,v1.y-v2.y,v1.z-v2.z);
}

inline float operator* (const Vector3D& v1, const Vector3D& v2)
{
  return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
}

inline Vector3D CrossProduct(const Vector3D& v1, const Vector3D& v2)
{
  return Vector3D(v1.y*v2.z-v2.y*v1.z,
                  v1.z*v2.x-v2.z*v1.x,
                  v1.x*v2.y-v2.x*v1.y);
}

inline Vector3D Transform(const Vector3D& v, const Matrix3D& m)
{
  return Vector3D(v.x*m._11 + v.y*m._21 + v.z*m._31 + m._41,
                  v.x*m._12 + v.y*m._22 + v.z*m._32 + m._42,
                  v.x*m._13 + v.y*m._23 + v.z*m._33 + m._43);
}

inline Vector3D rotateVector(const Vector3D& v, const Matrix3D& m)
{
  return Vector3D(v.x*m._11 + v.y*m._21 + v.z*m._31,
                  v.x*m._12 + v.y*m._22 + v.z*m._32,
                  v.x*m._13 + v.y*m._23 + v.z*m._33);
}

inline Matrix3D operator*(float scalar, const Matrix3D& m)
{
  return Matrix3D(scalar*m(0,0),scalar*m(0,1),scalar*m(0,2),scalar*m(0,3),
                  scalar*m(1,0),scalar*m(1,1),scalar*m(1,2),scalar*m(1,3),
                  scalar*m(2,0),scalar*m(2,1),scalar*m(2,2),scalar*m(2,3),
                  scalar*m(3,0),scalar*m(3,1),scalar*m(3,2),scalar*m(3,3));
}

inline Matrix3D operator*(const Matrix3D& m1, const Matrix3D& m2)
{
  return Matrix3D(
    m1._11*m2._11 + m1._12*m2._21 + m1._13*m2._31 + m1._14*m2._41,
    m1._11*m2._12 + m1._12*m2._22 + m1._13*m2._32 + m1._14*m2._42,
    m1._11*m2._13 + m1._12*m2._23 + m1._13*m2._33 + m1._14*m2._43,
    m1._11*m2._14 + m1._12*m2._24 + m1._13*m2._34 + m1._14*m2._44,
    m1._21*m2._11 + m1._22*m2._21 + m1._23*m2._31 + m1._24*m2._41,
    m1._21*m2._12 + m1._22*m2._22 + m1._23*m2._32 + m1._24*m2._42,
    m1._21*m2._13 + m1._22*m2._23 + m1._23*m2._33 + m1._24*m2._43,
    m1._21*m2._14 + m1._22*m2._24 + m1._23*m2._34 + m1._24*m2._44,
    m1._31*m2._11 + m1._32*m2._21 + m1._33*m2._31 + m1._34*m2._41,
    m1._31*m2._12 + m1._32*m2._22 + m1._33*m2._32 + m1._34*m2._42,
    m1._31*m2._13 + m1._32*m2._23 + m1._33*m2._33 + m1._34*m2._43,
    m1._31*m2._14 + m1._32*m2._24 + m1._33*m2._34 + m1._34*m2._44,
    m1._41*m2._11 + m1._42*m2._21 + m1._43*m2._31 + m1._44*m2._41,
    m1._41*m2._12 + m1._42*m2._22 + m1._43*m2._32 + m1._44*m2._42,
    m1._41*m2._13 + m1._42*m2._23 + m1._43*m2._33 + m1._44*m2._43,
    m1._41*m2._14 + m1._42*m2._24 + m1._43*m2._34 + m1._44*m2._44);
}

inline void
Matrix3D::rotate(const Vector3D& v)
{
   if (v.x!=0.0f) *this = PitchMatrix3D(v.x) * (*this);
   if (v.y!=0.0f) *this = YawMatrix3D  (v.y) * (*this);
   if (v.z!=0.0f) *this = RollMatrix3D (v.z) * (*this);
}

inline Matrix3D
TranslateMatrix3D(const Vector3D& v)
{
  return Matrix3D(1.0f,0.0f,0.0f,0.0f,
                  0.0f,1.0f,0.0f,0.0f,
                  0.0f,0.0f,1.0f,0.0f,
                   v.x, v.y, v.z,1.0f);
}


inline Matrix3D
ScaleMatrix3D(const Vector3D& v)
{
   return Matrix3D( v.x,0.0f,0.0f,0.0f,
                   0.0f, v.y,0.0f,0.0f,
                   0.0f,0.0f, v.z,0.0f,
                   0.0f,0.0f,0.0f,1.0f);
}


inline Matrix3D
ScaleMatrix3D(const float s)
{
   return ScaleMatrix3D(Vector3D(s,s,s));
}


inline Matrix3D
PitchMatrix3D(const float c, const float s)
{
   return Matrix3D(1.0f, 0.0f, 0.0f, 0.0f,
                   0.0f,    c,   -s, 0.0f,
                   0.0f,    s,    c, 0.0f,
                   0.0f, 0.0f, 0.0f, 1.0f);
}


inline Matrix3D
PitchMatrix3D(const float theta)
{
   return PitchMatrix3D((float) cos(theta), (float) sin(theta));
}


inline Matrix3D
YawMatrix3D(const float c, const float s)
{
   return Matrix3D(   c, 0.0f,    s, 0.0f,
                   0.0f, 1.0f, 0.0f, 0.0f,
                     -s, 0.0f,    c, 0.0f,
                   0.0f, 0.0f, 0.0f, 1.0f);
}


inline Matrix3D
YawMatrix3D(const float theta)
{
   return YawMatrix3D((float) cos(theta), (float) sin(theta));
}


inline Matrix3D
RollMatrix3D(const float c, const float s)
{
   return Matrix3D(c,   -s,    0.0f, 0.0f,
                   s,    c,    0.0f, 0.0f,
                   0.0f, 0.0f, 1.0f, 0.0f,
                   0.0f, 0.0f, 0.0f, 1.0f);
}


inline Matrix3D
RollMatrix3D(const float theta)
{
   return RollMatrix3D((float) cos(theta), (float) sin(theta));
}


template<class T>
inline T Max(T a, T b)
{
  return (a>b ? a : b);
}

template<class T>
inline T Min(T a, T b)
{
  return (a<b ? a : b);
}

#undef _11
#undef _12
#undef _13
#undef _14
#undef _21
#undef _22
#undef _23
#undef _24
#undef _31
#undef _32
#undef _33
#undef _34
#undef _41
#undef _42
#undef _43
#undef _44

#endif // H_MATH3D

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产品国语在线不卡| 国产91精品一区二区麻豆亚洲| 在线日韩国产精品| 玉米视频成人免费看| 91麻豆视频网站| 性感美女久久精品| 日韩视频在线你懂得| 国产精品亚洲一区二区三区妖精| 国产无人区一区二区三区| 成人福利在线看| 亚洲一区二区高清| 日韩欧美一级片| 国产成人精品aa毛片| 亚洲人成精品久久久久久| 91久久精品午夜一区二区| 日韩 欧美一区二区三区| 国产亚洲一区二区三区| 高清不卡在线观看| 亚洲国产日韩精品| 久久久久青草大香线综合精品| 成人av影视在线观看| 亚洲成人自拍偷拍| 久久免费看少妇高潮| 日本高清不卡视频| 韩国成人精品a∨在线观看| 中文字幕亚洲视频| 日韩一级视频免费观看在线| 成人久久久精品乱码一区二区三区| 亚洲午夜三级在线| 亚洲国产精品t66y| 欧美一区二区三区免费| www.亚洲人| 久久国产视频网| 一区二区在线看| 2021中文字幕一区亚洲| 在线一区二区三区四区| 国产黄色精品网站| 亚洲一区自拍偷拍| 国产精品乱人伦| 555www色欧美视频| 色综合天天性综合| 北条麻妃国产九九精品视频| 婷婷综合另类小说色区| 国产精品免费aⅴ片在线观看| 日韩一级片在线观看| 91成人免费在线| www.亚洲人| 国产成人精品在线看| 日韩av电影一区| 亚洲精品美腿丝袜| 国产日韩影视精品| 337p日本欧洲亚洲大胆色噜噜| 在线观看一区日韩| proumb性欧美在线观看| 国产乱码精品一区二区三区av| 日韩高清一级片| 亚洲国产精品天堂| 一区二区三区国产精华| 国产精品家庭影院| 中文成人av在线| 国产亚洲精品bt天堂精选| 精品日产卡一卡二卡麻豆| 欧美精品xxxxbbbb| 欧美日本一区二区在线观看| 色综合激情五月| 94色蜜桃网一区二区三区| 盗摄精品av一区二区三区| 国产一区二区三区| 国产一区二区在线看| 久久精品久久综合| 日本不卡的三区四区五区| 亚洲h在线观看| 午夜精品影院在线观看| 亚洲成人综合视频| 日本人妖一区二区| 麻豆视频观看网址久久| 久久成人羞羞网站| 久久99国产乱子伦精品免费| 久久精品久久精品| 国产麻豆一精品一av一免费| 国产精品一区在线观看你懂的| 激情偷乱视频一区二区三区| 国产一区二区在线看| 国产精品一区2区| 国产91精品欧美| 色综合一个色综合| 在线免费一区三区| 欧美美女bb生活片| 日韩一区二区影院| 26uuu久久天堂性欧美| 久久久久久久久免费| 中文字幕免费一区| 夜夜嗨av一区二区三区四季av| 亚洲综合另类小说| 天天色图综合网| 极品少妇xxxx精品少妇| 成人激情小说乱人伦| 色素色在线综合| 在线综合+亚洲+欧美中文字幕| 日韩欧美成人一区二区| 国产清纯白嫩初高生在线观看91| 中文字幕在线观看不卡| 亚洲五码中文字幕| 精品一区二区在线视频| 成人黄色综合网站| 欧美日韩午夜在线视频| 日韩视频一区二区| 国产精品伦理在线| 日日噜噜夜夜狠狠视频欧美人| 韩国毛片一区二区三区| 色诱视频网站一区| 日韩欧美中文字幕精品| 久久精品一区二区三区四区| 亚洲精品你懂的| 国内成人免费视频| 色八戒一区二区三区| 欧美tickling挠脚心丨vk| 国产精品成人一区二区艾草| 日韩高清中文字幕一区| 国产成人免费视频网站| 欧美日韩免费高清一区色橹橹| 久久日一线二线三线suv| 亚洲婷婷在线视频| 国产一区二区三区久久悠悠色av| 在线视频你懂得一区| 国产欧美日本一区二区三区| 亚洲综合在线观看视频| 国产精品91一区二区| 欧美精品自拍偷拍动漫精品| 中文字幕精品—区二区四季| 石原莉奈在线亚洲三区| 91香蕉视频在线| 国产无一区二区| 免费看欧美女人艹b| 91国偷自产一区二区三区成为亚洲经典 | 欧美二区三区91| 欧美激情综合五月色丁香小说| 亚洲国产一区二区三区| 国产成人午夜高潮毛片| 欧美一区二区三区免费| 亚洲国产中文字幕| 99久久久国产精品免费蜜臀| 久久久精品国产免费观看同学| 日本三级亚洲精品| 欧美日韩亚洲另类| 一区二区三区欧美日| 成人一级片在线观看| 久久久久久久久蜜桃| 激情伊人五月天久久综合| 欧美麻豆精品久久久久久| 亚洲午夜电影在线观看| 色av一区二区| 一级日本不卡的影视| 99精品欧美一区| 国产精品视频你懂的| 丰满放荡岳乱妇91ww| 久久久精品tv| 国产成人鲁色资源国产91色综| 久久伊99综合婷婷久久伊| 国产最新精品免费| 欧美成人国产一区二区| 美女精品一区二区| 日韩情涩欧美日韩视频| 久久精品国产免费| 欧美精品一区男女天堂| 激情五月婷婷综合网| 久久久久久99精品| 成人午夜视频免费看| 中文字幕av不卡| av中文一区二区三区| 亚洲欧美日本韩国| 在线看日韩精品电影| 亚洲综合免费观看高清完整版在线| 欧亚一区二区三区| 无码av免费一区二区三区试看 | 1024精品合集| 91视频xxxx| 亚洲成人自拍网| 91精品国产一区二区人妖| 蜜臀久久久久久久| ww久久中文字幕| 成人中文字幕在线| 亚洲麻豆国产自偷在线| 欧美午夜精品久久久| 日韩高清不卡在线| 国产亚洲成av人在线观看导航| 成人av网站免费| 亚洲国产日韩综合久久精品| 欧美一激情一区二区三区| 国产资源在线一区| 国产精品久久777777| 欧美日韩dvd在线观看| 久久国产精品99精品国产| 国产精品沙发午睡系列990531| 日本高清免费不卡视频| 免费成人结看片| 自拍av一区二区三区| 91 com成人网| 国产成人精品免费一区二区| 一区二区三区精品在线观看|