2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
2008-04-06 20:23:28 +00:00
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Header file for vector/matrix library
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-01-12 00:26:02 +00:00
|
|
|
#pragma once
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#ifdef __cplusplus
|
2015-08-13 03:15:52 +00:00
|
|
|
#include <cassert>
|
2015-03-12 02:21:19 +00:00
|
|
|
#include <cstdint>
|
2015-01-12 00:26:02 +00:00
|
|
|
#include <utility>
|
2015-12-05 22:57:23 +00:00
|
|
|
#include "fwd-vecmat.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-12-13 18:00:49 +00:00
|
|
|
namespace dcx {
|
2015-12-05 22:57:24 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
//The basic fixed-point vector. Access elements by name or position
|
2013-12-22 22:03:07 +00:00
|
|
|
struct vms_vector
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2014-08-22 02:27:13 +00:00
|
|
|
fix x, y, z;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-03-12 02:21:19 +00:00
|
|
|
class vm_distance
|
|
|
|
{
|
|
|
|
public:
|
2019-04-28 00:53:40 +00:00
|
|
|
fix d = 0;
|
2015-03-12 02:21:19 +00:00
|
|
|
/* Default constructor only required because Fcd_cache,SoundObjects
|
|
|
|
* have global scope instances of vm_distance. They should be
|
|
|
|
* converted to construct as needed, then the default constructor
|
|
|
|
* should be removed.
|
|
|
|
*/
|
2019-04-28 00:53:40 +00:00
|
|
|
constexpr vm_distance() = default;
|
2015-03-12 02:21:19 +00:00
|
|
|
constexpr explicit vm_distance(const fix &f) :
|
|
|
|
d(f)
|
|
|
|
{
|
|
|
|
}
|
2015-03-12 02:21:19 +00:00
|
|
|
template <typename T>
|
|
|
|
vm_distance &operator+=(const T &rhs)
|
|
|
|
{
|
|
|
|
return *this = (*this + rhs);
|
|
|
|
}
|
|
|
|
template <typename T>
|
|
|
|
vm_distance &operator*=(const T &rhs)
|
|
|
|
{
|
|
|
|
return *this = (*this * rhs);
|
|
|
|
}
|
|
|
|
template <typename T>
|
|
|
|
vm_distance &operator/=(const T &rhs)
|
|
|
|
{
|
|
|
|
return *this = (*this / rhs);
|
|
|
|
}
|
|
|
|
constexpr vm_distance operator+(const vm_distance &rhs) const
|
|
|
|
{
|
|
|
|
return vm_distance{d + rhs.d};
|
|
|
|
}
|
|
|
|
constexpr vm_distance operator*(const int &f) const
|
|
|
|
{
|
|
|
|
return vm_distance{d * f};
|
|
|
|
}
|
|
|
|
constexpr vm_distance operator/(const int &f) const
|
|
|
|
{
|
|
|
|
return vm_distance{d / f};
|
|
|
|
}
|
|
|
|
constexpr bool operator<(const fix &f) const
|
|
|
|
{
|
|
|
|
return d < f;
|
|
|
|
}
|
|
|
|
constexpr bool operator<(const vm_distance &rhs) const
|
|
|
|
{
|
|
|
|
return d < rhs.d;
|
|
|
|
}
|
2016-01-27 04:01:55 +00:00
|
|
|
/* Clang chokes using a template operator> to swap the arguments.
|
|
|
|
* Use a non-template operator> for the one needed type.
|
|
|
|
*/
|
|
|
|
constexpr bool operator>(const fix &f) const
|
|
|
|
{
|
|
|
|
return d > f;
|
|
|
|
}
|
2015-03-12 02:21:19 +00:00
|
|
|
template <typename T>
|
2016-01-27 04:01:55 +00:00
|
|
|
bool operator>(const T &t) const = delete;
|
2015-03-12 02:21:19 +00:00
|
|
|
constexpr explicit operator bool() const { return d; }
|
2016-02-02 03:10:53 +00:00
|
|
|
#ifndef __clang__
|
|
|
|
/* When this catch-all overload is defined, clang becomes confused
|
|
|
|
* and treats all arithmetic operations as ambiguous because it
|
|
|
|
* cannot choose between the deleted template function and the
|
|
|
|
* non-deleted operator fix().
|
|
|
|
*/
|
2015-03-12 02:21:19 +00:00
|
|
|
template <typename T>
|
|
|
|
operator T() const = delete;
|
2016-02-02 03:10:53 +00:00
|
|
|
#endif
|
2015-03-12 02:21:19 +00:00
|
|
|
constexpr operator fix() const
|
|
|
|
{
|
|
|
|
return d;
|
|
|
|
}
|
2015-03-26 02:42:26 +00:00
|
|
|
constexpr vm_distance_squared operator*(const vm_distance &) const;
|
2015-03-12 02:21:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class vm_magnitude : public vm_distance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
constexpr explicit vm_magnitude(const uint32_t &f) :
|
|
|
|
vm_distance(f)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class vm_distance_squared
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
fix64 d2;
|
2017-02-11 21:42:43 +00:00
|
|
|
vm_distance_squared(const fix &) = delete;
|
2015-03-12 02:21:19 +00:00
|
|
|
constexpr explicit vm_distance_squared(const fix64 &f2) :
|
|
|
|
d2(f2)
|
|
|
|
{
|
|
|
|
}
|
2015-03-12 02:21:19 +00:00
|
|
|
constexpr bool operator<(const vm_distance_squared &rhs) const
|
|
|
|
{
|
|
|
|
return d2 < rhs.d2;
|
|
|
|
}
|
|
|
|
constexpr bool operator>(const vm_distance_squared &rhs) const
|
|
|
|
{
|
|
|
|
return d2 > rhs.d2;
|
|
|
|
}
|
|
|
|
constexpr bool operator>=(const vm_distance_squared &rhs) const
|
|
|
|
{
|
|
|
|
return !(*this < rhs);
|
|
|
|
}
|
2015-03-12 02:21:19 +00:00
|
|
|
template <typename T>
|
2015-03-12 02:21:19 +00:00
|
|
|
vm_distance_squared &operator-=(const T &rhs)
|
|
|
|
{
|
|
|
|
return *this = (*this - rhs);
|
|
|
|
}
|
|
|
|
constexpr vm_distance_squared operator-(const fix &) const = delete;
|
|
|
|
constexpr vm_distance_squared operator-(const fix64 &f2) const
|
|
|
|
{
|
|
|
|
return vm_distance_squared{d2 - f2};
|
|
|
|
}
|
|
|
|
explicit operator bool() const { return d2; }
|
|
|
|
template <typename T>
|
|
|
|
constexpr operator T() const = delete;
|
2015-03-12 02:21:19 +00:00
|
|
|
constexpr operator fix64() const
|
|
|
|
{
|
|
|
|
return d2;
|
|
|
|
}
|
2015-03-12 02:21:20 +00:00
|
|
|
static constexpr vm_distance_squared maximum_value()
|
|
|
|
{
|
2017-02-22 03:05:43 +00:00
|
|
|
return vm_distance_squared{INT64_MAX};
|
2015-03-12 02:21:20 +00:00
|
|
|
}
|
|
|
|
static constexpr vm_distance_squared minimum_value()
|
|
|
|
{
|
2017-02-11 21:42:43 +00:00
|
|
|
return vm_distance_squared{static_cast<fix64>(0)};
|
2015-03-12 02:21:20 +00:00
|
|
|
}
|
2015-03-12 02:21:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class vm_magnitude_squared : public vm_distance_squared
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
constexpr explicit vm_magnitude_squared(const uint64_t &f2) :
|
2017-02-11 21:42:43 +00:00
|
|
|
vm_distance_squared(static_cast<fix64>(f2))
|
2015-03-12 02:21:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-03-26 02:42:26 +00:00
|
|
|
constexpr vm_distance_squared vm_distance::operator*(const vm_distance &rhs) const
|
2015-03-12 02:21:19 +00:00
|
|
|
{
|
2015-03-26 02:42:26 +00:00
|
|
|
return vm_distance_squared{static_cast<fix64>(static_cast<fix>(*this)) * static_cast<fix64>(static_cast<fix>(rhs))};
|
2015-03-12 02:21:19 +00:00
|
|
|
}
|
|
|
|
|
2014-07-24 03:25:00 +00:00
|
|
|
#define DEFINE_SERIAL_VMS_VECTOR_TO_MESSAGE() \
|
|
|
|
DEFINE_SERIAL_UDT_TO_MESSAGE(vms_vector, v, (v.x, v.y, v.z)); \
|
|
|
|
ASSERT_SERIAL_UDT_MESSAGE_SIZE(vms_vector, 12)
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
//Angle vector. Used to store orientations
|
2013-12-22 22:03:07 +00:00
|
|
|
struct vms_angvec
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
fixang p, b, h;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
//A 3x3 rotation matrix. Sorry about the numbering starting with one.
|
|
|
|
//Ordering is across then down, so <m1,m2,m3> is the first row
|
2013-12-22 22:03:07 +00:00
|
|
|
struct vms_matrix
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
vms_vector rvec, uvec, fvec;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-05-21 15:06:50 +00:00
|
|
|
// Quaternion structure
|
2013-12-22 22:03:07 +00:00
|
|
|
struct vms_quaternion
|
2012-05-21 15:06:50 +00:00
|
|
|
{
|
2012-05-26 15:53:07 +00:00
|
|
|
signed short w, x, y, z;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2012-05-21 15:06:50 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//Macros/functions to fill in fields of structures
|
|
|
|
|
|
|
|
//macro to set a vector to zero. we could do this with an in-line assembly
|
|
|
|
//macro, but it's probably better to let the compiler optimize it.
|
|
|
|
//Note: NO RETURN VALUE
|
2014-09-28 21:11:04 +00:00
|
|
|
static inline void vm_vec_zero(vms_vector &v)
|
2014-07-13 03:12:26 +00:00
|
|
|
{
|
2014-09-28 21:11:04 +00:00
|
|
|
v = {};
|
2014-07-13 03:12:26 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//macro set set a matrix to the identity. Note: NO RETURN VALUE
|
|
|
|
|
|
|
|
// DPH (18/9/98): Begin mod to fix linefeed problem under linux. Uses an
|
|
|
|
// inline function instead of a multi-line macro to fix CR/LF problems.
|
|
|
|
|
|
|
|
// DPH (19/8/98): End changes.
|
|
|
|
|
|
|
|
//Global constants
|
|
|
|
|
|
|
|
//Here's a handy constant
|
|
|
|
|
|
|
|
//negate a vector
|
2014-09-28 21:09:37 +00:00
|
|
|
static inline void vm_vec_negate(vms_vector &v)
|
2014-07-13 03:12:26 +00:00
|
|
|
{
|
2014-09-28 21:09:37 +00:00
|
|
|
v.x = -v.x;
|
|
|
|
v.y = -v.y;
|
|
|
|
v.z = -v.z;
|
2014-07-13 03:12:26 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-10-29 03:24:31 +00:00
|
|
|
static inline vms_vector vm_vec_negated(vms_vector v)
|
|
|
|
{
|
|
|
|
return vm_vec_negate(v), v;
|
|
|
|
}
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
//Functions in library
|
|
|
|
|
|
|
|
//adds two vectors, fills in dest, returns ptr to dest
|
|
|
|
//ok for dest to equal either source, but should use vm_vec_add2() if so
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-10-30 03:11:06 +00:00
|
|
|
static inline vms_vector vm_vec_add (const vms_vector &src0, const vms_vector &src1)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_add(dest, src0, src1), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
//subs two vectors, fills in dest, returns ptr to dest
|
|
|
|
//ok for dest to equal either source, but should use vm_vec_sub2() if so
|
2015-07-25 23:10:47 +00:00
|
|
|
static inline vms_vector &vm_vec_sub(vms_vector &dest, const vms_vector &src0, const vms_vector &src1)
|
|
|
|
{
|
2015-07-29 03:05:28 +00:00
|
|
|
#ifdef DXX_CONSTANT_TRUE
|
|
|
|
if (DXX_CONSTANT_TRUE(&src0 == &src1))
|
2015-07-25 23:10:47 +00:00
|
|
|
DXX_ALWAYS_ERROR_FUNCTION(vm_vec_sub_same_op, "vm_vec_sub with &src0 == &src1");
|
2015-07-29 03:05:28 +00:00
|
|
|
else if (DXX_CONSTANT_TRUE(src0.x == src1.x && src0.y == src1.y && src0.z == src1.z))
|
2015-07-25 23:10:47 +00:00
|
|
|
DXX_ALWAYS_ERROR_FUNCTION(vm_vec_sub_same_values, "vm_vec_sub with equal value inputs");
|
|
|
|
#endif
|
|
|
|
return _vm_vec_sub(dest, src0, src1);
|
|
|
|
}
|
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-10-29 03:24:31 +00:00
|
|
|
static inline vms_vector vm_vec_sub (const vms_vector &src0, const vms_vector &src1)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_sub(dest, src0, src1), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//averages two vectors. returns ptr to dest
|
|
|
|
//dest can equal either source
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-10-30 03:18:38 +00:00
|
|
|
static inline vms_vector vm_vec_avg (const vms_vector &src0, const vms_vector &src1)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_avg(dest, src0, src1), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//scales and copies a vector. returns ptr to dest
|
2015-04-29 03:35:09 +00:00
|
|
|
#define vm_vec_copy_scale(A,B,...) vm_vec_copy_scale(A, ## __VA_ARGS__, B)
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-02 03:43:47 +00:00
|
|
|
static inline vms_vector vm_vec_copy_scale(vms_vector src, fix s)
|
|
|
|
{
|
|
|
|
return vm_vec_scale(src, s), src;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//scales a vector, adds it to another, and stores in a 3rd vector
|
|
|
|
//dest = src1 + k * src2
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-02 03:43:57 +00:00
|
|
|
static inline vms_vector vm_vec_scale_add(const vms_vector &src1, const vms_vector &src2, fix k)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_scale_add(dest, src1, src2, k), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-10-29 03:24:31 +00:00
|
|
|
static inline vms_vector vm_vec_normalized(vms_vector v)
|
|
|
|
{
|
|
|
|
return vm_vec_normalize(v), v;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-10-29 03:24:31 +00:00
|
|
|
static inline vms_vector vm_vec_normalized_quick(vms_vector v)
|
|
|
|
{
|
|
|
|
return vm_vec_normalize_quick(v), v;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-02 03:44:12 +00:00
|
|
|
static inline vms_vector vm_vec_cross(const vms_vector &src0, const vms_vector &src1)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_cross(dest, src0, src1), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-01 03:17:48 +00:00
|
|
|
static inline vms_vector vm_vec_normal(const vms_vector &p0, const vms_vector &p1, const vms_vector &p2)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_normal(dest, p0, p1, p2), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-02 03:44:27 +00:00
|
|
|
static inline vms_vector vm_vec_perp (const vms_vector &p0, const vms_vector &p1, const vms_vector &p2)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_perp(dest, p0, p1, p2), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-04 01:24:08 +00:00
|
|
|
static inline vms_matrix vm_angles_2_matrix (const vms_angvec &a)
|
|
|
|
{
|
|
|
|
vms_matrix m;
|
|
|
|
return vm_angles_2_matrix(m, a), m;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-04 01:27:55 +00:00
|
|
|
static inline vms_matrix vm_vector_2_matrix (const vms_vector &fvec, const vms_vector *uvec, const vms_vector *rvec)
|
|
|
|
{
|
|
|
|
vms_matrix m;
|
|
|
|
return vm_vector_2_matrix(m, fvec, uvec, rvec), m;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-04 01:31:22 +00:00
|
|
|
static inline vms_vector vm_vec_rotate (const vms_vector &src, const vms_matrix &m)
|
|
|
|
{
|
|
|
|
vms_vector dest;
|
|
|
|
return vm_vec_rotate(dest, src, m), dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//transpose a matrix in place. returns ptr to matrix
|
2014-09-28 21:11:04 +00:00
|
|
|
static inline void vm_transpose_matrix(vms_matrix &m)
|
2014-07-13 17:37:41 +00:00
|
|
|
{
|
|
|
|
using std::swap;
|
2014-09-28 21:11:04 +00:00
|
|
|
swap(m.uvec.x, m.rvec.y);
|
|
|
|
swap(m.fvec.x, m.rvec.z);
|
|
|
|
swap(m.fvec.y, m.uvec.z);
|
2014-07-13 17:37:41 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-07-13 17:37:41 +00:00
|
|
|
static inline vms_matrix vm_transposed_matrix(vms_matrix m)
|
|
|
|
{
|
2014-09-28 21:11:04 +00:00
|
|
|
vm_transpose_matrix(m);
|
2014-07-13 17:37:41 +00:00
|
|
|
return m;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//mulitply 2 matrices, fill in dest. returns ptr to dest
|
2015-08-13 03:15:52 +00:00
|
|
|
static inline void vm_matrix_x_matrix(vms_matrix &dest, const vms_matrix &src0, const vms_matrix &src1)
|
|
|
|
{
|
|
|
|
#ifdef DXX_CONSTANT_TRUE
|
|
|
|
if (DXX_CONSTANT_TRUE(&dest == &src0))
|
|
|
|
DXX_ALWAYS_ERROR_FUNCTION(vm_matrix_x_matrix_dest_src0, "vm_matrix_x_matrix with &dest == &src0");
|
|
|
|
else if (DXX_CONSTANT_TRUE(&dest == &src1))
|
|
|
|
DXX_ALWAYS_ERROR_FUNCTION(vm_matrix_x_matrix_dest_src1, "vm_matrix_x_matrix with &dest == &src1");
|
|
|
|
#endif
|
|
|
|
assert(&dest != &src0);
|
|
|
|
assert(&dest != &src1);
|
|
|
|
return _vm_matrix_x_matrix(dest, src0, src1);
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-07-13 04:40:28 +00:00
|
|
|
static inline vms_matrix vm_matrix_x_matrix(const vms_matrix &src0, const vms_matrix &src1)
|
|
|
|
{
|
|
|
|
vms_matrix dest;
|
2014-10-01 02:28:42 +00:00
|
|
|
vm_matrix_x_matrix(dest, src0, src1);
|
2014-07-13 04:40:28 +00:00
|
|
|
return dest;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2021-06-28 03:37:51 +00:00
|
|
|
[[nodiscard]]
|
2014-11-04 01:32:43 +00:00
|
|
|
static inline vms_angvec vm_extract_angles_matrix (const vms_matrix &m)
|
|
|
|
{
|
|
|
|
vms_angvec a;
|
|
|
|
return vm_extract_angles_matrix(a, m), a;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//fills in fields of an angle vector
|
2014-07-13 03:12:26 +00:00
|
|
|
static inline void vm_angvec_make(vms_angvec *v, fixang p, fixang b, fixang h)
|
|
|
|
{
|
|
|
|
v->p = p;
|
|
|
|
v->b = b;
|
|
|
|
v->h = h;
|
|
|
|
}
|
2012-05-21 15:06:50 +00:00
|
|
|
|
2015-12-05 22:57:24 +00:00
|
|
|
}
|
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#endif
|