[詳解]
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;
693 const AkReal32 POSITIVE_TEST_EPSILON = 0.00001f;
694 return X >= -POSITIVE_TEST_EPSILON &&
695 Y >= -POSITIVE_TEST_EPSILON;
706 static const int MAX_SIZE = 16;
718 for (
int i = 0; i < MAX_SIZE; i++)
726 for (
int i = 0; i < MAX_SIZE; i++)
750 for (
int i = 0; i < 3; i++)
752 for (
int j = 0; j < 3; j++)
762 return m_Data[column][row];
767 return m_Data[column][row];
781 Add(*
this, *
this, in_rhs);
787 #define ADD(i,j) out_res(i,j) = in_m0(i,j) + in_m1(i,j)
804 out_mat(0, 0) = in_f; out_mat(0, 1) = 0.f; out_mat(0, 2) = 0.f;
805 out_mat(1, 0) = 0.f; out_mat(1, 1) = in_f; out_mat(1, 2) = 0.f;
806 out_mat(2, 0) = 0.f; out_mat(2, 1) = 0.f; out_mat(2, 2) = in_f;
812 out_mat(0, 0) = 0.f; out_mat(0, 1) = -in_u.
Z; out_mat(0, 2) = in_u.
Y;
813 out_mat(1, 0) = in_u.
Z; out_mat(1, 1) = 0.f; out_mat(1, 2) = -in_u.
X;
814 out_mat(2, 0) = -in_u.
Y; out_mat(2, 1) = in_u.
X; out_mat(2, 2) = 0.f;
819 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;
820 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;
821 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;
826 Rotation(out_mat, sinf(in_angle), cosf(in_angle), in_axis);
835 outer *= (1.f - in_cos);
869 return sqrtf(
W*
W +
X*
X +
Y*
Y +
Z*
Z );
920 AkReal32 sqrt = sqrtf((1.f + dot) * 2.f);
936 AkReal32 cosHalfAngle = cosf(in_angle / 2.f);
938 X = cosHalfAngle*in_axis.
X;
939 Y = cosHalfAngle*in_axis.
Y;
940 Z = cosHalfAngle*in_axis.
Z;
969 u * u.
Dot(in_v) * 2.f
970 + in_v * (
W*
W - u.
Dot(u))
971 + u.
Cross(in_v) *
W * 2.0f;
993 mint = 1.175494351e-38F;
994 maxt = 3.402823466e+38F;
1004 mint = 1.175494351e-38F;
1005 maxt = 3.402823466e+38F;
1050 AkReal32 distsqrd = ((P2 + V2*s) - (P1 + V1*t)).LengthSquared();
1056 #ifdef AKPORTALS_DEBUG
1075 #ifdef AKPORTALS_DEBUG
1119 AKASSERT(in_p1.
X < 100000 && in_p1.
X > -100000);
1120 AKASSERT(in_p1.
Y < 100000 && in_p1.
Y > -100000);
1121 AKASSERT(in_p1.
Z < 100000 && in_p1.
Z > -100000);
1123 AKASSERT(in_p2.
X < 100000 && in_p2.
X > -100000);
1124 AKASSERT(in_p2.
Y < 100000 && in_p2.
Y > -100000);
1125 AKASSERT(in_p2.
Z < 100000 && in_p2.
Z > -100000);
1127 AKASSERT(in_p4.
X < 100000 && in_p4.
X > -100000);
1128 AKASSERT(in_p4.
Y < 100000 && in_p4.
Y > -100000);
1129 AKASSERT(in_p4.
Z < 100000 && in_p4.
Z > -100000);
1139 D = -(N.
X*p1.
X) - (N.
Y*p1.
Y) - (N.
Z*p1.
Z);
1142 #define EPSILON 0.01f
1163 if (dot < EPSILON && dot > -
EPSILON)
1165 intersect = in_Origin;
1170 out_Intersection = p1;
1184 if ((A*ray.
X + B*ray.
Y + C*ray.
Z) == 0.0f)
1187 AkReal32 t = -(A*in_Origin.X + B*in_Origin.Y + C*in_Origin.Z + D) / (A*ray.
X + B*ray.
Y + C*ray.
Z);
1188 intersect =
Ak3DVector(in_Origin.X + ray.
X*t, in_Origin.Y + ray.
Y*t, in_Origin.Z + ray.
Z*t);
1189 out_Intersection = intersect;
1195 AkReal32 t = -(A*in_Origin.X + B*in_Origin.Y + C*in_Origin.Z + D) / (A*ray.
X + B*ray.
Y + C*ray.
Z);
1198 if (t < -EPSILON || t >(rayLength +
EPSILON))
1201 intersect =
Ak3DVector(in_Origin.X + ray.
X*t, in_Origin.Y + ray.
Y*t, in_Origin.Z + ray.
Z*t);
1202 out_Intersection = intersect;
1207 intersect =
Ak3DVector(in_Origin.X + ray.
X*t, in_Origin.Y + ray.
Y*t, in_Origin.Z + ray.
Z*t);
1236 out_Intersection = intersect;
1248 pointToPlane *= distance;
1250 out_B = in_P + pointToPlane;
1274 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;
1275 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;
1276 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;
1277 out_mat[0 + 12] = 0; out_mat[1 + 12] = 0; out_mat[2 + 12] = 0; out_mat[3 + 12] = 1;
1287 out_Intrs.
count = 0;
1330 point.
Y = (N1.
Z*D2 - N2.
Z*D1) / L.
X;
1331 point.
Z = (N2.
Y*D1 - N1.
Y*D2) / L.
X;
1335 point.
X = (N1.
Z*D2 - N2.
Z*D1) / L.
Y;
1337 point.
Z = (N2.
X*D1 - N1.
X*D2) / L.
Y;
1341 point.
X = (N1.
Y*D2 - N2.
Y*D1) / L.
Z;
1342 point.
Y = (N2.
X*D1 - N1.
X*D2) / L.
Z;
1361 #ifdef AKPORTALS_DEBUG
1385 #ifdef AKPORTALS_DEBUG
1397 if (cpt < 2 || cpt2 < 2)
1399 #ifdef AKPORTALS_DEBUG
1411 #ifdef AKPORTALS_DEBUG
1428 out_Intrs.
points[0] = minPoint;
1429 out_Intrs.
points[1] = maxPoint;
1430 out_Intrs.
count = 2;
1514 return in_Point >=
m_Min && in_Point <=
m_Max;
1548 AKASSERT((in_fAngle <= 1.0f) && (in_fAngle >= -1.0f));
1549 return acosf(in_fAngle);
1579 AKASSERT(fabs(in_Front.
Dot(in_Up) - 0.f) < 0.001);
1581 m_Center = in_center;
1582 m_Extent = in_extent;
1586 m_X = m_Z.
Cross(m_Y);
1594 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;
1611 return size.
X * size.
Y * size.
Z;
1620 const AkBox& A = *
this;
1651 AkReal32 right = dpax + dpay + dpaz + dpbx + dpby + dpbz;
1653 return left > right;
1659 out_aabb.
Update(m_Center + x);
1660 out_aabb.
Update(m_Center - x);
1662 out_aabb.
Update(m_Center + y);
1663 out_aabb.
Update(m_Center - y);
1665 out_aabb.
Update(m_Center + Z);
1666 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 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 AkReal32 Determinant(const Ak3DVector &a, const Ak3DVector &b, const Ak3DVector &c)
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からはじめよう