QD3D: Add/Subtract Q3Point2D/3D

This commit is contained in:
Iliyas Jorio 2021-06-19 01:00:45 +02:00
parent 1495c647fd
commit 6d31883a4d

View File

@ -100,6 +100,24 @@ static inline float Q3Point2D_Distance(
return sqrtf(Q3Point2D_DistanceSquared(p1, p2));
}
static inline void Q3Point2D_Add(
const TQ3Point2D* p1,
const TQ3Point2D* p2,
TQ3Vector2D* result)
{
result->x = p1->x + p2->x;
result->y = p1->y + p2->y;
}
static inline void Q3Point2D_Subtract(
const TQ3Point2D* p1,
const TQ3Point2D* p2,
TQ3Vector2D* result)
{
result->x = p1->x - p2->x;
result->y = p1->y - p2->y;
}
//-----------------------------------------------------------------------------
#pragma mark Q3Point3D
@ -138,6 +156,26 @@ static inline void Q3Point3D_CrossProductTri(
result->z = (v1_x * v2_y) - (v1_y * v2_x);
}
static inline void Q3Point3D_Add(
const TQ3Point3D* p1,
const TQ3Point3D* p2,
TQ3Vector3D* result)
{
result->x = p1->x + p2->x;
result->y = p1->y + p2->y;
result->z = p1->z + p2->z;
}
static inline void Q3Point3D_Subtract(
const TQ3Point3D* p1,
const TQ3Point3D* p2,
TQ3Vector3D* result)
{
result->x = p1->x - p2->x;
result->y = p1->y - p2->y;
result->z = p1->z - p2->z;
}
static inline TQ3Point3D* Q3Point3D_Transform(
const TQ3Point3D *point3D,
const TQ3Matrix4x4 *matrix4x4,