[詳解]
47 #define AKVECTORS_PI (3.1415926535897932384626433832795f)
48 #define AKVECTORS_TWOPI (6.283185307179586476925286766559f)
49 #define AKVECTORS_PIOVERTWO (1.5707963267948966192313216916398f)
50 #define AKVECTORS_EPSILON (1.0e-38f) // epsilon value for fast log(0)
101 p.
v[0] =
v[0] - b.
v[0];
102 p.
v[1] =
v[1] - b.
v[1];
103 p.
v[2] =
v[2] - b.
v[2];
104 p.
v[3] =
v[3] - b.
v[3];
194 return X == b.
X &&
Y == b.
Y &&
Z == b.
Z;
199 return X != b.
X ||
Y != b.
Y ||
Z != b.
Z;
222 return X < b.
X &&
Y < b.
Y &&
Z < b.
Z;
227 return X <= b.
X &&
Y <= b.
Y &&
Z <= b.
Z;
232 return X > b.
X &&
Y > b.
Y &&
Z > b.
Z;
237 return X >= b.
X &&
Y >= b.
Y &&
Z >= b.
Z;
340 v.
X =
X; v.
Y =
Y; v.
Z =
Z;
385 AkReal32 cosElevation = cosf(elevation);
386 X = cosf(azimuth) * cosElevation;
387 Y = sinf(azimuth) * cosElevation;
399 return (a.
X*b.
Y*c.
Z + a.
Y*b.
Z*c.
X + a.
Z*b.
X*c.
Y) -
400 (a.
Z*b.
Y*c.
X + a.
Y*b.
X*c.
Z + a.
X*b.
Z*c.
Y);
415 v.
X = 0.0f; v.
Y = 0.0f; v.
Z = 0.0f;
430 v.
X =
X * invA.
X +
Y * invB.
X +
Z * invC.
X;
431 v.
Y =
X * invA.
Y +
Y * invB.
Y +
Z * invC.
Y;
432 v.
Z =
X * invA.
Z +
Y * invB.
Z +
Z * invC.
Z;
459 return sqrtf(
X*
X +
Y*
Y +
Z*
Z);
464 return X*v2.
X +
Y*v2.
Y +
Z*v2.
Z;
477 uxv.
X = u.
Y*v.
Z - u.
Z*v.
Y;
478 uxv.
Y = u.
Z*v.
X - u.
X*v.
Z;
479 uxv.
Z = u.
X*v.
Y - u.
Y*v.
X;
486 return sqrtf(
X*
X +
Y*
Y +
Z*
Z);
497 const AkReal32 POSITIVE_TEST_EPSILON = 0.00001f;
498 return X >= -POSITIVE_TEST_EPSILON &&
499 Y >= -POSITIVE_TEST_EPSILON &&
500 Z >= -POSITIVE_TEST_EPSILON;
580 return b.
X ==
X && b.
Y ==
Y;
585 return b.
X !=
X && b.
Y !=
Y;
590 return sqrtf(
X*
X+
Y*
Y);
598 AkReal32 r = sqrtf( in_Cartesian.
X*in_Cartesian.
X + in_Cartesian.
Y*in_Cartesian.
Y + in_Cartesian.
Z*in_Cartesian.
Z);
601 X = atan2f(in_Cartesian.
Y, in_Cartesian.
X);
602 Y = asinf(in_Cartesian.
Z / r);
620 v.
X = 0.0f; v.
Y = 0.0f;
631 v.
X =
X * invA.
X +
Y * invB.
X;
632 v.
Y =
X * invA.
Y +
Y * invB.
Y;
689 const AkReal32 POSITIVE_TEST_EPSILON = 0.00001f;
690 return X >= -POSITIVE_TEST_EPSILON &&
691 Y >= -POSITIVE_TEST_EPSILON;
702 static const int MAX_SIZE = 16;
714 for (
int i = 0; i < MAX_SIZE; i++)
722 for (
int i = 0; i < MAX_SIZE; i++)
746 for (
int i = 0; i < 3; i++)
748 for (
int j = 0; j < 3; j++)
758 return m_Data[column][row];
763 return m_Data[column][row];
777 Add(*
this, *
this, in_rhs);
783 #define ADD(i,j) out_res(i,j) = in_m0(i,j) + in_m1(i,j)
800 out_mat(0, 0) = in_f; out_mat(0, 1) = 0.f; out_mat(0, 2) = 0.f;
801 out_mat(1, 0) = 0.f; out_mat(1, 1) = in_f; out_mat(1, 2) = 0.f;
802 out_mat(2, 0) = 0.f; out_mat(2, 1) = 0.f; out_mat(2, 2) = in_f;
808 out_mat(0, 0) = 0.f; out_mat(0, 1) = -in_u.
Z; out_mat(0, 2) = in_u.
Y;
809 out_mat(1, 0) = in_u.
Z; out_mat(1, 1) = 0.f; out_mat(1, 2) = -in_u.
X;
810 out_mat(2, 0) = -in_u.
Y; out_mat(2, 1) = in_u.
X; out_mat(2, 2) = 0.f;
815 out_mat(0, 0) = in_v0.
X*in_v1.
X; out_mat(0, 1) = in_v0.
X*in_v1.
Y; out_mat(0, 2) = in_v0.
X*in_v1.
Z;
816 out_mat(1, 0) = in_v0.
Y*in_v1.
X; out_mat(1, 1) = in_v0.
Y*in_v1.
Y; out_mat(1, 2) = in_v0.
Y*in_v1.
Z;
817 out_mat(2, 0) = in_v0.
Z*in_v1.
X; out_mat(2, 1) = in_v0.
Z*in_v1.
Y; out_mat(2, 2) = in_v0.
Z*in_v1.
Z;
822 Rotation(out_mat, sinf(in_angle), cosf(in_angle), in_axis);
831 outer *= (1.f - in_cos);
865 return sqrtf(
W*
W +
X*
X +
Y*
Y +
Z*
Z );
916 AkReal32 sqrt = sqrtf((1.f + dot) * 2.f);
932 AkReal32 cosHalfAngle = cosf(in_angle / 2.f);
934 X = cosHalfAngle*in_axis.
X;
935 Y = cosHalfAngle*in_axis.
Y;
936 Z = cosHalfAngle*in_axis.
Z;
965 u * u.
Dot(in_v) * 2.f
966 + in_v * (
W*
W - u.
Dot(u))
967 + u.
Cross(in_v) *
W * 2.0f;
989 mint = 1.175494351e-38F;
990 maxt = 3.402823466e+38F;
1000 mint = 1.175494351e-38F;
1001 maxt = 3.402823466e+38F;
1046 AkReal32 distsqrd = ((P2 + V2*s) - (P1 + V1*t)).LengthSquared();
1052 #ifdef AKPORTALS_DEBUG
1071 #ifdef AKPORTALS_DEBUG
1115 AKASSERT(in_p1.
X < 100000 && in_p1.
X > -100000);
1116 AKASSERT(in_p1.
Y < 100000 && in_p1.
Y > -100000);
1117 AKASSERT(in_p1.
Z < 100000 && in_p1.
Z > -100000);
1119 AKASSERT(in_p2.
X < 100000 && in_p2.
X > -100000);
1120 AKASSERT(in_p2.
Y < 100000 && in_p2.
Y > -100000);
1121 AKASSERT(in_p2.
Z < 100000 && in_p2.
Z > -100000);
1123 AKASSERT(in_p4.
X < 100000 && in_p4.
X > -100000);
1124 AKASSERT(in_p4.
Y < 100000 && in_p4.
Y > -100000);
1125 AKASSERT(in_p4.
Z < 100000 && in_p4.
Z > -100000);
1135 D = -(N.
X*p1.
X) - (N.
Y*p1.
Y) - (N.
Z*p1.
Z);
1138 #define EPSILON 0.01f
1159 if (dot < EPSILON && dot > -
EPSILON)
1161 intersect = in_Origin;
1166 out_Intersection = p1;
1179 if ((A*ray.
X + B*ray.
Y + C*ray.
Z) == 0.0f)
1182 AkReal32 t = -(A*in_Origin.X + B*in_Origin.Y + C*in_Origin.Z + D) / (A*ray.
X + B*ray.
Y + C*ray.
Z);
1183 intersect =
Ak3DVector(in_Origin.X + ray.
X*t, in_Origin.Y + ray.
Y*t, in_Origin.Z + ray.
Z*t);
1184 out_Intersection = intersect;
1190 AkReal32 t = -(A*in_Origin.X + B*in_Origin.Y + C*in_Origin.Z + D) / (A*ray.
X + B*ray.
Y + C*ray.
Z);
1193 if (t < -EPSILON || t >(rayLength +
EPSILON))
1196 intersect =
Ak3DVector(in_Origin.X + ray.
X*t, in_Origin.Y + ray.
Y*t, in_Origin.Z + ray.
Z*t);
1197 out_Intersection = intersect;
1202 intersect =
Ak3DVector(in_Origin.X + ray.
X*t, in_Origin.Y + ray.
Y*t, in_Origin.Z + ray.
Z*t);
1231 out_Intersection = intersect;
1243 pointToPlane *= distance;
1245 out_B = in_P + pointToPlane;
1269 out_mat[0] = 1 - 2 * N.
X*N.
X; out_mat[1] = -2 * N.
X*N.
Y; out_mat[2] = -2 * N.
X*N.
Z; out_mat[3] = -2 * N.
X*d;
1270 out_mat[0 + 4] = -2 * N.
X*N.
Y; out_mat[1 + 4] = 1 - 2 * N.
Y*N.
Y; out_mat[2 + 4] = -2 * N.
Y*N.
Z; out_mat[3 + 4] = -2 * N.
Y*d;
1271 out_mat[0 + 8] = -2 * N.
X*N.
Z; out_mat[1 + 8] = -2 * N.
Y*N.
Z; out_mat[2 + 8] = 1 - 2 * N.
Z*N.
Z; out_mat[3 + 8] = -2 * N.
Z*d;
1272 out_mat[0 + 12] = 0; out_mat[1 + 12] = 0; out_mat[2 + 12] = 0; out_mat[3 + 12] = 1;
1282 out_Intrs.
count = 0;
1325 point.
Y = (N1.
Z*D2 - N2.
Z*D1) / L.
X;
1326 point.
Z = (N2.
Y*D1 - N1.
Y*D2) / L.
X;
1330 point.
X = (N1.
Z*D2 - N2.
Z*D1) / L.
Y;
1332 point.
Z = (N2.
X*D1 - N1.
X*D2) / L.
Y;
1336 point.
X = (N1.
Y*D2 - N2.
Y*D1) / L.
Z;
1337 point.
Y = (N2.
X*D1 - N1.
X*D2) / L.
Z;
1356 #ifdef AKPORTALS_DEBUG
1380 #ifdef AKPORTALS_DEBUG
1392 if (cpt < 2 || cpt2 < 2)
1394 #ifdef AKPORTALS_DEBUG
1406 #ifdef AKPORTALS_DEBUG
1423 out_Intrs.
points[0] = minPoint;
1424 out_Intrs.
points[1] = maxPoint;
1425 out_Intrs.
count = 2;
1508 return in_Point >=
m_Min && in_Point <=
m_Max;
1542 AKASSERT((in_fAngle <= 1.0f) && (in_fAngle >= -1.0f));
1543 return acosf(in_fAngle);
1573 AKASSERT(fabs(in_Front.
Dot(in_Up) - 0.f) < 0.001);
1575 m_Center = in_center;
1576 m_Extent = in_extent;
1580 m_X = m_Z.
Cross(m_Y);
1588 return fabs(pt.
Dot(m_X)) <= m_Extent.
X && fabs(pt.
Dot(m_Y)) <= m_Extent.
Y && fabs(pt.
Dot(m_Z)) <= m_Extent.
Z;
1605 return size.
X * size.
Y * size.
Z;
1614 const AkBox& A = *
this;
1645 AkReal32 right = dpax + dpay + dpaz + dpbx + dpby + dpbz;
1647 return left > right;
1653 out_aabb.
Update(m_Center + x);
1654 out_aabb.
Update(m_Center - x);
1656 out_aabb.
Update(m_Center + y);
1657 out_aabb.
Update(m_Center - y);
1659 out_aabb.
Update(m_Center + Z);
1660 out_aabb.
Update(m_Center - Z);
bool FindIntersectionPoints(const AkPlane &in_PlaneB, AkIntersectionPoints &out_Intrs) const
AkReal32 DistPoint_to_Plane(Ak3DVector in_P, Ak3DVector &out_B) const
AkForceInline bool operator<(const Ak3DVector &b) const
AkForceInline Ak3DVector Cross(const Ak3DVector &v) const
AkForceInline Ak2DVector CartesianToSpherical(const Ak3DVector &in_Cartesian)
Ak2DVector operator*=(const AkReal32 f)
AkForceInline Ak3DVector operator-(const Ak3DVector &b) const
AkForceInline Ak3DVector operator*=(const AkReal32 f)
AkForceInline Ak2DVector operator=(const Ak2DVector &b)
AkForceInline AKSIMD_V4F32 VectorV4F32() const
Ak3DVector PointAt(AkReal32 t) const
Ak3DVector(const AKSIMD_V4F32 &in_v4f32)
bool Intersect(Ak3DVector A, Ak3DVector B)
Ak4DVector operator-(const Ak4DVector &b) const
bool SeparatingAxisExists(const Ak3DVector &L, const AkBox &B) const
bool IsPointInBox(const Ak3DVector &in_Point) const
Ak4DVector operator/=(const AkReal32 f)
AkForceInline bool operator==(const Ak3DVector &b) const
AkForceInline Ak3DVector Rotate180X_90Y() const
AkForceInline AkQuaternion Inverse() const
AkForceInline AkQuaternion operator*(const AkQuaternion &Q) const
Quaternion multiplication.
Ak3DIntVector(AkInt32 x, AkInt32 y, AkInt32 z)
void SetPlane(Ak3DVector in_p1, Ak3DVector in_p2, Ak3DVector in_p4)
void OutputDebugMsg(const char *in_pszMsg)
Output a debug message on the console (Ansi string)
AkForceInline AkReal32 DotProduct(const Ak3DVector &v2) const
AkForceInline AkReal32 Length() const
static AkForceInline AkReal32 Determinant(const Ak3DVector &a, const Ak3DVector &b, const Ak3DVector &c)
static AkForceInline void Diagonal(AkMatrix3x3 &out_mat, AkReal32 in_f)
AkForceInline AkReal32 Length()
AkMatrix4x4 operator=(AkReal32 *in_Data)
AkForceInline Ak3DVector operator=(const AkVector &b)
static void Rotation(AkMatrix3x3 &out_mat, AkReal32 in_sin, AkReal32 in_cos, const Ak3DVector &in_axis)
AkForceInline bool operator==(const Ak2DVector &b) const
AkForceInline Ak3DVector operator*(const Ak3DVector &in_rhs)
AkForceInline Ak3DVector operator-(const AkReal32 f) const
AkForceInline Ak3DVector operator+(const Ak3DVector &b) const
void UpdateBoundingBox(AkBoundingBox &out_aabb) const
Ak3DVector GetCenter() const
AkForceInline bool operator>=(const Ak3DVector &b) const
#define AKVECTORS_PIOVERTWO
AkForceInline bool operator!=(const Ak2DVector &b) const
AkForceInline bool IsAllPositive() const
AkForceInline AkReal32 LengthSquared() const
AkForceInline AkReal32 Length() const
Ak3DVector GetSide() const
Ak2DVector(AkReal32 x, AkReal32 y)
AkForceInline AkMatrix3x3 & operator*=(const AkReal32 &in_f)
AkReal32 GetVolume() const
AkForceInline Ak3DVector operator*(const AkReal32 f) const
AkForceInline bool operator>(const Ak3DVector b) const
Ak2DVector operator-(const Ak2DVector &b) const
AkReal32 m_Data[MAX_SIZE]
AkForceInline AkReal32 ACos(AkReal32 in_fAngle) const
AkBoundingBox Intersect(const AkBoundingBox &in_BB) const
#define AKASSERT(Condition)
Ak3DVector(AkReal32 x, AkReal32 y, AkReal32 z)
static AkForceInline void OuterProduct(AkMatrix3x3 &out_mat, const Ak3DVector &in_v0, const Ak3DVector &in_v1)
Ak3DVector(const AkVector &b)
Ak3DVector GetFront() const
Ak4DVector operator=(const Ak4DVector &b)
AkForceInline bool IsWithin(const AkBoundingBox &in_BB) const
AkMatrix4x4 operator/=(const AkReal32 f)
AkForceInline bool operator!=(const Ak3DVector &b) const
static AkForceInline void Add(AkMatrix3x3 &out_res, const AkMatrix3x3 &in_m0, const AkMatrix3x3 &in_m1)
AkForceInline bool IsEmpty() const
AkMatrix3x3 operator/=(const AkReal32 f)
AkForceInline Ak3DVector SphericalToCartesian(const AkReal32 azimuth, const AkReal32 elevation)
AkForceInline AkReal32 & operator()(const AkUInt32 row, const AkUInt32 column)
void Update(const Ak3DVector &in_point)
AkQuaternion(AkReal32 in_angle, const Ak3DVector &in_axis)
AkLine(Ak3DVector in_L, Ak3DVector in_P)
static AkForceInline void CrossProductMatrix(AkMatrix3x3 &out_mat, const Ak3DVector &in_u)
bool DoesRayIntersect(const Ak3DVector &in_Origin, const Ak3DVector &in_Destination, Ak3DVector &out_Intersection) const
AkForceInline bool IsAllPositive() const
AkForceInline AkReal32 L2_Norm() const
AkForceInline AKSIMD_V4F32 PointV4F32() const
AkForceInline const AkQuaternion & Normalize()
AkForceInline Ak2DVector NormalizeSpherical() const
AkForceInline Ak3DVector operator/(const AkReal32 f) const
AkQuaternion(const Ak3DVector &in_fromVector)
AkForceInline void NormalizeSpherical()
static AkForceInline void Rotation(AkMatrix3x3 &out_mat, AkReal32 in_angle, const Ak3DVector &in_axis)
#define AKVECTORS_EPSILON
static AkForceInline Ak3DVector Max(const Ak3DVector &A, const Ak3DVector &B)
void Init(const Ak3DVector &in_center, const Ak3DVector &in_extent, const Ak3DVector &in_Front, const Ak3DVector &in_Up)
AkForceInline AkMatrix3x3 & operator+=(const AkMatrix3x3 &in_rhs)
AkForceInline const AkReal32 & operator()(const AkUInt32 row, const AkUInt32 column) const
AkForceInline Ak3DVector operator/=(const AkReal32 f)
AkForceInline bool operator<=(const Ak3DVector &b) const
AkPlane(Ak3DVector in_p1, Ak3DVector in_p2, Ak3DVector in_p4)
AkQuaternion(const Ak3DVector &in_v0, const Ak3DVector &in_v1)
AkForceInline Ak3DVector operator+(const AkReal32 f) const
Ak3DVector GetSize() const
AkForceInline AkReal32 Dot(const Ak3DVector &v2) const
AkForceInline const Ak3DVector & Normalize()
AkForceInline Ak3DVector operator=(const Ak3DVector &b)
static AkForceInline Ak3DVector Min(const Ak3DVector &A, const Ak3DVector &B)
void SetReflection(AkReal32 *out_mat) const
Ak4DVector(const AkVector &b)
AkForceInline bool IsWithin(const Ak3DVector &in_Point) const
AkForceInline Ak2DVector operator=(const AkSphericalCoord &b)
Ak2DVector operator/=(const AkReal32 f)
AkForceInline Ak2DVector LinearCombination(const Ak2DVector &A, const Ak2DVector &B) const
AkQuaternion(AkReal32 in_W, AkReal32 in_X, AkReal32 in_Y, AkReal32 in_Z)
AkForceInline Ak3DVector Abs() const
AkForceInline Ak3DVector operator*(const Ak3DVector v2) const
AkForceInline Ak3DVector LinearCombination(const Ak3DVector &A, const Ak3DVector &B, const Ak3DVector &C) const
あなたのプロジェクトについて教えてください。ご不明な点はありませんか。
プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。
Wwiseからはじめよう