New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mathutils

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathutils - pypi Package Compare versions

Comparing version
2.74.1
to
2.76
+57
src/blenlib/BLI_math_bits.h
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_BITS_H__
#define __BLI_MATH_BITS_H__
/** \file BLI_math_bits.h
* \ingroup bli
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "BLI_math_inline.h"
MINLINE unsigned int highest_order_bit_i(unsigned int n);
MINLINE unsigned short highest_order_bit_s(unsigned short n);
#ifdef __GNUC__
# define count_bits_i(i) __builtin_popcount(i)
#else
MINLINE int count_bits_i(unsigned int n);
#endif
MINLINE int float_as_int(float f);
MINLINE unsigned int float_as_uint(float f);
MINLINE float int_as_float(int i);
MINLINE float uint_as_float(unsigned int i);
MINLINE float xor_fl(float x, int y);
#if BLI_MATH_DO_INLINE
#include "intern/math_bits_inline.c"
#endif
#ifdef __cplusplus
}
#endif
#endif /* __BLI_MATH_BITS_H__ */
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
*
* The Original Code is: all of this file.
*
* ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_SOLVERS_H__
#define __BLI_MATH_SOLVERS_H__
/** \file BLI_math_solvers.h
* \ingroup bli
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "BLI_compiler_attrs.h"
#include "BLI_math_inline.h"
#ifdef BLI_MATH_GCC_WARN_PRAGMA
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
/********************************** Eigen Solvers *********************************/
bool BLI_eigen_solve_selfadjoint_m3(const float m3[3][3], float r_eigen_values[3], float r_eigen_vectors[3][3]);
void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[], float r_V[3][3]);
/**************************** Inline Definitions ******************************/
#if 0 /* None so far. */
# if BLI_MATH_DO_INLINE
# include "intern/math_geom_inline.c"
# endif
#endif
#ifdef BLI_MATH_GCC_WARN_PRAGMA
# pragma GCC diagnostic pop
#endif
#ifdef __cplusplus
}
#endif
#endif /* __BLI_MATH_SOLVERS_H__ */
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
*
* The Original Code is: all of this file.
*
* ***** END GPL LICENSE BLOCK *****
* */
#ifndef __BLI_MATH_STATISTICS_H__
#define __BLI_MATH_STATISTICS_H__
/** \file BLI_math_statistics.h
* \ingroup bli
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "BLI_compiler_attrs.h"
#include "BLI_math_inline.h"
#ifdef BLI_MATH_GCC_WARN_PRAGMA
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
/********************************** Covariance Matrices *********************************/
void BLI_covariance_m_vn_ex(
const int n, const float *cos_vn, const int nbr_cos_v3, const float *center, const bool use_sample_correction,
float *r_covmat);
void BLI_covariance_m3_v3n(
const float (*cos_v3)[3], const int nbr_cos_v3, const bool use_sample_correction,
float r_covmat[3][3], float r_center[3]);
/**************************** Inline Definitions ******************************/
#if 0 /* None so far. */
# if BLI_MATH_DO_INLINE
# include "intern/math_geom_inline.c"
# endif
#endif
#ifdef BLI_MATH_GCC_WARN_PRAGMA
# pragma GCC diagnostic pop
#endif
#ifdef __cplusplus
}
#endif
#endif /* __BLI_MATH_STATISTICS_H__ */
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
* */
/** \file blender/blenlib/intern/math_bits_inline.c
* \ingroup bli
*/
#ifndef __MATH_BITS_INLINE_C__
#define __MATH_BITS_INLINE_C__
#include "BLI_math_bits.h"
MINLINE unsigned int highest_order_bit_i(unsigned int n)
{
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
n |= (n >> 16);
return n - (n >> 1);
}
MINLINE unsigned short highest_order_bit_s(unsigned short n)
{
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
return (unsigned short)(n - (n >> 1));
}
#ifndef __GNUC__
MINLINE int count_bits_i(unsigned int i)
{
/* variable-precision SWAR algorithm. */
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
#endif
MINLINE int float_as_int(float f)
{
union { int i; float f; } u;
u.f = f;
return u.i;
}
MINLINE unsigned int float_as_uint(float f)
{
union { unsigned int i; float f; } u;
u.f = f;
return u.i;
}
MINLINE float int_as_float(int i)
{
union { int i; float f; } u;
u.i = i;
return u.f;
}
MINLINE float uint_as_float(unsigned int i)
{
union { unsigned int i; float f; } u;
u.i = i;
return u.f;
}
MINLINE float xor_fl(float x, int y)
{
return int_as_float(float_as_int(x) ^ y);
}
#endif /* __MATH_BITS_INLINE_C__ */
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/generic/py_capi_utils.c
* \ingroup pygen
*
* Extend upon CPython's API, filling in some gaps, these functions use PyC_
* prefix to distinguish them apart from CPython.
*
* \note
* This module should only depend on CPython, however it currently uses
* BLI_string_utf8() for unicode conversion.
*/
#include <Python.h>
#include <frameobject.h>
#include "BLI_utildefines.h" /* for bool */
#include "py_capi_utils.h"
#include "python_utildefines.h"
#ifndef MATH_STANDALONE
/* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */
#include "BLI_string_utf8.h"
#endif
#ifdef _WIN32
#include "BLI_path_util.h" /* BLI_setenv() */
#include "BLI_math_base.h" /* finite() */
#endif
/* array utility function */
int PyC_AsArray_FAST(
void *array, PyObject *value_fast, const Py_ssize_t length,
const PyTypeObject *type, const bool is_double, const char *error_prefix)
{
const Py_ssize_t value_len = PySequence_Fast_GET_SIZE(value_fast);
PyObject **value_fast_items = PySequence_Fast_ITEMS(value_fast);
Py_ssize_t i;
BLI_assert(PyList_Check(value_fast) || PyTuple_Check(value_fast));
if (value_len != length) {
PyErr_Format(PyExc_TypeError,
"%.200s: invalid sequence length. expected %d, got %d",
error_prefix, length, value_len);
return -1;
}
/* for each type */
if (type == &PyFloat_Type) {
if (is_double) {
double *array_double = array;
for (i = 0; i < length; i++) {
array_double[i] = PyFloat_AsDouble(value_fast_items[i]);
}
}
else {
float *array_float = array;
for (i = 0; i < length; i++) {
array_float[i] = PyFloat_AsDouble(value_fast_items[i]);
}
}
}
else if (type == &PyLong_Type) {
/* could use is_double for 'long int' but no use now */
int *array_int = array;
for (i = 0; i < length; i++) {
array_int[i] = PyLong_AsLong(value_fast_items[i]);
}
}
else if (type == &PyBool_Type) {
int *array_bool = array;
for (i = 0; i < length; i++) {
array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0);
}
}
else {
PyErr_Format(PyExc_TypeError,
"%s: internal error %s is invalid",
error_prefix, type->tp_name);
return -1;
}
if (PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError,
"%s: one or more items could not be used as a %s",
error_prefix, type->tp_name);
return -1;
}
return 0;
}
int PyC_AsArray(
void *array, PyObject *value, const Py_ssize_t length,
const PyTypeObject *type, const bool is_double, const char *error_prefix)
{
PyObject *value_fast;
int ret;
if (!(value_fast = PySequence_Fast(value, error_prefix))) {
return -1;
}
ret = PyC_AsArray_FAST(array, value_fast, length, type, is_double, error_prefix);
Py_DECREF(value_fast);
return ret;
}
/* array utility function */
PyObject *PyC_FromArray(const void *array, int length, const PyTypeObject *type,
const bool is_double, const char *error_prefix)
{
PyObject *tuple;
int i;
tuple = PyTuple_New(length);
/* for each type */
if (type == &PyFloat_Type) {
if (is_double) {
const double *array_double = array;
for (i = 0; i < length; ++i) {
PyTuple_SET_ITEM(tuple, i, PyFloat_FromDouble(array_double[i]));
}
}
else {
const float *array_float = array;
for (i = 0; i < length; ++i) {
PyTuple_SET_ITEM(tuple, i, PyFloat_FromDouble(array_float[i]));
}
}
}
else if (type == &PyLong_Type) {
/* could use is_double for 'long int' but no use now */
const int *array_int = array;
for (i = 0; i < length; ++i) {
PyTuple_SET_ITEM(tuple, i, PyLong_FromLong(array_int[i]));
}
}
else if (type == &PyBool_Type) {
const int *array_bool = array;
for (i = 0; i < length; ++i) {
PyTuple_SET_ITEM(tuple, i, PyBool_FromLong(array_bool[i]));
}
}
else {
Py_DECREF(tuple);
PyErr_Format(PyExc_TypeError,
"%s: internal error %s is invalid",
error_prefix, type->tp_name);
return NULL;
}
return tuple;
}
/**
* Caller needs to ensure tuple is uninitialized.
* Handy for filling a typle with None for eg.
*/
void PyC_Tuple_Fill(PyObject *tuple, PyObject *value)
{
unsigned int tot = PyTuple_GET_SIZE(tuple);
unsigned int i;
for (i = 0; i < tot; i++) {
PyTuple_SET_ITEM(tuple, i, value);
Py_INCREF(value);
}
}
void PyC_List_Fill(PyObject *list, PyObject *value)
{
unsigned int tot = PyList_GET_SIZE(list);
unsigned int i;
for (i = 0; i < tot; i++) {
PyList_SET_ITEM(list, i, value);
Py_INCREF(value);
}
}
/**
* Use with PyArg_ParseTuple's "O&" formatting.
*/
int PyC_ParseBool(PyObject *o, void *p)
{
bool *bool_p = p;
long value;
if (((value = PyLong_AsLong(o)) == -1) || !ELEM(value, 0, 1)) {
PyErr_Format(PyExc_ValueError,
"expected a bool or int (0/1), got %s",
Py_TYPE(o)->tp_name);
return 0;
}
*bool_p = value ? true : false;
return 1;
}
#ifndef MATH_STANDALONE
/* for debugging */
void PyC_ObSpit(const char *name, PyObject *var)
{
fprintf(stderr, "<%s> : ", name);
if (var == NULL) {
fprintf(stderr, "<NIL>");
}
else {
PyObject_Print(var, stderr, 0);
fprintf(stderr, " ref:%d ", (int)var->ob_refcnt);
fprintf(stderr, " ptr:%p", (void *)var);
fprintf(stderr, " type:");
if (Py_TYPE(var))
fprintf(stderr, "%s", Py_TYPE(var)->tp_name);
else
fprintf(stderr, "<NIL>");
}
fprintf(stderr, "\n");
}
void PyC_LineSpit(void)
{
const char *filename;
int lineno;
/* Note, allow calling from outside python (RNA) */
if (!PyC_IsInterpreterActive()) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
}
PyErr_Clear();
PyC_FileAndNum(&filename, &lineno);
fprintf(stderr, "%s:%d\n", filename, lineno);
}
void PyC_StackSpit(void)
{
/* Note, allow calling from outside python (RNA) */
if (!PyC_IsInterpreterActive()) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
}
else {
/* lame but handy */
PyGILState_STATE gilstate = PyGILState_Ensure();
PyRun_SimpleString("__import__('traceback').print_stack()");
PyGILState_Release(gilstate);
}
}
void PyC_FileAndNum(const char **filename, int *lineno)
{
PyFrameObject *frame;
if (filename) *filename = NULL;
if (lineno) *lineno = -1;
if (!(frame = PyThreadState_GET()->frame)) {
return;
}
/* when executing a script */
if (filename) {
*filename = _PyUnicode_AsString(frame->f_code->co_filename);
}
/* when executing a module */
if (filename && *filename == NULL) {
/* try an alternative method to get the filename - module based
* references below are all borrowed (double checked) */
PyObject *mod_name = PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
if (mod_name) {
PyObject *mod = PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
if (mod) {
*filename = PyModule_GetFilename(mod);
}
/* unlikely, fallback */
if (*filename == NULL) {
*filename = _PyUnicode_AsString(mod_name);
}
}
}
if (lineno) {
*lineno = PyFrame_GetLineNumber(frame);
}
}
void PyC_FileAndNum_Safe(const char **filename, int *lineno)
{
if (!PyC_IsInterpreterActive()) {
return;
}
PyC_FileAndNum(filename, lineno);
}
/* Would be nice if python had this built in */
PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
{
Py_ssize_t i;
PyObject *item = o;
const char *attr;
va_list vargs;
va_start(vargs, n);
for (i = 0; i < n; i++) {
attr = va_arg(vargs, char *);
item = PyObject_GetAttrString(item, attr);
if (item)
Py_DECREF(item);
else /* python will set the error value here */
break;
}
va_end(vargs);
Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
return item;
}
PyObject *PyC_FrozenSetFromStrings(const char **strings)
{
const char **str;
PyObject *ret;
ret = PyFrozenSet_New(NULL);
for (str = strings; *str; str++) {
PyObject *py_str = PyUnicode_FromString(*str);
PySet_Add(ret, py_str);
Py_DECREF(py_str);
}
return ret;
}
/* similar to PyErr_Format(),
*
* implementation - we cant actually preprend the existing exception,
* because it could have _any_ arguments given to it, so instead we get its
* __str__ output and raise our own exception including it.
*/
PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...)
{
PyObject *error_value_prefix;
va_list args;
va_start(args, format);
error_value_prefix = PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
va_end(args);
if (PyErr_Occurred()) {
PyObject *error_type, *error_value, *error_traceback;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Format(exception_type_prefix,
"%S, %.200s(%S)",
error_value_prefix,
Py_TYPE(error_value)->tp_name,
error_value
);
}
else {
PyErr_SetObject(exception_type_prefix,
error_value_prefix
);
}
Py_XDECREF(error_value_prefix);
/* dumb to always return NULL but matches PyErr_Format */
return NULL;
}
/* returns the exception string as a new PyUnicode object, depends on external traceback module */
#if 0
/* this version uses traceback module but somehow fails on UI errors */
PyObject *PyC_ExceptionBuffer(void)
{
PyObject *traceback_mod = NULL;
PyObject *format_tb_func = NULL;
PyObject *ret = NULL;
if (!(traceback_mod = PyImport_ImportModule("traceback"))) {
goto error_cleanup;
}
else if (!(format_tb_func = PyObject_GetAttrString(traceback_mod, "format_exc"))) {
goto error_cleanup;
}
ret = PyObject_CallObject(format_tb_func, NULL);
if (ret == Py_None) {
Py_DECREF(ret);
ret = NULL;
}
error_cleanup:
/* could not import the module so print the error and close */
Py_XDECREF(traceback_mod);
Py_XDECREF(format_tb_func);
return ret;
}
#else /* verbose, non-threadsafe version */
PyObject *PyC_ExceptionBuffer(void)
{
PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
PyObject *string_io = NULL;
PyObject *string_io_buf = NULL;
PyObject *string_io_mod = NULL;
PyObject *string_io_getvalue = NULL;
PyObject *error_type, *error_value, *error_traceback;
if (!PyErr_Occurred())
return NULL;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
PyErr_Clear();
/* import io
* string_io = io.StringIO()
*/
if (!(string_io_mod = PyImport_ImportModule("io"))) {
goto error_cleanup;
}
else if (!(string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
goto error_cleanup;
}
else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
goto error_cleanup;
}
Py_INCREF(stdout_backup); // since these were borrowed we don't want them freed when replaced.
Py_INCREF(stderr_backup);
PySys_SetObject("stdout", string_io); // both of these are freed when restoring
PySys_SetObject("stderr", string_io);
PyErr_Restore(error_type, error_value, error_traceback);
PyErr_Print(); /* print the error */
PyErr_Clear();
string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
PySys_SetObject("stdout", stdout_backup);
PySys_SetObject("stderr", stderr_backup);
Py_DECREF(stdout_backup); /* now sys owns the ref again */
Py_DECREF(stderr_backup);
Py_DECREF(string_io_mod);
Py_DECREF(string_io_getvalue);
Py_DECREF(string_io); /* free the original reference */
PyErr_Clear();
return string_io_buf;
error_cleanup:
/* could not import the module so print the error and close */
Py_XDECREF(string_io_mod);
Py_XDECREF(string_io);
PyErr_Restore(error_type, error_value, error_traceback);
PyErr_Print(); /* print the error */
PyErr_Clear();
return NULL;
}
#endif
PyObject *PyC_ExceptionBuffer_Simple(void)
{
PyObject *string_io_buf;
PyObject *error_type, *error_value, *error_traceback;
if (!PyErr_Occurred())
return NULL;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
if (error_value == NULL) {
return NULL;
}
string_io_buf = PyObject_Str(error_value);
/* Python does this too */
if (UNLIKELY(string_io_buf == NULL)) {
string_io_buf = PyUnicode_FromFormat(
"<unprintable %s object>", Py_TYPE(error_value)->tp_name);
}
PyErr_Restore(error_type, error_value, error_traceback);
PyErr_Print();
PyErr_Clear();
return string_io_buf;
}
/* string conversion, escape non-unicode chars, coerce must be set to NULL */
const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
{
const char *result;
result = _PyUnicode_AsString(py_str);
if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
return result;
}
else {
PyErr_Clear();
if (PyBytes_Check(py_str)) {
return PyBytes_AS_STRING(py_str);
}
else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) {
return PyBytes_AS_STRING(*coerce);
}
else {
/* leave error raised from EncodeFS */
return NULL;
}
}
}
PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
{
PyObject *result = PyUnicode_FromStringAndSize(str, size);
if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
return result;
}
else {
PyErr_Clear();
/* this means paths will always be accessible once converted, on all OS's */
result = PyUnicode_DecodeFSDefaultAndSize(str, size);
return result;
}
}
PyObject *PyC_UnicodeFromByte(const char *str)
{
return PyC_UnicodeFromByteAndSize(str, strlen(str));
}
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
* note: dict is owned by sys.modules["__main__"] module, reference is borrowed
* note: important we use the dict from __main__, this is what python expects
* for 'pickle' to work as well as strings like this...
* >> foo = 10
* >> print(__import__("__main__").foo)
*
* note: this overwrites __main__ which gives problems with nested calls.
* be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is
* any chance that python is in the call stack.
****************************************************************************/
PyObject *PyC_DefaultNameSpace(const char *filename)
{
PyInterpreterState *interp = PyThreadState_GET()->interp;
PyObject *mod_main = PyModule_New("__main__");
PyDict_SetItemString(interp->modules, "__main__", mod_main);
Py_DECREF(mod_main); /* sys.modules owns now */
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
if (filename) {
/* __file__ mainly for nice UI'ness
* note: this wont map to a real file when executing text-blocks and buttons. */
PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename));
}
PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
Py_INCREF(interp->builtins); /* AddObject steals a reference */
return PyModule_GetDict(mod_main);
}
/* restore MUST be called after this */
void PyC_MainModule_Backup(PyObject **main_mod)
{
PyInterpreterState *interp = PyThreadState_GET()->interp;
*main_mod = PyDict_GetItemString(interp->modules, "__main__");
Py_XINCREF(*main_mod); /* don't free */
}
void PyC_MainModule_Restore(PyObject *main_mod)
{
PyInterpreterState *interp = PyThreadState_GET()->interp;
PyDict_SetItemString(interp->modules, "__main__", main_mod);
Py_XDECREF(main_mod);
}
/* must be called before Py_Initialize, expects output of BKE_appdir_folder_id(BLENDER_PYTHON, NULL) */
void PyC_SetHomePath(const char *py_path_bundle)
{
if (py_path_bundle == NULL) {
/* Common enough to have bundled *nix python but complain on OSX/Win */
#if defined(__APPLE__) || defined(_WIN32)
fprintf(stderr, "Warning! bundled python not found and is expected on this platform. "
"(if you built with CMake: 'install' target may have not been built)\n");
#endif
return;
}
/* set the environment path */
printf("found bundled python: %s\n", py_path_bundle);
#ifdef __APPLE__
/* OSX allow file/directory names to contain : character (represented as / in the Finder)
* but current Python lib (release 3.1.1) doesn't handle these correctly */
if (strchr(py_path_bundle, ':'))
printf("Warning : Blender application is located in a path containing : or / chars\
\nThis may make python import function fail\n");
#endif
#if 0 /* disable for now [#31506] - campbell */
#ifdef _WIN32
/* cmake/MSVC debug build crashes without this, why only
* in this case is unknown.. */
{
/*BLI_setenv("PYTHONPATH", py_path_bundle)*/;
}
#endif
#endif
{
static wchar_t py_path_bundle_wchar[1024];
/* cant use this, on linux gives bug: #23018, TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 22008 */
/* mbstowcs(py_path_bundle_wchar, py_path_bundle, FILE_MAXDIR); */
BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, ARRAY_SIZE(py_path_bundle_wchar));
Py_SetPythonHome(py_path_bundle_wchar);
// printf("found python (wchar_t) '%ls'\n", py_path_bundle_wchar);
}
}
bool PyC_IsInterpreterActive(void)
{
/* instead of PyThreadState_Get, which calls Py_FatalError */
return (PyThreadState_GetDict() != NULL);
}
/* Would be nice if python had this built in
* See: http://wiki.blender.org/index.php/Dev:Doc/Tools/Debugging/PyFromC
*/
void PyC_RunQuicky(const char *filepath, int n, ...)
{
FILE *fp = fopen(filepath, "r");
if (fp) {
PyGILState_STATE gilstate = PyGILState_Ensure();
va_list vargs;
int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2));
int i;
PyObject *py_dict = PyC_DefaultNameSpace(filepath);
PyObject *values = PyList_New(n / 2); /* namespace owns this, don't free */
PyObject *py_result, *ret;
PyObject *struct_mod = PyImport_ImportModule("struct");
PyObject *calcsize = PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
PyObject *pack = PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
PyObject *unpack = PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
Py_DECREF(struct_mod);
va_start(vargs, n);
for (i = 0; i * 2 < n; i++) {
const char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
ret = PyObject_CallFunction(calcsize, "s", format);
if (ret) {
sizes[i] = PyLong_AsLong(ret);
Py_DECREF(ret);
ret = PyObject_CallFunction(unpack, "sy#", format, (char *)ptr, sizes[i]);
}
if (ret == NULL) {
printf("%s error, line:%d\n", __func__, __LINE__);
PyErr_Print();
PyErr_Clear();
PyList_SET_ITEM(values, i, Py_INCREF_RET(Py_None)); /* hold user */
sizes[i] = 0;
}
else {
if (PyTuple_GET_SIZE(ret) == 1) {
/* convenience, convert single tuples into single values */
PyObject *tmp = PyTuple_GET_ITEM(ret, 0);
Py_INCREF(tmp);
Py_DECREF(ret);
ret = tmp;
}
PyList_SET_ITEM(values, i, ret); /* hold user */
}
}
va_end(vargs);
/* set the value so we can access it */
PyDict_SetItemString(py_dict, "values", values);
py_result = PyRun_File(fp, filepath, Py_file_input, py_dict, py_dict);
fclose(fp);
if (py_result) {
/* we could skip this but then only slice assignment would work
* better not be so strict */
values = PyDict_GetItemString(py_dict, "values");
if (values && PyList_Check(values)) {
/* don't use the result */
Py_DECREF(py_result);
py_result = NULL;
/* now get the values back */
va_start(vargs, n);
for (i = 0; i * 2 < n; i++) {
const char *format = va_arg(vargs, char *);
void *ptr = va_arg(vargs, void *);
PyObject *item;
PyObject *item_new;
/* prepend the string formatting and remake the tuple */
item = PyList_GET_ITEM(values, i);
if (PyTuple_CheckExact(item)) {
int ofs = PyTuple_GET_SIZE(item);
item_new = PyTuple_New(ofs + 1);
while (ofs--) {
PyObject *member = PyTuple_GET_ITEM(item, ofs);
PyTuple_SET_ITEM(item_new, ofs + 1, member);
Py_INCREF(member);
}
PyTuple_SET_ITEM(item_new, 0, PyUnicode_FromString(format));
}
else {
item_new = Py_BuildValue("sO", format, item);
}
ret = PyObject_Call(pack, item_new, NULL);
if (ret) {
/* copy the bytes back into memory */
memcpy(ptr, PyBytes_AS_STRING(ret), sizes[i]);
Py_DECREF(ret);
}
else {
printf("%s error on arg '%d', line:%d\n", __func__, i, __LINE__);
PyC_ObSpit("failed converting:", item_new);
PyErr_Print();
PyErr_Clear();
}
Py_DECREF(item_new);
}
va_end(vargs);
}
else {
printf("%s error, 'values' not a list, line:%d\n", __func__, __LINE__);
}
}
else {
printf("%s error line:%d\n", __func__, __LINE__);
PyErr_Print();
PyErr_Clear();
}
Py_DECREF(calcsize);
Py_DECREF(pack);
Py_DECREF(unpack);
PyMem_FREE(sizes);
PyGILState_Release(gilstate);
}
else {
fprintf(stderr, "%s: '%s' missing\n", __func__, filepath);
}
}
/* generic function to avoid depending on RNA */
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
{
PyObject *as_pointer;
PyObject *pointer;
if (STREQ(Py_TYPE(value)->tp_name, type_name) &&
(as_pointer = PyObject_GetAttrString(value, "as_pointer")) != NULL &&
PyCallable_Check(as_pointer))
{
void *result = NULL;
/* must be a 'type_name' object */
pointer = PyObject_CallObject(as_pointer, NULL);
Py_DECREF(as_pointer);
if (!pointer) {
PyErr_SetString(PyExc_SystemError, "value.as_pointer() failed");
return NULL;
}
result = PyLong_AsVoidPtr(pointer);
Py_DECREF(pointer);
if (!result) {
PyErr_SetString(PyExc_SystemError, "value.as_pointer() failed");
}
return result;
}
else {
PyErr_Format(PyExc_TypeError,
"expected '%.200s' type found '%.200s' instead",
type_name, Py_TYPE(value)->tp_name);
return NULL;
}
}
/* PyC_FlagSet_* functions - so flags/sets can be interchanged in a generic way */
#include "BLI_dynstr.h"
#include "MEM_guardedalloc.h"
char *PyC_FlagSet_AsString(PyC_FlagSet *item)
{
DynStr *dynstr = BLI_dynstr_new();
PyC_FlagSet *e;
char *cstring;
for (e = item; item->identifier; item++) {
BLI_dynstr_appendf(dynstr, (e == item) ? "'%s'" : ", '%s'", item->identifier);
}
cstring = BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
return cstring;
}
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *value)
{
for ( ; item->identifier; item++) {
if (STREQ(item->identifier, identifier)) {
*value = item->value;
return 1;
}
}
return 0;
}
int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int *value, const char *error_prefix)
{
if (PyC_FlagSet_ValueFromID_int(item, identifier, value) == 0) {
const char *enum_str = PyC_FlagSet_AsString(item);
PyErr_Format(PyExc_ValueError,
"%s: '%.200s' not found in (%s)",
error_prefix, identifier, enum_str);
MEM_freeN((void *)enum_str);
return -1;
}
return 0;
}
int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
{
/* set of enum items, concatenate all values with OR */
int ret, flag = 0;
/* set looping */
Py_ssize_t pos = 0;
Py_ssize_t hash = 0;
PyObject *key;
if (!PySet_Check(value)) {
PyErr_Format(PyExc_TypeError,
"%.200s expected a set, not %.200s",
error_prefix, Py_TYPE(value)->tp_name);
return -1;
}
*r_value = 0;
while (_PySet_NextEntry(value, &pos, &key, &hash)) {
const char *param = _PyUnicode_AsString(key);
if (param == NULL) {
PyErr_Format(PyExc_TypeError,
"%.200s set must contain strings, not %.200s",
error_prefix, Py_TYPE(key)->tp_name);
return -1;
}
if (PyC_FlagSet_ValueFromID(items, param, &ret, error_prefix) < 0) {
return -1;
}
flag |= ret;
}
*r_value = flag;
return 0;
}
PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag)
{
PyObject *ret = PySet_New(NULL);
PyObject *pystr;
for ( ; items->identifier; items++) {
if (items->value & flag) {
pystr = PyUnicode_FromString(items->identifier);
PySet_Add(ret, pystr);
Py_DECREF(pystr);
}
}
return ret;
}
/**
* \return -1 on error, else 0
*
* \note it is caller's responsibility to acquire & release GIL!
*/
int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename)
{
PyObject *py_dict, *mod, *retval;
int error_ret = 0;
PyObject *main_mod = NULL;
PyC_MainModule_Backup(&main_mod);
py_dict = PyC_DefaultNameSpace(filename);
mod = PyImport_ImportModule("math");
if (mod) {
PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - don't overwrite existing values */
Py_DECREF(mod);
}
else { /* highly unlikely but possibly */
PyErr_Print();
PyErr_Clear();
}
retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
if (retval == NULL) {
error_ret = -1;
}
else {
double val;
if (PyTuple_Check(retval)) {
/* Users my have typed in 10km, 2m
* add up all values */
int i;
val = 0.0;
for (i = 0; i < PyTuple_GET_SIZE(retval); i++) {
const double val_item = PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i));
if (val_item == -1 && PyErr_Occurred()) {
val = -1;
break;
}
val += val_item;
}
}
else {
val = PyFloat_AsDouble(retval);
}
Py_DECREF(retval);
if (val == -1 && PyErr_Occurred()) {
error_ret = -1;
}
else if (!finite(val)) {
*value = 0.0;
}
else {
*value = val;
}
}
PyC_MainModule_Restore(main_mod);
return error_ret;
}
#endif /* #ifndef MATH_STANDALONE */
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/python/generic/py_capi_utils.h
* \ingroup pygen
*/
#ifndef __PY_CAPI_UTILS_H__
#define __PY_CAPI_UTILS_H__
void PyC_ObSpit(const char *name, PyObject *var);
void PyC_LineSpit(void);
void PyC_StackSpit(void);
PyObject * PyC_ExceptionBuffer(void);
PyObject * PyC_ExceptionBuffer_Simple(void);
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
PyObject * PyC_FrozenSetFromStrings(const char **strings);
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
void PyC_FileAndNum(const char **filename, int *lineno);
void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
int PyC_AsArray_FAST(
void *array, PyObject *value_fast, const Py_ssize_t length,
const PyTypeObject *type, const bool is_double, const char *error_prefix);
int PyC_AsArray(
void *array, PyObject *value, const Py_ssize_t length,
const PyTypeObject *type, const bool is_double, const char *error_prefix);
PyObject * PyC_FromArray(const void *array, int length, const PyTypeObject *type,
const bool is_double, const char *error_prefix);
void PyC_Tuple_Fill(PyObject *tuple, PyObject *value);
void PyC_List_Fill(PyObject *list, PyObject *value);
/* follow http://www.python.org/dev/peps/pep-0383/ */
PyObject * PyC_UnicodeFromByte(const char *str);
PyObject * PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size);
const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
/* name namespace function for bpy & bge */
PyObject * PyC_DefaultNameSpace(const char *filename);
void PyC_RunQuicky(const char *filepath, int n, ...);
void PyC_MainModule_Backup(PyObject **main_mod);
void PyC_MainModule_Restore(PyObject *main_mod);
void PyC_SetHomePath(const char *py_path_bundle);
bool PyC_IsInterpreterActive(void);
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);
/* flag / set --- interchange */
typedef struct PyC_FlagSet {
int value;
const char *identifier;
} PyC_FlagSet;
char *PyC_FlagSet_AsString(PyC_FlagSet *item);
int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *value);
int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int *value, const char *error_prefix);
int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix);
PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag);
int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename);
int PyC_ParseBool(PyObject *o, void *p);
#endif /* __PY_CAPI_UTILS_H__ */
+11
-0

@@ -5,2 +5,8 @@

set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:Debug>:DEBUG;_DEBUG>
$<$<CONFIG:Release>:NDEBUG>
$<$<CONFIG:MinSizeRel>:NDEBUG>
$<$<CONFIG:RelWithDebInfo>:NDEBUG>
)

@@ -87,2 +93,3 @@ cmake_policy(SET CMP0003 NEW)

src/blenlib/intern/math_base_inline.c
src/blenlib/intern/math_bits_inline.c
src/blenlib/intern/math_color.c

@@ -101,2 +108,3 @@ src/blenlib/intern/math_geom.c

src/blenlib/BLI_math_base.h
src/blenlib/BLI_math_bits.h
src/blenlib/BLI_math_color.h

@@ -109,2 +117,3 @@ src/blenlib/BLI_math_color_blend.h

src/blenlib/BLI_math_rotation.h
src/blenlib/BLI_math_solvers.h
src/blenlib/BLI_math_vector.h

@@ -147,2 +156,4 @@ src/blenlib/BLI_strict_flags.h

src/generic/py_capi_utils.c
src/generic/py_capi_utils.h
src/generic/python_utildefines.h

@@ -149,0 +160,0 @@ )

+1
-1
Metadata-Version: 1.0
Name: mathutils
Version: 2.74.1
Version: 2.76
Summary: A general math utilities library providing Matrix, Vector, Quaternion, Euler and Color classes, written in C for speed.

@@ -5,0 +5,0 @@ Home-page: https://gitlab.com/ideasman42/blender-mathutils

@@ -14,2 +14,3 @@ CMakeLists.txt

src/blenlib/BLI_math_base.h
src/blenlib/BLI_math_bits.h
src/blenlib/BLI_math_color.h

@@ -22,2 +23,4 @@ src/blenlib/BLI_math_color_blend.h

src/blenlib/BLI_math_rotation.h
src/blenlib/BLI_math_solvers.h
src/blenlib/BLI_math_statistics.h
src/blenlib/BLI_math_vector.h

@@ -29,2 +32,3 @@ src/blenlib/BLI_strict_flags.h

src/blenlib/intern/math_base_inline.c
src/blenlib/intern/math_bits_inline.c
src/blenlib/intern/math_color.c

@@ -38,2 +42,4 @@ src/blenlib/intern/math_color_inline.c

src/blenlib/intern/math_vector_inline.c
src/generic/py_capi_utils.c
src/generic/py_capi_utils.h
src/generic/python_utildefines.h

@@ -40,0 +46,0 @@ src/mathutils/mathutils.c

Metadata-Version: 1.0
Name: mathutils
Version: 2.74.1
Version: 2.76
Summary: A general math utilities library providing Matrix, Vector, Quaternion, Euler and Color classes, written in C for speed.

@@ -5,0 +5,0 @@ Home-page: https://gitlab.com/ideasman42/blender-mathutils

[egg_info]
tag_build =
tag_svn_revision = 0
tag_date = 0
tag_svn_revision = 0

@@ -14,3 +14,2 @@ import distutils.ccompiler

desc = """\

@@ -33,3 +32,3 @@ blender-mathutils module

code in blender to allow non blender related projects to make use of it. A link
to the blender repository is used so the source never gets out of sync.
to the blender repository is used so the source never gets out of sync.
"""

@@ -50,2 +49,3 @@

"src/blenlib/intern/math_base_inline.c",
"src/blenlib/intern/math_bits_inline.c",
"src/blenlib/intern/math_color.c",

@@ -69,2 +69,5 @@ "src/blenlib/intern/math_color_inline.c",

"src/mathutils/mathutils_interpolate.c",
# * pygeneric *
"src/generic/py_capi_utils.c",
]

@@ -85,2 +88,3 @@

"src/blenlib/BLI_math_base.h",
"src/blenlib/BLI_math_bits.h",
"src/blenlib/BLI_math_color.h",

@@ -93,2 +97,3 @@ "src/blenlib/BLI_math_color_blend.h",

"src/blenlib/BLI_math_rotation.h",
"src/blenlib/BLI_math_solvers.h",
"src/blenlib/BLI_math_vector.h",

@@ -113,2 +118,3 @@ "src/blenlib/BLI_memarena.h",

# * pygeneric *
"src/generic/py_capi_utils.h",
"src/generic/python_utildefines.h",

@@ -126,3 +132,3 @@ ]

setup(name="mathutils",
version="2.74.1",
version="2.76",
maintainer="Campbell Barton",

@@ -129,0 +135,0 @@ maintainer_email="ideasman42@gmail.com",

@@ -40,3 +40,3 @@ /*

#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
#if defined(__cplusplus) && ((__cplusplus >= 201103L) || defined(_MSC_VER))
# define HAS_CPP11_FEATURES

@@ -43,0 +43,0 @@ #endif

@@ -384,2 +384,301 @@ /*

/**
* GENERIC_TYPE_ANY: handy macro to reuse a single expression for multiple types, eg:
*
* \code{.c}
* _Generic(value,
* GENERIC_TYPE_ANY(result_a, Foo *, Bar *, Baz *),
* GENERIC_TYPE_ANY(result_b, Spam *, Spaz *, Spot *),
* )
* \endcode
*
* excuse ridiculously long generated args.
* \code{.py}
* for i in range(63):
* args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)]
* print("#define _VA_GENERIC_TYPE_ANY%d(r, %s) \\" % (i + 2, ", ".join(args)))
* print(" %s: r " % (": r, ".join(args)))
* \endcode
*/
#define _VA_GENERIC_TYPE_ANY2(r, a0) \
a0: r
#define _VA_GENERIC_TYPE_ANY3(r, a0, b0) \
a0: r, b0: r
#define _VA_GENERIC_TYPE_ANY4(r, a0, b0, c0) \
a0: r, b0: r, c0: r
#define _VA_GENERIC_TYPE_ANY5(r, a0, b0, c0, d0) \
a0: r, b0: r, c0: r, d0: r
#define _VA_GENERIC_TYPE_ANY6(r, a0, b0, c0, d0, e0) \
a0: r, b0: r, c0: r, d0: r, e0: r
#define _VA_GENERIC_TYPE_ANY7(r, a0, b0, c0, d0, e0, f0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r
#define _VA_GENERIC_TYPE_ANY8(r, a0, b0, c0, d0, e0, f0, g0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r
#define _VA_GENERIC_TYPE_ANY9(r, a0, b0, c0, d0, e0, f0, g0, h0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r
#define _VA_GENERIC_TYPE_ANY10(r, a0, b0, c0, d0, e0, f0, g0, h0, i0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r
#define _VA_GENERIC_TYPE_ANY11(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r
#define _VA_GENERIC_TYPE_ANY12(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r
#define _VA_GENERIC_TYPE_ANY13(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r
#define _VA_GENERIC_TYPE_ANY14(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r
#define _VA_GENERIC_TYPE_ANY15(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r
#define _VA_GENERIC_TYPE_ANY16(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r
#define _VA_GENERIC_TYPE_ANY17(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r
#define _VA_GENERIC_TYPE_ANY18(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r
#define _VA_GENERIC_TYPE_ANY19(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r
#define _VA_GENERIC_TYPE_ANY20(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r
#define _VA_GENERIC_TYPE_ANY21(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r
#define _VA_GENERIC_TYPE_ANY22(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r
#define _VA_GENERIC_TYPE_ANY23(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r
#define _VA_GENERIC_TYPE_ANY24(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r
#define _VA_GENERIC_TYPE_ANY25(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r
#define _VA_GENERIC_TYPE_ANY26(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r
#define _VA_GENERIC_TYPE_ANY27(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r
#define _VA_GENERIC_TYPE_ANY28(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r
#define _VA_GENERIC_TYPE_ANY29(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r
#define _VA_GENERIC_TYPE_ANY30(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r
#define _VA_GENERIC_TYPE_ANY31(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r
#define _VA_GENERIC_TYPE_ANY32(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r
#define _VA_GENERIC_TYPE_ANY33(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r
#define _VA_GENERIC_TYPE_ANY34(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r
#define _VA_GENERIC_TYPE_ANY35(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r
#define _VA_GENERIC_TYPE_ANY36(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r
#define _VA_GENERIC_TYPE_ANY37(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r
#define _VA_GENERIC_TYPE_ANY38(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r
#define _VA_GENERIC_TYPE_ANY39(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r
#define _VA_GENERIC_TYPE_ANY40(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r
#define _VA_GENERIC_TYPE_ANY41(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r
#define _VA_GENERIC_TYPE_ANY42(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r
#define _VA_GENERIC_TYPE_ANY43(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r
#define _VA_GENERIC_TYPE_ANY44(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r
#define _VA_GENERIC_TYPE_ANY45(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r
#define _VA_GENERIC_TYPE_ANY46(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r
#define _VA_GENERIC_TYPE_ANY47(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r
#define _VA_GENERIC_TYPE_ANY48(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r
#define _VA_GENERIC_TYPE_ANY49(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r
#define _VA_GENERIC_TYPE_ANY50(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r
#define _VA_GENERIC_TYPE_ANY51(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r
#define _VA_GENERIC_TYPE_ANY52(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r
#define _VA_GENERIC_TYPE_ANY53(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r
#define _VA_GENERIC_TYPE_ANY54(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r
#define _VA_GENERIC_TYPE_ANY55(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r
#define _VA_GENERIC_TYPE_ANY56(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r
#define _VA_GENERIC_TYPE_ANY57(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r
#define _VA_GENERIC_TYPE_ANY58(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r
#define _VA_GENERIC_TYPE_ANY59(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r
#define _VA_GENERIC_TYPE_ANY60(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r
#define _VA_GENERIC_TYPE_ANY61(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r
#define _VA_GENERIC_TYPE_ANY62(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r
#define _VA_GENERIC_TYPE_ANY63(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r
#define _VA_GENERIC_TYPE_ANY64(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \
u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \
w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) \
a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \
q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \
g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \
w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r, k2: r
# define GENERIC_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_GENERIC_TYPE_ANY, __VA_ARGS__)
#endif /* __BLI_COMPILER_TYPECHECK_H__ */

@@ -93,3 +93,3 @@ /*

/* do not redefine functions from C99, POSIX.1-2001 or MSVC12 (partial C99) */
#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || defined(_MSC_VER))

@@ -200,2 +200,5 @@ #ifndef sqrtf

MINLINE int compare_ff(float a, float b, const float max_diff);
MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps);
MINLINE float signf(float f);

@@ -219,5 +222,3 @@ MINLINE int signum_i_ex(float a, float eps);

MINLINE unsigned int highest_order_bit_i(unsigned int n);
MINLINE unsigned short highest_order_bit_s(unsigned short n);
int pow_i(int base, int exp);
double double_round(double x, int ndigits);

@@ -224,0 +225,0 @@

@@ -83,9 +83,2 @@ /*

MINLINE float rgb_to_bw(const float rgb[3]);
MINLINE float rgb_to_grayscale(const float rgb[3]);
MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]);
MINLINE float rgb_to_luma(const float rgb[3]);
MINLINE unsigned char rgb_to_luma_byte(const unsigned char rgb[3]);
MINLINE float rgb_to_luma_y(const float rgb[3]);
/**************** Profile Transformations *****************/

@@ -140,2 +133,5 @@

MINLINE float rgb_to_grayscale(const float rgb[3]);
MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]);
MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], const int limit);

@@ -142,0 +138,0 @@

@@ -105,2 +105,8 @@ /*

/* plane3 versions */
float dist_signed_squared_to_plane3_v3(const float p[3], const float plane[4]);
float dist_squared_to_plane3_v3(const float p[3], const float plane[4]);
float dist_signed_to_plane3_v3(const float p[3], const float plane[4]);
float dist_to_plane3_v3(const float p[3], const float plane[4]);
float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);

@@ -117,3 +123,6 @@ float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);

void closest_to_line_segment_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3]);
void closest_to_plane_normalized_v3(float r_close[3], const float plane[4], const float pt[3]);
void closest_to_plane_v3(float r_close[3], const float plane[4], const float pt[3]);
void closest_to_plane3_normalized_v3(float r_close[3], const float plane[3], const float pt[3]);
void closest_to_plane3_v3(float r_close[3], const float plane[3], const float pt[3]);

@@ -123,5 +132,13 @@ /* Set 'r' to the point in triangle (t1, t2, t3) closest to point 'p' */

float line_point_factor_v3_ex(
const float p[3], const float l1[3], const float l2[3],
const float epsilon, const float fallback);
float line_point_factor_v3(
const float p[3], const float l1[3], const float l2[3]);
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]);
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]);
float line_point_factor_v2_ex(
const float p[2], const float l1[2], const float l2[2],
const float epsilon, const float fallback);
float line_point_factor_v2(
const float p[2], const float l1[2], const float l2[2]);

@@ -143,13 +160,18 @@ float line_plane_factor_v3(const float plane_co[3], const float plane_no[3],

int isect_line_line_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]);
int isect_seg_seg_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]);
int isect_seg_seg_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]);
int isect_seg_seg_v2_point(const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2]);
bool isect_seg_seg_v2_simple(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3]);
int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], const float r, float r_p1[2], float r_p2[2]);
int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]);
bool isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]);
int isect_line_line_v2_point(
const float v0[2], const float v1[2],
const float v2[2], const float v3[2],
float r_vi[2]);
int isect_line_line_epsilon_v3(
const float v1[3], const float v2[3],
const float v3[3], const float v4[3], float i1[3], float i2[3],
const float v3[3], const float v4[3],
float i1[3], float i2[3],
const float epsilon);

@@ -159,10 +181,12 @@ int isect_line_line_v3(

const float v3[3], const float v4[3],
float i1[3], float i2[3]);
bool isect_line_line_strict_v3(const float v1[3], const float v2[3],
const float v3[3], const float v4[3],
float vi[3], float *r_lambda);
float r_i1[3], float r_i2[3]);
bool isect_line_line_strict_v3(
const float v1[3], const float v2[3],
const float v3[3], const float v4[3],
float vi[3], float *r_lambda);
bool isect_ray_plane_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, const int clip);
bool isect_ray_plane_v3(
const float p1[3], const float d[3],
const float plane[4],
float *r_lambda, const bool clip);

@@ -173,19 +197,57 @@ bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]);

bool isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
const float plane_b_co[3], const float plane_b_no[3]) ATTR_WARN_UNUSED_RESULT;
bool isect_plane_plane_plane_v3(
const float plane_a[4], const float plane_b[4], const float plane_c[4],
float r_isect_co[3]) ATTR_WARN_UNUSED_RESULT;
bool isect_plane_plane_v3(
const float plane_a[4], const float plane_b[4],
float r_isect_co[3], float r_isect_no[3]) ATTR_WARN_UNUSED_RESULT;
/* line/ray triangle */
bool isect_line_tri_v3(const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]);
bool isect_line_tri_epsilon_v3(const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float epsilon);
bool isect_ray_tri_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]);
bool isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float threshold);
bool isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon);
bool isect_line_tri_v3(
const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2]);
bool isect_line_tri_epsilon_v3(
const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float epsilon);
bool isect_ray_tri_v3(
const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2]);
bool isect_ray_tri_threshold_v3(
const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float threshold);
bool isect_ray_tri_epsilon_v3(
const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float epsilon);
bool isect_tri_tri_epsilon_v3(
const float t_a0[3], const float t_a1[3], const float t_a2[3],
const float t_b0[3], const float t_b1[3], const float t_b2[3],
float r_i1[3], float r_i2[3],
const float epsilon);
/* water-tight raycast (requires pre-calculation) */
struct IsectRayPrecalc {
/* Maximal dimension kz, and orthogonal dimensions. */
int kx, ky, kz;
/* Shear constants. */
float sx, sy, sz;
};
void isect_ray_tri_watertight_v3_precalc(
struct IsectRayPrecalc *isect_precalc, const float dir[3]);
bool isect_ray_tri_watertight_v3(
const float P[3], const struct IsectRayPrecalc *isect_precalc,
const float v0[3], const float v1[3], const float v2[3],
float *r_dist, float r_uv[2]);
/* slower version which calculates IsectRayPrecalc each time */
bool isect_ray_tri_watertight_v3_simple(
const float P[3], const float dir[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2]);
/* point in polygon */

@@ -268,2 +330,3 @@ bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsigned int nr, const bool use_holes);

const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]);
float resolve_quad_u_v2(const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]);

@@ -303,2 +366,7 @@ /* use to find the point of a UV on a face */

void accumulate_vertex_normals_tri(
float n1[3], float n2[3], float n3[3],
const float f_no[3],
const float co1[3], const float co2[3], const float co3[3]);
void accumulate_vertex_normals(

@@ -355,2 +423,3 @@ float n1[3], float n2[3], float n3[3], float n4[3],

void axis_dominant_v3_to_m3_negate(float r_mat[3][3], const float normal[3]);
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3]);

@@ -357,0 +426,0 @@

@@ -49,5 +49,5 @@ /*

/* static inline __attribute__ here breaks osx ppc gcc42 build */
# define MALWAYS_INLINE static __attribute__((always_inline))
# define MALWAYS_INLINE static __attribute__((always_inline)) __attribute__((unused))
# else
# define MALWAYS_INLINE static inline __attribute__((always_inline))
# define MALWAYS_INLINE static inline __attribute__((always_inline)) __attribute__((unused))
# endif

@@ -54,0 +54,0 @@ # endif

@@ -109,2 +109,3 @@ /*

void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_v3_mat3_m4v3(float r[3], float M[4][4], const float v[3]);
void mul_m4_v4(float M[4][4], float r[4]);

@@ -156,6 +157,10 @@ void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);

void normalize_m3(float R[3][3]);
void normalize_m3_m3(float R[3][3], float A[3][3]);
void normalize_m4(float R[4][4]);
void normalize_m4_m4(float R[4][4], float A[4][4]);
void normalize_m3_ex(float R[3][3], float r_scale[3]) ATTR_NONNULL();
void normalize_m3(float R[3][3]) ATTR_NONNULL();
void normalize_m3_m3_ex(float R[3][3], float A[3][3], float r_scale[3]) ATTR_NONNULL();
void normalize_m3_m3(float R[3][3], float A[3][3]) ATTR_NONNULL();
void normalize_m4_ex(float R[4][4], float r_scale[3]) ATTR_NONNULL();
void normalize_m4(float R[4][4]) ATTR_NONNULL();
void normalize_m4_m4_ex(float R[4][4], float A[4][4], float r_scale[3]) ATTR_NONNULL();
void normalize_m4_m4(float R[4][4], float A[4][4]) ATTR_NONNULL();

@@ -219,2 +224,4 @@ void orthogonalize_m3(float R[3][3], int axis);

void mat3_polar_decompose(float mat3[3][3], float r_U[3][3], float r_P[3][3]);
void loc_eul_size_to_mat4(float R[4][4],

@@ -232,2 +239,5 @@ const float loc[3], const float eul[3], const float size[3]);

void interp_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], const float t);
void interp_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], const float t);
bool is_negative_m3(float mat[3][3]);

@@ -247,2 +257,3 @@ bool is_negative_m4(float mat[4][4]);

void BLI_space_transform_from_matrices(struct SpaceTransform *data, float local[4][4], float target[4][4]);
void BLI_space_transform_global_from_matrices(struct SpaceTransform *data, float local[4][4], float target[4][4]);
void BLI_space_transform_apply(const struct SpaceTransform *data, float co[3]);

@@ -249,0 +260,0 @@ void BLI_space_transform_invert(const struct SpaceTransform *data, float co[3]);

@@ -62,2 +62,4 @@ /*

void invert_qt_qt(float q1[4], const float q2[4]);
void invert_qt_normalized(float q[4]);
void invert_qt_qt_normalized(float q1[4], const float q2[4]);
void conjugate_qt(float q[4]);

@@ -81,2 +83,4 @@ void conjugate_qt_qt(float q1[4], const float q2[4]);

void mat3_normalized_to_quat(float q[4], float mat[3][3]);
void mat4_normalized_to_quat(float q[4], float mat[4][4]);
void mat3_to_quat(float q[4], float mat[3][3]);

@@ -117,5 +121,7 @@ void mat4_to_quat(float q[4], float mat[4][4]);

void quat_to_axis_angle(float axis[3], float *angle, const float q[4]);
void mat3_normalized_to_axis_angle(float axis[3], float *angle, float M[3][3]);
void mat4_normalized_to_axis_angle(float axis[3], float *angle, float M[4][4]);
void mat3_to_axis_angle(float axis[3], float *angle, float M[3][3]);
void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]);
void quat_to_axis_angle(float axis[3], float *angle, const float q[4]);

@@ -125,2 +131,4 @@ void axis_angle_to_mat3_single(float R[3][3], const char axis, const float angle);

void axis_angle_to_quat_single(float q[4], const char axis, const float angle);
/****************************** Exponential Map ******************************/

@@ -137,8 +145,12 @@ void quat_to_expmap(float expmap[3], const float q[4]);

void quat_to_eul(float eul[3], const float quat[4]);
void mat3_normalized_to_eul(float eul[3], float mat[3][3]);
void mat4_normalized_to_eul(float eul[3], float mat[4][4]);
void mat3_to_eul(float eul[3], float mat[3][3]);
void mat4_to_eul(float eul[3], float mat[4][4]);
void quat_to_eul(float eul[3], const float quat[4]);
void mat3_normalized_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]);
void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]);
void quat_to_compatible_eul(float eul[3], const float oldrot[3], const float quat[4]);
void compatible_eul(float eul[3], const float old[3]);
void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]);

@@ -168,10 +180,15 @@ void rotate_eul(float eul[3], const char axis, const float angle);

void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order);
void quat_to_eulO(float eul[3], const short order, const float quat[4]);
void mat3_normalized_to_eulO(float eul[3], const short order, float mat[3][3]);
void mat4_normalized_to_eulO(float eul[3], const short order, float mat[4][4]);
void mat3_to_eulO(float eul[3], const short order, float mat[3][3]);
void mat4_to_eulO(float eul[3], const short order, float mat[4][4]);
void quat_to_eulO(float eul[3], const short order, const float quat[4]);
void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle);
void mat3_normalized_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]);
void mat4_normalized_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]);
void mat3_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]);
void mat4_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]);
void quat_to_compatible_eulO(float eul[3], float old[3], const short order, const float quat[4]);

@@ -178,0 +195,0 @@ void rotate_eulO(float eul[3], const short order, char axis, float angle);

@@ -64,2 +64,6 @@ /*

/* unsigned char */
MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]);
MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3]);
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4]);
/* char */

@@ -69,3 +73,2 @@ MINLINE void copy_v2_v2_char(char r[2], const char a[2]);

MINLINE void copy_v4_v4_char(char r[4], const char a[4]);
/* short */

@@ -151,2 +154,9 @@ MINLINE void copy_v2_v2_short(short r[2], const short a[2]);

MINLINE void abs_v2(float r[2]);
MINLINE void abs_v2_v2(float r[2], const float a[2]);
MINLINE void abs_v3(float r[3]);
MINLINE void abs_v3_v3(float r[3], const float a[3]);
MINLINE void abs_v4(float r[4]);
MINLINE void abs_v4_v4(float r[4], const float a[4]);
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;

@@ -157,2 +167,4 @@ MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT;

MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT;
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;

@@ -238,10 +250,15 @@ MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);

MINLINE bool equals_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT;
MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v2v2(const float a[2], const float b[2], const float limit) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v4v4(const float a[4], const float b[4], const float limit) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v2v2_relative(const float a[2], const float b[2], const float limit, const int max_ulps) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v3v3_relative(const float a[3], const float b[3], const float limit, const int max_ulps) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v4v4_relative(const float a[4], const float b[4], const float limit, const int max_ulps) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_len_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_len_squared_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT;
MINLINE bool compare_v4v4(const float a[4], const float b[4], const float limit) ATTR_WARN_UNUSED_RESULT;
MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT;
MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT;

@@ -272,2 +289,4 @@

void project_v3_v3v3(float r[3], const float p[3], const float n[3]);
void project_plane_v3_v3v3(float c[3], const float v[3], const float v_plane[3]);
void project_plane_v2_v2v2(float c[2], const float v[2], const float v_plane[2]);
void project_v3_plane(float v[3], const float n[3], const float p[3]);

@@ -300,3 +319,3 @@ void reflect_v3_v3v3(float r[3], const float v[3], const float n[3]);

void minmax_v3v3_v3_array(float r_min[3], float r_max[3], float (*vec_arr)[3], int nbr);
void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float (*vec_arr)[3], int nbr);

@@ -309,3 +328,3 @@ void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist);

/***************************** Array Functions *******************************/
/* attempted to follow fixed length vertex functions. names could be improved*/
/* follow fixed length vector function conventions. */
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size) ATTR_WARN_UNUSED_RESULT;

@@ -316,2 +335,3 @@ double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESULT;

void range_vn_i(int *array_tar, const int size, const int start);
void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start);
void range_vn_fl(float *array_tar, const int size, const float start, const float step);

@@ -331,8 +351,12 @@ void negate_vn(float *array_tar, const int size);

void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size);
void fill_vn_i(int *array_tar, const int size, const int val);
void fill_vn_short(short *array_tar, const int size, const short val);
void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val);
void fill_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val);
void fill_vn_fl(float *array_tar, const int size, const float val);
void copy_vn_i(int *array_tar, const int size, const int val);
void copy_vn_short(short *array_tar, const int size, const short val);
void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val);
void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val);
void copy_vn_fl(float *array_tar, const int size, const float val);
void add_vn_vn_d(double *array_tar, const double *array_src, const int size);
void add_vn_vnvn_d(double *array_tar, const double *array_src_a, const double *array_src_b, const int size);
void mul_vn_db(double *array_tar, const int size, const double f);
/**************************** Inline Definitions ******************************/

@@ -339,0 +363,0 @@

@@ -33,15 +33,29 @@ /*

*
* - fl = float
* - db = double
* - v2 = vec2 = vector 2
* - v3 = vec3 = vector 3
* - v4 = vec4 = vector 4
* - qt = quat = quaternion
* - dq = dquat = dual quaternion
* - m2 = mat2 = matrix 2x2
* - m3 = mat3 = matrix 3x3
* - m4 = mat4 = matrix 4x4
* - eul = euler rotation
* - eulO = euler with order
* - ``fl`` = float
* - ``db`` = double
* - ``v2`` = vec2 = vector 2
* - ``v3`` = vec3 = vector 3
* - ``v4`` = vec4 = vector 4
* - ``vn`` = vec4 = vector N dimensions, *passed as an arg, after the vector*.
* - ``qt`` = quat = quaternion
* - ``dq`` = dquat = dual quaternion
* - ``m2`` = mat2 = matrix 2x2
* - ``m3`` = mat3 = matrix 3x3
* - ``m4`` = mat4 = matrix 4x4
* - ``eul`` = euler rotation
* - ``eulO`` = euler with order
* - ``plane`` = plane 4, (vec3, distance)
* - ``plane3`` = plane 3 (same as a ``plane`` with a zero 4th component)
*
* \subsection mathabbrev_all Function Type Abbreviations
*
* For non float versions of functions (which typically operate on floats),
* use single suffix abbreviations.
*
* - ``_d`` = double
* - ``_i`` = int
* - ``_u`` = unsigned int
* - ``_char`` = char
* - ``_uchar`` = unsigned char
*
* \section mathvarnames Variable Names

@@ -63,4 +77,5 @@ *

#include "BLI_math_interp.h"
#include "BLI_math_solvers.h"
#include "BLI_math_statistics.h"
#endif /* __BLI_MATH_H__ */

@@ -255,3 +255,3 @@ /*

#define FTOUSHORT(val) ((CHECK_TYPE_INLINE(val, float)), \
((val >= 1.0f - 0.5f / 65535) ? 65535 : (val <= 0.0f) ? 0 : (unsigned short)(val * 65535.0f + 0.5f)))
(unsigned short)((val >= 1.0f - 0.5f / 65535) ? 65535 : (val <= 0.0f) ? 0 : (val * 65535.0f + 0.5f)))
#define USHORTTOUCHAR(val) ((unsigned char)(((val) >= 65535 - 128) ? 255 : ((val) + 128) >> 8))

@@ -410,3 +410,3 @@ #define F3TOCHAR3(v2, v1) { \

#define IS_EQT(a, b, c) ((a > b) ? (((a - b) <= c) ? 1 : 0) : ((((b - a) <= c) ? 1 : 0)))
#define IS_EQT(a, b, c) ((a > b) ? ((((a) - (b)) <= c) ? 1 : 0) : (((((b) - (a)) <= c) ? 1 : 0)))
#define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0))

@@ -426,3 +426,3 @@ #define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0))

#define ARRAY_LAST_ITEM(arr_start, arr_dtype, tot) \
(arr_dtype *)((char *)arr_start + (sizeof(*((arr_dtype *)NULL)) * (size_t)(tot - 1)))
(arr_dtype *)((char *)(arr_start) + (sizeof(*((arr_dtype *)NULL)) * (size_t)(tot - 1)))

@@ -441,3 +441,3 @@ #define ARRAY_HAS_ITEM(arr_item, arr_start, tot) ( \

/* assuming a static array */
#if defined(__GNUC__) && !defined(__cplusplus)
#if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__)
# define ARRAY_SIZE(arr) \

@@ -490,6 +490,6 @@ ((sizeof(struct {int isnt_array : ((const void *)&(arr) == &(arr)[0]);}) * 0) + \

#define POINTER_OFFSET(v, ofs) \
((typeof(v))((char *)(v) + ofs))
((typeof(v))((char *)(v) + (ofs)))
#else
#define POINTER_OFFSET(v, ofs) \
((void *)((char *)(v) + ofs))
((void *)((char *)(v) + (ofs)))
#endif

@@ -501,4 +501,7 @@

/* memcpy, skipping the first part of a struct,
* ensures 'struct_dst' isn't const and that the offset can be computed at compile time */
/**
* memcpy helper, skipping the first part of a struct,
* ensures 'struct_dst' isn't const and the offset can be computed at compile time.
* This isn't inclusive, the value of \a member isn't copied.
*/
#define MEMCPY_STRUCT_OFS(struct_dst, struct_src, member) { \

@@ -512,2 +515,20 @@ CHECK_TYPE_NONCONST(struct_dst); \

#define MEMSET_STRUCT_OFS(struct_var, value, member) { \
CHECK_TYPE_NONCONST(struct_var); \
memset((char *)(struct_var) + OFFSETOF_STRUCT(struct_var, member), \
value, \
sizeof(*(struct_var)) - OFFSETOF_STRUCT(struct_var, member)); \
} (void)0
/* defined
* in memory_utils.c for now. I do not know where we should put it actually... */
#ifndef __BLI_MEMORY_UTILS_H__
extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size);
#endif
#define MEMCMP_STRUCT_OFS_IS_ZERO(struct_var, member) \
(BLI_memory_is_zero( \
(char *)(struct_var) + OFFSETOF_STRUCT(struct_var, member), \
sizeof(*(struct_var)) - OFFSETOF_STRUCT(struct_var, member)))
/* Warning-free macros for storing ints in pointers. Use these _only_

@@ -623,5 +644,5 @@ * for storing an int in a pointer, not a pointer in an int (64bit)! */

/* static inline __attribute__ here breaks osx ppc gcc42 build */
# define BLI_INLINE static __attribute__((always_inline))
# define BLI_INLINE static __attribute__((always_inline)) __attribute__((__unused__))
# else
# define BLI_INLINE static inline __attribute__((always_inline))
# define BLI_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__))
# endif

@@ -628,0 +649,0 @@ #endif

@@ -201,21 +201,2 @@ /*

MINLINE unsigned int highest_order_bit_i(unsigned int n)
{
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
n |= (n >> 16);
return n - (n >> 1);
}
MINLINE unsigned short highest_order_bit_s(unsigned short n)
{
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
return (unsigned short)(n - (n >> 1));
}
MINLINE float min_ff(float a, float b)

@@ -275,2 +256,42 @@ {

/**
* Almost-equal for IEEE floats, using absolute difference method.
*
* \param max_diff the maximum absolute difference.
*/
MINLINE int compare_ff(float a, float b, const float max_diff)
{
return fabsf(a - b) <= max_diff;
}
/**
* Almost-equal for IEEE floats, using their integer representation (mixing ULP and absolute difference methods).
*
* \param max_diff is the maximum absolute difference (allows to take care of the near-zero area,
* where relative difference methods cannot really work).
* \param max_ulps is the 'maximum number of floats + 1' allowed between \a a and \a b to consider them equal.
*
* \see https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
*/
MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps)
{
union {float f; int i;} ua, ub;
#if 0 /* No BLI_assert in INLINE :/ */
BLI_assert(sizeof(float) == sizeof(int));
BLI_assert(max_ulps < (1 << 22));
#endif
if (fabsf(a - b) <= max_diff) {
return 1;
}
ua.f = a;
ub.f = b;
/* Important to compare sign from integers, since (-0.0f < 0) is false
* (though this shall not be an issue in common cases)... */
return ((ua.i < 0) != (ub.i < 0)) ? 0 : (abs(ua.i - ub.i) <= max_ulps) ? 1 : 0;
}
MINLINE float signf(float f)

@@ -277,0 +298,0 @@ {

@@ -34,37 +34,16 @@ /*

/* WARNING: MSVC compiling hack for double_round() */
#if (defined(WIN32) || defined(WIN64)) && !(defined(FREE_WINDOWS))
/* from python 3.1 pymath.c */
double copysign(double x, double y)
int pow_i(int base, int exp)
{
/* use atan2 to distinguish -0.0 from 0.0 */
if (y > 0.0 || (y == 0.0 && atan2(y, -1.0) > 0.0)) {
return fabs(x);
int result = 1;
BLI_assert(exp >= 0);
while (exp) {
if (exp & 1) {
result *= base;
}
exp >>= 1;
base *= base;
}
else {
return -fabs(x);
}
}
/* from python 3.1 pymath.c */
double round(double x)
{
double absx, y;
absx = fabs(x);
y = floor(absx);
if (absx - y >= 0.5)
y += 1.0;
return copysign(y, x);
return result;
}
#else /* OpenSuse 11.1 seems to need this. */
# ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wredundant-decls"
# endif
double round(double x);
# ifdef __GNUC__
# pragma GCC diagnostic pop
# endif
#endif

@@ -71,0 +50,0 @@ /* from python 3.1 floatobject.c

@@ -203,24 +203,30 @@ /*

/* TODO:
/** \name RGB/Grayscale Functions
*
* regarding #rgb_to_bw vs #rgb_to_grayscale,
* it seems nobody knows why we have both functions which convert color to grays
* but with different influences, this is quite stupid, and should be resolved
* by someone who knows this stuff: see this thread
* http://lists.blender.org/pipermail/bf-committers/2012-June/037180.html
* \warning
* These are only an approximation,
* in almost _all_ cases, #IMB_colormanagement_get_luminance should be used instead.
* however for screen-only colors which don't depend on the currently loaded profile - this is preferred.
* Checking theme colors for contrast, etc. Basically anything outside the render pipeline.
*
* Only conclusion is that rgb_to_grayscale is used more for compositing.
* \{ */
/**
* ITU-R BT.709 primaries
* http://en.wikipedia.org/wiki/Relative_luminance
*
* Real values are:
* ``Y = 0.2126390059(R) + 0.7151686788(G) + 0.0721923154(B)``
* according to: "Derivation of Basic Television Color Equations", RP 177-1993
*
* As this sums slightly above 1.0, the document recommends to use:
* ``0.2126(R) + 0.7152(G) + 0.0722(B)``, as used here.
*
* The high precision values are used to calculate the rounded byte weights so they add up to 255:
* ``54(R) + 182(G) + 19(B)``
*/
MINLINE float rgb_to_bw(const float rgb[3])
{
return 0.35f * rgb[0] + 0.45f * rgb[1] + 0.2f * rgb[2];
}
/* non-linear luma from ITU-R BT.601-2
* see: http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC11
* note: the values used for are not exact matches to those documented above,
* but they are from the same */
MINLINE float rgb_to_grayscale(const float rgb[3])
{
return 0.3f * rgb[0] + 0.58f * rgb[1] + 0.12f * rgb[2];
return (0.2126f * rgb[0]) + (0.7152f * rgb[1]) + (0.0722f * rgb[2]);
}

@@ -230,30 +236,10 @@

{
return (unsigned char)(((76 * (unsigned short)rgb[0]) +
(148 * (unsigned short)rgb[1]) +
(31 * (unsigned short)rgb[2])) / 255);
return (unsigned char)(((54 * (unsigned short)rgb[0]) +
(182 * (unsigned short)rgb[1]) +
(19 * (unsigned short)rgb[2])) / 255);
}
/* luma from defined by 'YCC_JFIF', see #rgb_to_ycc */
MINLINE float rgb_to_luma(const float rgb[3])
{
return 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2];
}
/** \} */
MINLINE unsigned char rgb_to_luma_byte(const unsigned char rgb[3])
{
return (unsigned char)(((76 * (unsigned short)rgb[0]) +
(150 * (unsigned short)rgb[1]) +
(29 * (unsigned short)rgb[2])) / 255);
}
/* gamma-corrected RGB --> CIE XYZ
* for this function we only get the Y component
* see: http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch6/ch6_color_models.html
*
* also known as:
* luminance rec. 709 */
MINLINE float rgb_to_luma_y(const float rgb[3])
{
return 0.212671f * rgb[0] + 0.71516f * rgb[1] + 0.072169f * rgb[2];
}

@@ -260,0 +246,0 @@ MINLINE int compare_rgb_uchar(const unsigned char col_a[3], const unsigned char col_b[3], const int limit)

@@ -507,5 +507,16 @@ /*

void mul_v3_mat3_m4v3(float r[3], float mat[4][4], const float vec[3])
{
const float x = vec[0];
const float y = vec[1];
r[0] = x * mat[0][0] + y * mat[1][0] + mat[2][0] * vec[2];
r[1] = x * mat[0][1] + y * mat[1][1] + mat[2][1] * vec[2];
r[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2];
}
void mul_project_m4_v3(float mat[4][4], float vec[3])
{
const float w = mul_project_m4_v3_zfac(mat, vec);
/* absolute value to not flip the frustum upside down behind the camera */
const float w = fabsf(mul_project_m4_v3_zfac(mat, vec));
mul_m4_v3(mat, vec);

@@ -520,3 +531,3 @@

{
const float w = mul_project_m4_v3_zfac(mat, vec);
const float w = fabsf(mul_project_m4_v3_zfac(mat, vec));
mul_v3_m4v3(r, mat, vec);

@@ -531,3 +542,3 @@

{
const float w = mul_project_m4_v3_zfac(mat, vec);
const float w = fabsf(mul_project_m4_v3_zfac(mat, vec));
mul_v2_m4v3(r, mat, vec);

@@ -1155,3 +1166,3 @@

for (j = 0; j < i; j++) {
if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
if (fabsf(dot_v3v3(m[i], m[j])) > 1e-5f)
return false;

@@ -1170,3 +1181,3 @@ }

for (j = 0; j < i; j++) {
if (fabsf(dot_v4v4(m[i], m[j])) > 1.5f * FLT_EPSILON)
if (fabsf(dot_v4v4(m[i], m[j])) > 1e-5f)
return false;

@@ -1186,3 +1197,3 @@ }

for (i = 0; i < 3; i++)
if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1e-5f)
return false;

@@ -1202,3 +1213,3 @@

for (i = 0; i < 4; i++)
if (fabsf(dot_v4v4(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
if (fabsf(dot_v4v4(m[i], m[i]) - 1) > 1e-5f)
return false;

@@ -1247,32 +1258,70 @@

void normalize_m3_ex(float mat[3][3], float r_scale[3])
{
int i;
for (i = 0; i < 3; i++) {
r_scale[i] = normalize_v3(mat[i]);
}
}
void normalize_m3(float mat[3][3])
{
normalize_v3(mat[0]);
normalize_v3(mat[1]);
normalize_v3(mat[2]);
int i;
for (i = 0; i < 3; i++) {
normalize_v3(mat[i]);
}
}
void normalize_m3_m3_ex(float rmat[3][3], float mat[3][3], float r_scale[3])
{
int i;
for (i = 0; i < 3; i++) {
r_scale[i] = normalize_v3_v3(rmat[i], mat[i]);
}
}
void normalize_m3_m3(float rmat[3][3], float mat[3][3])
{
normalize_v3_v3(rmat[0], mat[0]);
normalize_v3_v3(rmat[1], mat[1]);
normalize_v3_v3(rmat[2], mat[2]);
int i;
for (i = 0; i < 3; i++) {
normalize_v3_v3(rmat[i], mat[i]);
}
}
void normalize_m4_ex(float mat[4][4], float r_scale[3])
{
int i;
for (i = 0; i < 3; i++) {
r_scale[i] = normalize_v3(mat[i]);
if (r_scale[i] != 0.0f) {
mat[i][3] /= r_scale[i];
}
}
}
void normalize_m4(float mat[4][4])
{
float len;
int i;
for (i = 0; i < 3; i++) {
float len = normalize_v3(mat[i]);
if (len != 0.0f) {
mat[i][3] /= len;
}
}
}
len = normalize_v3(mat[0]);
if (len != 0.0f) mat[0][3] /= len;
len = normalize_v3(mat[1]);
if (len != 0.0f) mat[1][3] /= len;
len = normalize_v3(mat[2]);
if (len != 0.0f) mat[2][3] /= len;
void normalize_m4_m4_ex(float rmat[4][4], float mat[4][4], float r_scale[3])
{
int i;
for (i = 0; i < 3; i++) {
r_scale[i] = normalize_v3_v3(rmat[i], mat[i]);
rmat[i][3] = (r_scale[i] != 0.0f) ? (mat[i][3] / r_scale[i]) : mat[i][3];
}
copy_v4_v4(rmat[3], mat[3]);
}
void normalize_m4_m4(float rmat[4][4], float mat[4][4])
{
copy_m4_m4(rmat, mat);
normalize_m4(rmat);
int i;
for (i = 0; i < 3; i++) {
float len = normalize_v3_v3(rmat[i], mat[i]);
rmat[i][3] = (len != 0.0f) ? (mat[i][3] / len) : mat[i][3];
}
copy_v4_v4(rmat[3], mat[3]);
}

@@ -1476,35 +1525,10 @@

{
float mat3_n[3][3]; /* mat3 -> normalized, 3x3 */
float imat3_n[3][3]; /* mat3 -> normalized & inverted, 3x3 */
/* rotation & scale are linked, we need to create the mat's
* for these together since they are related. */
/* so scale doesn't interfere with rotation [#24291] */
/* note: this is a workaround for negative matrix not working for rotation conversion, FIXME */
normalize_m3_m3(mat3_n, mat3);
if (is_negative_m3(mat3)) {
negate_m3(mat3_n);
/* keep rot as a 3x3 matrix, the caller can convert into a quat or euler */
size[0] = normalize_v3_v3(rot[0], mat3[0]);
size[1] = normalize_v3_v3(rot[1], mat3[1]);
size[2] = normalize_v3_v3(rot[2], mat3[2]);
if (UNLIKELY(is_negative_m3(rot))) {
negate_m3(rot);
negate_v3(size);
}
/* rotation */
/* keep rot as a 3x3 matrix, the caller can convert into a quat or euler */
copy_m3_m3(rot, mat3_n);
/* scale */
/* note: mat4_to_size(ob->size, mat) fails for negative scale */
invert_m3_m3(imat3_n, mat3_n);
/* better not edit mat3 */
#if 0
mul_m3_m3m3(mat3, imat3_n, mat3);
size[0] = mat3[0][0];
size[1] = mat3[1][1];
size[2] = mat3[2][2];
#else
size[0] = dot_m3_v3_row_x(imat3_n, mat3[0]);
size[1] = dot_m3_v3_row_y(imat3_n, mat3[1]);
size[2] = dot_m3_v3_row_z(imat3_n, mat3[2]);
#endif
}

@@ -1537,3 +1561,3 @@

mat3_to_quat(quat, mat3_n);
mat3_normalized_to_quat(quat, mat3_n);
copy_v3_v3(loc, wmat[3]);

@@ -1546,5 +1570,34 @@ }

mat4_to_loc_rot_size(loc, rot, size, wmat);
mat3_to_quat(quat, rot);
mat3_normalized_to_quat(quat, rot);
}
/**
* Right polar decomposition:
* M = UP
*
* U is the 'rotation'-like component, the closest orthogonal matrix to M.
* P is the 'scaling'-like component, defined in U space.
*
* See https://en.wikipedia.org/wiki/Polar_decomposition for more.
*/
#ifndef MATH_STANDALONE
void mat3_polar_decompose(float mat3[3][3], float r_U[3][3], float r_P[3][3])
{
/* From svd decomposition (M = WSV*), we have:
* U = WV*
* P = VSV*
*/
float W[3][3], S[3][3], V[3][3], Vt[3][3];
float sval[3];
BLI_svd_m3(mat3, W, sval, V);
size_to_mat3(S, sval);
transpose_m3_m3(Vt, V);
mul_m3_m3m3(r_U, W, Vt);
mul_m3_series(r_P, V, S, Vt);
}
#endif
void scale_m3_fl(float m[3][3], float scale)

@@ -1654,4 +1707,4 @@ {

mat3_to_quat(dquat, drot);
mat3_to_quat(squat, srot);
mat3_normalized_to_quat(dquat, drot);
mat3_normalized_to_quat(squat, srot);

@@ -1678,4 +1731,4 @@ /* do blending */

mat3_to_quat(dquat, drot);
mat3_to_quat(squat, srot);
mat3_normalized_to_quat(dquat, drot);
mat3_normalized_to_quat(squat, srot);

@@ -1691,2 +1744,74 @@ /* do blending */

/* for builds without Eigen */
#ifndef MATH_STANDALONE
/**
* A polar-decomposition-based interpolation between matrix A and matrix B.
*
* \note This code is about five times slower as the 'naive' interpolation done by \a blend_m3_m3m3
* (it typically remains below 2 usec on an average i74700, while \a blend_m3_m3m3 remains below 0.4 usec).
* However, it gives expected results even with non-uniformaly scaled matrices, see T46418 for an example.
*
* Based on "Matrix Animation and Polar Decomposition", by Ken Shoemake & Tom Duff
*
* @return R the interpolated matrix.
* @param A the intput matrix which is totally effective with \a t = 0.0.
* @param B the intput matrix which is totally effective with \a t = 1.0.
* @param t the interpolation factor.
*/
void interp_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], const float t)
{
/* 'Rotation' component ('U' part of polar decomposition, the closest orthogonal matrix to M3 rot/scale
* transformation matrix), spherically interpolated. */
float U_A[3][3], U_B[3][3], U[3][3];
float quat_A[4], quat_B[4], quat[4];
/* 'Scaling' component ('P' part of polar decomposition, i.e. scaling in U-defined space), linearly interpolated. */
float P_A[3][3], P_B[3][3], P[3][3];
int i;
mat3_polar_decompose(A, U_A, P_A);
mat3_polar_decompose(B, U_B, P_B);
mat3_to_quat(quat_A, U_A);
mat3_to_quat(quat_B, U_B);
interp_qt_qtqt(quat, quat_A, quat_B, t);
quat_to_mat3(U, quat);
for (i = 0; i < 3; i++) {
interp_v3_v3v3(P[i], P_A[i], P_B[i], t);
}
/* And we reconstruct rot/scale matrix from interpolated polar components */
mul_m3_m3m3(R, U, P);
}
/**
* Complete transform matrix interpolation, based on polar-decomposition-based interpolation from interp_m3_m3m3.
*
* @return R the interpolated matrix.
* @param A the intput matrix which is totally effective with \a t = 0.0.
* @param B the intput matrix which is totally effective with \a t = 1.0.
* @param t the interpolation factor.
*/
void interp_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], const float t)
{
float A3[3][3], B3[3][3], R3[3][3];
/* Location component, linearly interpolated. */
float loc_A[3], loc_B[3], loc[3];
copy_v3_v3(loc_A, A[3]);
copy_v3_v3(loc_B, B[3]);
interp_v3_v3v3(loc, loc_A, loc_B, t);
copy_m3_m4(A3, A);
copy_m3_m4(B3, B);
interp_m3_m3m3(R3, A3, B3, t);
copy_m4_m3(R, R3);
copy_v3_v3(R[3], loc);
}
#endif /* MATH_STANDALONE */
bool is_negative_m3(float mat[3][3])

@@ -2268,3 +2393,3 @@ {

{
/* compute moon-penrose pseudo inverse of matrix, singular values
/* compute Moore-Penrose pseudo inverse of matrix, singular values
* below epsilon are ignored for stability (truncated SVD) */

@@ -2345,2 +2470,12 @@ float A[4][4], V[4][4], W[4], Wm[4][4], U[4][4];

/**
* Global-invariant transform.
*
* This defines a matrix transforming a point in local space to a point in target space such that its global
* coordinates remain unchanged.
*
* In other words, if we have a global point P with local coordinates (x, y, z) and global coordinates (X, Y, Z),
* this defines a transform matrix TM such that (x', y', z') = TM * (x, y, z)
* where (x', y', z') are the coordinates of P' in target space such that it keeps (X, Y, Z) coordinates in global space.
*/
void BLI_space_transform_from_matrices(SpaceTransform *data, float local[4][4], float target[4][4])

@@ -2354,2 +2489,20 @@ {

/**
* Local-invariant transform.
*
* This defines a matrix transforming a point in global space such that its local coordinates
* (from local space to target space) remain unchanged.
*
* In other words, if we have a local point p with local coordinates (x, y, z) and global coordinates (X, Y, Z),
* this defines a transform matrix TM such that (X', Y', Z') = TM * (X, Y, Z)
* where (X', Y', Z') are the coordinates of p' in global space such that it keeps (x, y, z) coordinates in target space.
*/
void BLI_space_transform_global_from_matrices(SpaceTransform *data, float local[4][4], float target[4][4])
{
float ilocal[4][4];
invert_m4_m4(ilocal, local);
mul_m4_m4m4(data->local2target, target, ilocal);
invert_m4_m4(data->target2local, data->local2target);
}
void BLI_space_transform_apply(const SpaceTransform *data, float co[3])

@@ -2356,0 +2509,0 @@ {

@@ -157,2 +157,20 @@ /*

/**
* This is just conjugate_qt for cases we know \a q is unit-length.
* we could use #conjugate_qt directly, but use this function to show intent,
* and assert if its ever becomes non-unit-length.
*/
void invert_qt_normalized(float q[4])
{
BLI_ASSERT_UNIT_QUAT(q);
conjugate_qt(q);
}
void invert_qt_qt_normalized(float q1[4], const float q2[4])
{
copy_qt_qt(q1, q2);
invert_qt_normalized(q1);
}
/* simple mult */

@@ -279,10 +297,7 @@ void mul_qt_fl(float q[4], const float f)

void mat3_to_quat(float q[4], float wmat[3][3])
void mat3_normalized_to_quat(float q[4], float mat[3][3])
{
double tr, s;
float mat[3][3];
/* work on a copy */
copy_m3_m3(mat, wmat);
normalize_m3(mat); /* this is needed AND a 'normalize_qt' in the end */
BLI_ASSERT_UNIT_M3(mat);

@@ -331,9 +346,26 @@ tr = 0.25 * (double)(1.0f + mat[0][0] + mat[1][1] + mat[2][2]);

}
void mat3_to_quat(float q[4], float m[3][3])
{
float unit_mat[3][3];
/* work on a copy */
/* this is needed AND a 'normalize_qt' in the end */
normalize_m3_m3(unit_mat, m);
mat3_normalized_to_quat(q, unit_mat);
}
void mat4_normalized_to_quat(float q[4], float m[4][4])
{
float mat3[3][3];
copy_m3_m4(mat3, m);
mat3_normalized_to_quat(q, mat3);
}
void mat4_to_quat(float q[4], float m[4][4])
{
float mat[3][3];
float mat3[3][3];
copy_m3_m4(mat, m);
mat3_to_quat(q, mat);
copy_m3_m4(mat3, m);
mat3_to_quat(q, mat3);
}

@@ -942,3 +974,12 @@

/* 3x3 matrix to axis angle (see Mat4ToVecRot too) */
/* 3x3 matrix to axis angle */
void mat3_normalized_to_axis_angle(float axis[3], float *angle, float mat[3][3])
{
float q[4];
/* use quaternions as intermediate representation */
/* TODO: it would be nicer to go straight there... */
mat3_normalized_to_quat(q, mat);
quat_to_axis_angle(axis, angle, q);
}
void mat3_to_axis_angle(float axis[3], float *angle, float mat[3][3])

@@ -954,3 +995,14 @@ {

/* 4x4 matrix to axis angle (see Mat4ToVecRot too) */
/* 4x4 matrix to axis angle */
void mat4_normalized_to_axis_angle(float axis[3], float *angle, float mat[4][4])
{
float q[4];
/* use quaternions as intermediate representation */
/* TODO: it would be nicer to go straight there... */
mat4_normalized_to_quat(q, mat);
quat_to_axis_angle(axis, angle, q);
}
/* 4x4 matrix to axis angle */
void mat4_to_axis_angle(float axis[3], float *angle, float mat[4][4])

@@ -1024,2 +1076,16 @@ {

void axis_angle_to_quat_single(float q[4], const char axis, const float angle)
{
const float angle_half = angle * 0.5f;
const float angle_cos = cosf(angle_half);
const float angle_sin = sinf(angle_half);
const int axis_index = (axis - 'X');
assert(axis >= 'X' && axis <= 'Z');
q[0] = angle_cos;
zero_v3(q + 1);
q[axis_index + 1] = angle_sin;
}
/****************************** Exponential Map ******************************/

@@ -1052,7 +1118,8 @@

/* Obtain axis/angle representation. */
angle = normalize_v3_v3(axis, expmap);
angle = angle_wrap_rad(angle);
/* Convert to quaternion. */
axis_angle_to_quat(r, axis, angle);
if (LIKELY((angle = normalize_v3_v3(axis, expmap)) != 0.0f)) {
axis_angle_normalized_to_quat(r, axis, angle_wrap_rad(angle));
}
else {
unit_qt(r);
}
}

@@ -1124,12 +1191,8 @@

/* XYZ order */
static void mat3_to_eul2(float tmat[3][3], float eul1[3], float eul2[3])
static void mat3_normalized_to_eul2(const float mat[3][3], float eul1[3], float eul2[3])
{
float cy, quat[4], mat[3][3];
const float cy = hypotf(mat[0][0], mat[0][1]);
mat3_to_quat(quat, tmat);
quat_to_mat3(mat, quat);
normalize_m3_m3(mat, tmat);
BLI_ASSERT_UNIT_M3(mat);
cy = hypotf(mat[0][0], mat[0][1]);
if (cy > 16.0f * FLT_EPSILON) {

@@ -1156,7 +1219,7 @@

/* XYZ order */
void mat3_to_eul(float *eul, float tmat[3][3])
void mat3_normalized_to_eul(float eul[3], float mat[3][3])
{
float eul1[3], eul2[3];
mat3_to_eul2(tmat, eul1, eul2);
mat3_normalized_to_eul2(mat, eul1, eul2);

@@ -1171,20 +1234,29 @@ /* return best, which is just the one with lowest values it in */

}
void mat3_to_eul(float eul[3], float mat[3][3])
{
float unit_mat[3][3];
normalize_m3_m3(unit_mat, mat);
mat3_normalized_to_eul(eul, unit_mat);
}
/* XYZ order */
void mat4_to_eul(float *eul, float tmat[4][4])
void mat4_normalized_to_eul(float eul[3], float m[4][4])
{
float tempMat[3][3];
copy_m3_m4(tempMat, tmat);
normalize_m3(tempMat);
mat3_to_eul(eul, tempMat);
float mat3[3][3];
copy_m3_m4(mat3, m);
mat3_normalized_to_eul(eul, mat3);
}
void mat4_to_eul(float eul[3], float m[4][4])
{
float mat3[3][3];
copy_m3_m4(mat3, m);
mat3_to_eul(eul, mat3);
}
/* XYZ order */
void quat_to_eul(float *eul, const float quat[4])
void quat_to_eul(float eul[3], const float quat[4])
{
float mat[3][3];
quat_to_mat3(mat, quat);
mat3_to_eul(eul, mat);
float unit_mat[3][3];
quat_to_mat3(unit_mat, quat);
mat3_normalized_to_eul(eul, unit_mat);
}

@@ -1279,3 +1351,3 @@

/* XYZ order */
void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[3][3])
void mat3_normalized_to_compatible_eul(float eul[3], const float oldrot[3], float mat[3][3])
{

@@ -1285,3 +1357,3 @@ float eul1[3], eul2[3];

mat3_to_eul2(mat, eul1, eul2);
mat3_normalized_to_eul2(mat, eul1, eul2);

@@ -1302,3 +1374,16 @@ compatible_eul(eul1, oldrot);

}
void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[3][3])
{
float unit_mat[3][3];
normalize_m3_m3(unit_mat, mat);
mat3_normalized_to_compatible_eul(eul, oldrot, unit_mat);
}
void quat_to_compatible_eul(float eul[3], const float oldrot[3], const float quat[4])
{
float unit_mat[3][3];
quat_to_mat3(unit_mat, quat);
mat3_normalized_to_compatible_eul(eul, oldrot, unit_mat);
}
/************************** Arbitrary Order Eulers ***************************/

@@ -1338,3 +1423,12 @@

*/
#define GET_ROTATIONORDER_INFO(order) (assert(order >= 0 && order <= 6), (order < 1) ? &rotOrders[0] : &rotOrders[(order) - 1])
static const RotOrderInfo *get_rotation_order_info(const short order)
{
assert(order >= 0 && order <= 6);
if (order < 1)
return &rotOrders[0];
else if (order < 6)
return &rotOrders[order - 1];
else
return &rotOrders[5];
}

@@ -1344,3 +1438,3 @@ /* Construct quaternion from Euler angles (in radians). */

{
const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
const RotOrderInfo *R = get_rotation_order_info(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];

@@ -1381,6 +1475,6 @@ double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;

{
float M[3][3];
float unit_mat[3][3];
quat_to_mat3(M, q);
mat3_to_eulO(e, order, M);
quat_to_mat3(unit_mat, q);
mat3_normalized_to_eulO(e, order, unit_mat);
}

@@ -1391,3 +1485,3 @@

{
const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
const RotOrderInfo *R = get_rotation_order_info(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];

@@ -1431,11 +1525,9 @@ double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;

/* returns two euler calculation methods, so we can pick the best */
static void mat3_to_eulo2(float M[3][3], float eul1[3], float eul2[3], const short order)
static void mat3_normalized_to_eulo2(float mat[3][3], float eul1[3], float eul2[3], const short order)
{
const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
const RotOrderInfo *R = get_rotation_order_info(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];
float mat[3][3];
float cy;
/* process the matrix first */
normalize_m3_m3(mat, M);
BLI_ASSERT_UNIT_M3(mat);

@@ -1468,14 +1560,13 @@ cy = hypotf(mat[i][i], mat[i][j]);

/* Construct 4x4 matrix from Euler angles (in radians). */
void eulO_to_mat4(float M[4][4], const float e[3], const short order)
void eulO_to_mat4(float mat[4][4], const float e[3], const short order)
{
float m[3][3];
float unit_mat[3][3];
/* for now, we'll just do this the slow way (i.e. copying matrices) */
normalize_m3(m);
eulO_to_mat3(m, e, order);
copy_m4_m3(M, m);
eulO_to_mat3(unit_mat, e, order);
copy_m4_m3(mat, unit_mat);
}
/* Convert 3x3 matrix to Euler angles (in radians). */
void mat3_to_eulO(float eul[3], const short order, float M[3][3])
void mat3_normalized_to_eulO(float eul[3], const short order, float m[3][3])
{

@@ -1485,3 +1576,3 @@ float eul1[3], eul2[3];

mat3_to_eulo2(M, eul1, eul2, order);
mat3_normalized_to_eulo2(m, eul1, eul2, order);

@@ -1499,16 +1590,30 @@ d1 = fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]);

}
void mat3_to_eulO(float eul[3], const short order, float m[3][3])
{
float unit_mat[3][3];
normalize_m3_m3(unit_mat, m);
mat3_normalized_to_eulO(eul, order, unit_mat);
}
/* Convert 4x4 matrix to Euler angles (in radians). */
void mat4_to_eulO(float e[3], const short order, float M[4][4])
void mat4_normalized_to_eulO(float eul[3], const short order, float m[4][4])
{
float m[3][3];
float mat3[3][3];
/* for now, we'll just do this the slow way (i.e. copying matrices) */
copy_m3_m4(m, M);
normalize_m3(m);
mat3_to_eulO(e, order, m);
copy_m3_m4(mat3, m);
mat3_normalized_to_eulO(eul, order, mat3);
}
void mat4_to_eulO(float eul[3], const short order, float m[4][4])
{
float mat3[3][3];
copy_m3_m4(mat3, m);
normalize_m3(mat3);
mat3_normalized_to_eulO(eul, order, mat3);
}
/* uses 2 methods to retrieve eulers, and picks the closest */
void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
void mat3_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
{

@@ -1518,3 +1623,3 @@ float eul1[3], eul2[3];

mat3_to_eulo2(mat, eul1, eul2, order);
mat3_normalized_to_eulo2(mat, eul1, eul2, order);

@@ -1535,12 +1640,36 @@ compatible_eul(eul1, oldrot);

}
void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
{
float unit_mat[3][3];
void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float M[4][4])
normalize_m3_m3(unit_mat, mat);
mat3_normalized_to_compatible_eulO(eul, oldrot, order, unit_mat);
}
void mat4_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float m[4][4])
{
float m[3][3];
float mat3[3][3];
/* for now, we'll just do this the slow way (i.e. copying matrices) */
copy_m3_m4(m, M);
normalize_m3(m);
mat3_to_compatible_eulO(eul, oldrot, order, m);
copy_m3_m4(mat3, m);
mat3_normalized_to_compatible_eulO(eul, oldrot, order, mat3);
}
void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float m[4][4])
{
float mat3[3][3];
/* for now, we'll just do this the slow way (i.e. copying matrices) */
copy_m3_m4(mat3, m);
normalize_m3(mat3);
mat3_normalized_to_compatible_eulO(eul, oldrot, order, mat3);
}
void quat_to_compatible_eulO(float eul[3], float oldrot[3], const short order, const float quat[4])
{
float unit_mat[3][3];
quat_to_mat3(unit_mat, quat);
mat3_normalized_to_compatible_eulO(eul, oldrot, order, unit_mat);
}
/* rotate the given euler by the given angle on the specified axis */

@@ -1575,3 +1704,3 @@ /* NOTE: is this safe to do with different axis orders? */

{
const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
const RotOrderInfo *R = get_rotation_order_info(order);

@@ -1633,3 +1762,3 @@ float mat[3][3];

{
float *t, *q, dscale[3], scale[3], basequat[4];
float *t, *q, dscale[3], scale[3], basequat[4], mat3[3][3];
float baseRS[4][4], baseinv[4][4], baseR[4][4], baseRinv[4][4];

@@ -1647,3 +1776,5 @@ float R[4][4], S[4][4];

if ((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
copy_m3_m4(mat3, mat);
if (!is_orthonormal_m3(mat3) || (determinant_m4(mat) < 0.0f) || len_squared_v3(dscale) > SQUARE(1e-4f)) {
/* extract R and S */

@@ -1650,0 +1781,0 @@ float tmp[4][4];

@@ -100,3 +100,25 @@ /*

/* short */
/* unsigned char */
MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2])
{
r[0] = a[0];
r[1] = a[1];
}
MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3])
{
r[0] = a[0];
r[1] = a[1];
r[2] = a[2];
}
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
{
r[0] = a[0];
r[1] = a[1];
r[2] = a[2];
r[3] = a[3];
}
/* char */
MINLINE void copy_v2_v2_char(char r[2], const char a[2])

@@ -615,2 +637,44 @@ {

MINLINE void abs_v2(float r[2])
{
r[0] = fabsf(r[0]);
r[1] = fabsf(r[1]);
}
MINLINE void abs_v2_v2(float r[2], const float a[2])
{
r[0] = fabsf(a[0]);
r[1] = fabsf(a[1]);
}
MINLINE void abs_v3(float r[3])
{
r[0] = fabsf(r[0]);
r[1] = fabsf(r[1]);
r[2] = fabsf(r[2]);
}
MINLINE void abs_v3_v3(float r[3], const float a[3])
{
r[0] = fabsf(a[0]);
r[1] = fabsf(a[1]);
r[2] = fabsf(a[2]);
}
MINLINE void abs_v4(float r[4])
{
r[0] = fabsf(r[0]);
r[1] = fabsf(r[1]);
r[2] = fabsf(r[2]);
r[3] = fabsf(r[3]);
}
MINLINE void abs_v4_v4(float r[4], const float a[4])
{
r[0] = fabsf(a[0]);
r[1] = fabsf(a[1]);
r[2] = fabsf(a[2]);
r[3] = fabsf(a[3]);
}
MINLINE float dot_v2v2(const float a[2], const float b[2])

@@ -643,2 +707,7 @@ {

MINLINE double dot_v3db_v3fl(const double a[3], const float b[3])
{
return a[0] * (double)b[0] + a[1] * (double)b[1] + a[2] * (double)b[2];
}
MINLINE float cross_v2v2(const float a[2], const float b[2])

@@ -925,7 +994,4 @@ {

{
if (fabsf(v1[0] - v2[0]) <= limit)
if (fabsf(v1[1] - v2[1]) <= limit)
return true;
return false;
return (compare_ff(v1[0], v2[0], limit) &&
compare_ff(v1[1], v2[1], limit));
}

@@ -935,10 +1001,37 @@

{
if (fabsf(v1[0] - v2[0]) <= limit)
if (fabsf(v1[1] - v2[1]) <= limit)
if (fabsf(v1[2] - v2[2]) <= limit)
return true;
return (compare_ff(v1[0], v2[0], limit) &&
compare_ff(v1[1], v2[1], limit) &&
compare_ff(v1[2], v2[2], limit));
}
return false;
MINLINE bool compare_v4v4(const float v1[4], const float v2[4], const float limit)
{
return (compare_ff(v1[0], v2[0], limit) &&
compare_ff(v1[1], v2[1], limit) &&
compare_ff(v1[2], v2[2], limit) &&
compare_ff(v1[3], v2[3], limit));
}
MINLINE bool compare_v2v2_relative(const float v1[2], const float v2[2], const float limit, const int max_ulps)
{
return (compare_ff_relative(v1[0], v2[0], limit, max_ulps) &&
compare_ff_relative(v1[1], v2[1], limit, max_ulps));
}
MINLINE bool compare_v3v3_relative(const float v1[3], const float v2[3], const float limit, const int max_ulps)
{
return (compare_ff_relative(v1[0], v2[0], limit, max_ulps) &&
compare_ff_relative(v1[1], v2[1], limit, max_ulps) &&
compare_ff_relative(v1[2], v2[2], limit, max_ulps));
}
MINLINE bool compare_v4v4_relative(const float v1[4], const float v2[4], const float limit, const int max_ulps)
{
return (compare_ff_relative(v1[0], v2[0], limit, max_ulps) &&
compare_ff_relative(v1[1], v2[1], limit, max_ulps) &&
compare_ff_relative(v1[2], v2[2], limit, max_ulps) &&
compare_ff_relative(v1[3], v2[3], limit, max_ulps));
}
MINLINE bool compare_len_v3v3(const float v1[3], const float v2[3], const float limit)

@@ -966,13 +1059,2 @@ {

MINLINE bool compare_v4v4(const float v1[4], const float v2[4], const float limit)
{
if (fabsf(v1[0] - v2[0]) <= limit)
if (fabsf(v1[1] - v2[1]) <= limit)
if (fabsf(v1[2] - v2[2]) <= limit)
if (fabsf(v1[3] - v2[3]) <= limit)
return true;
return false;
}
/**

@@ -979,0 +1061,0 @@ * <pre>

@@ -575,2 +575,23 @@ /*

/**
* In this case plane is a 3D vector only (no 4th component).
*
* Projecting will make \a c a copy of \a v orthogonal to \a v_plane.
*
* \note If \a v is exactly perpendicular to \a v_plane, \a c will just be a copy of \a v.
*/
void project_plane_v3_v3v3(float c[3], const float v[3], const float v_plane[3])
{
float delta[3];
project_v3_v3v3(delta, v, v_plane);
sub_v3_v3v3(c, v, delta);
}
void project_plane_v2_v2v2(float c[2], const float v[2], const float v_plane[2])
{
float delta[2];
project_v2_v2v2(delta, v, v_plane);
sub_v2_v2v2(c, v, delta);
}
/* project a vector on a plane defined by normal and a plane point p */

@@ -768,3 +789,3 @@ void project_v3_plane(float v[3], const float n[3], const float p[3])

void minmax_v3v3_v3_array(float r_min[3], float r_max[3], float (*vec_arr)[3], int nbr)
void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float (*vec_arr)[3], int nbr)
{

@@ -860,3 +881,3 @@ while (nbr--) {

else {
fill_vn_fl(array_tar, size, 0.0f);
copy_vn_fl(array_tar, size, 0.0f);
d_sqrt = 0.0f;

@@ -882,2 +903,12 @@ }

void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start)
{
unsigned int *array_pt = array_tar + (size - 1);
unsigned int j = start + (unsigned int)(size - 1);
int i = size;
while (i--) {
*(array_pt--) = j--;
}
}
void range_vn_fl(float *array_tar, const int size, const float start, const float step)

@@ -1027,3 +1058,3 @@ {

void fill_vn_i(int *array_tar, const int size, const int val)
void copy_vn_i(int *array_tar, const int size, const int val)
{

@@ -1037,3 +1068,3 @@ int *tar = array_tar + (size - 1);

void fill_vn_short(short *array_tar, const int size, const short val)
void copy_vn_short(short *array_tar, const int size, const short val)
{

@@ -1047,3 +1078,3 @@ short *tar = array_tar + (size - 1);

void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val)
void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val)
{

@@ -1057,3 +1088,3 @@ unsigned short *tar = array_tar + (size - 1);

void fill_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val)
void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val)
{

@@ -1067,3 +1098,3 @@ unsigned char *tar = array_tar + (size - 1);

void fill_vn_fl(float *array_tar, const int size, const float val)
void copy_vn_fl(float *array_tar, const int size, const float val)
{

@@ -1076,1 +1107,36 @@ float *tar = array_tar + (size - 1);

}
/** \name Double precision versions 'db'.
* \{ */
void add_vn_vn_d(double *array_tar, const double *array_src, const int size)
{
double *tar = array_tar + (size - 1);
const double *src = array_src + (size - 1);
int i = size;
while (i--) {
*(tar--) += *(src--);
}
}
void add_vn_vnvn_d(double *array_tar, const double *array_src_a, const double *array_src_b, const int size)
{
double *tar = array_tar + (size - 1);
const double *src_a = array_src_a + (size - 1);
const double *src_b = array_src_b + (size - 1);
int i = size;
while (i--) {
*(tar--) = *(src_a--) + *(src_b--);
}
}
void mul_vn_db(double *array_tar, const int size, const double f)
{
double *array_pt = array_tar + (size - 1);
int i = size;
while (i--) {
*(array_pt--) *= f;
}
}
/** \} */

@@ -45,2 +45,4 @@ /*

#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"

@@ -81,8 +83,10 @@

float det, inv_det, u, v, t;
int clip = 1;
bool clip = true;
int i;
if (!PyArg_ParseTuple(
args, "OOOOO|i:intersect_ray_tri",
UNPACK3_EX(&, py_tri, ), &py_ray, &py_ray_off, &clip))
args, "OOOOO|O&:intersect_ray_tri",
UNPACK3_EX(&, py_tri, ),
&py_ray, &py_ray_off,
PyC_ParseBool, &clip))
{

@@ -204,3 +208,3 @@ return NULL;

if (result == 0) {
/* colinear */
/* collinear */
Py_RETURN_NONE;

@@ -417,4 +421,6 @@ }

"\n"
" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
" Takes 2 segments (defined by 4 vectors) and returns a vector for their point of intersection or None.\n"
"\n"
" .. warning:: Despite its name, this function works on segments, and not on lines..."
"\n"
" :arg lineA_p1: First point of the first line\n"

@@ -484,8 +490,8 @@ " :type lineA_p1: :class:`mathutils.Vector`\n"

float isect[3];
int no_flip = false;
bool no_flip = false;
if (!PyArg_ParseTuple(
args, "OOOO|i:intersect_line_plane",
args, "OOOO|O&:intersect_line_plane",
&py_line_a, &py_line_b, &py_plane_co, &py_plane_no,
&no_flip))
PyC_ParseBool, &no_flip))
{

@@ -534,2 +540,3 @@ return NULL;

float plane_a_co[3], plane_a_no[3], plane_b_co[3], plane_b_no[3];
float plane_a[4], plane_b[4];

@@ -554,5 +561,8 @@ float isect_co[3];

if (isect_plane_plane_v3(isect_co, isect_no,
plane_a_co, plane_a_no,
plane_b_co, plane_b_no))
plane_from_point_normal_v3(plane_a, plane_a_co, plane_a_no);
plane_from_point_normal_v3(plane_b, plane_b_co, plane_b_no);
if (isect_plane_plane_v3(
plane_a, plane_b,
isect_co, isect_no))
{

@@ -599,3 +609,3 @@ normalize_v3(isect_no);

float sphere_radius;
int clip = true;
bool clip = true;

@@ -606,4 +616,5 @@ float isect_a[3];

if (!PyArg_ParseTuple(
args, "OOOf|i:intersect_line_sphere",
&py_line_a, &py_line_b, &py_sphere_co, &sphere_radius, &clip))
args, "OOOf|O&:intersect_line_sphere",
&py_line_a, &py_line_b, &py_sphere_co, &sphere_radius,
PyC_ParseBool, &clip))
{

@@ -673,3 +684,3 @@ return NULL;

float sphere_radius;
int clip = true;
bool clip = true;

@@ -680,4 +691,5 @@ float isect_a[2];

if (!PyArg_ParseTuple(
args, "OOOf|i:intersect_line_sphere_2d",
&py_line_a, &py_line_b, &py_sphere_co, &sphere_radius, &clip))
args, "OOOf|O&:intersect_line_sphere_2d",
&py_line_a, &py_line_b, &py_sphere_co, &sphere_radius,
PyC_ParseBool, &clip))
{

@@ -864,3 +876,3 @@ return NULL;

" only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
" Works only with convex quads without singular edges."
" Works only with convex quads without singular edges.\n"
"\n"

@@ -867,0 +879,0 @@ " :arg pt: Point\n"

@@ -111,11 +111,7 @@ /*

if (eul_compat) {
float mat[3][3];
if (BaseMath_ReadCallback(eul_compat) == -1)
return NULL;
quat_to_mat3(mat, tquat);
if (order == EULER_ORDER_XYZ) mat3_to_compatible_eul(eul, eul_compat->eul, mat);
else mat3_to_compatible_eulO(eul, eul_compat->eul, order, mat);
if (order == EULER_ORDER_XYZ) quat_to_compatible_eul(eul, eul_compat->eul, tquat);
else quat_to_compatible_eulO(eul, eul_compat->eul, order, tquat);
}

@@ -122,0 +118,0 @@ else {

@@ -60,2 +60,3 @@ /*

PyObject *item;
PyObject **value_fast_items = PySequence_Fast_ITEMS(value_fast);

@@ -67,3 +68,3 @@ int i;

i--;
if (((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
if (((array[i] = PyFloat_AsDouble((item = value_fast_items[i]))) == -1.0f) &&
PyErr_Occurred())

@@ -75,8 +76,7 @@ {

error_prefix, i, Py_TYPE(item)->tp_name);
Py_DECREF(value_fast);
return -1;
size = -1;
break;
}
} while (i);
Py_XDECREF(value_fast);
return size;

@@ -116,6 +116,6 @@ }

/* helper functionm returns length of the 'value', -1 on error */
/* helper function returns length of the 'value', -1 on error */
int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
{
const int flag = array_max;
const unsigned int flag = array_max;
int size;

@@ -189,2 +189,3 @@

size = mathutils_array_parse_fast(array, size, value_fast, error_prefix);
Py_DECREF(value_fast);
}

@@ -247,2 +248,3 @@

if (size < array_min) {
Py_DECREF(value_fast);
PyErr_Format(PyExc_ValueError,

@@ -257,2 +259,3 @@ "%.200s: sequence size is %d, expected > %d",

ret = mathutils_array_parse_fast(*array, size, value_fast, error_prefix);
Py_DECREF(value_fast);

@@ -270,3 +273,3 @@ if (ret == -1) {

{
PyObject *value_fast = NULL;
PyObject *value_fast;
const int array_dim_flag = array_dim;

@@ -284,2 +287,3 @@ int i, size;

if (size != 0) {
PyObject **value_fast_items = PySequence_Fast_ITEMS(value_fast);
float *fp;

@@ -292,3 +296,3 @@

for (i = 0; i < size; i++, fp += array_dim) {
PyObject *item = PySequence_Fast_GET_ITEM(value, i);
PyObject *item = value_fast_items[i];

@@ -361,2 +365,11 @@ if (mathutils_array_parse(fp, array_dim, array_dim_flag, item, error_prefix) == -1) {

/* LomontRRDCompare4, Ever Faster Float Comparisons by Randy Dillon */
/* XXX We may want to use 'safer' BLI's compare_ff_relative ultimately?
* LomontRRDCompare4() is an optimized version of Dawson's AlmostEqual2sComplement() (see [1] and [2]).
* Dawson himself now claims this is not a 'safe' thing to do (pushing ULP method beyond its limits),
* an recommends using work from [3] instead, which is done in BLI func...
*
* [1] http://www.randydillon.org/Papers/2007/everfast.htm
* [2] http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
* [3] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ instead
*/
#define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31))

@@ -417,3 +430,3 @@

/* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
#define MATHUTILS_TOT_CB 16
#define MATHUTILS_TOT_CB 17
static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL};

@@ -550,3 +563,3 @@

return Py_INCREF_RET((PyObject *)self);;
return Py_INCREF_RET((PyObject *)self);
}

@@ -603,2 +616,3 @@

#ifndef MATH_STANDALONE
# include "mathutils_bvhtree.h"
# include "mathutils_kdtree.h"

@@ -657,2 +671,7 @@ # include "mathutils_noise.h"

/* BVHTree submodule */
PyModule_AddObject(mod, "bvhtree", (submodule = PyInit_mathutils_bvhtree()));
PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
Py_INCREF(submodule);
/* KDTree submodule */

@@ -659,0 +678,0 @@ PyModule_AddObject(mod, "kdtree", (submodule = PyInit_mathutils_kdtree()));

@@ -116,9 +116,9 @@ /*

#define BaseMath_ReadCallback(_self) \
(((_self)->cb_user ? _BaseMathObject_ReadCallback((BaseMathObject *)_self):0))
(((_self)->cb_user ? _BaseMathObject_ReadCallback((BaseMathObject *)_self) : 0))
#define BaseMath_WriteCallback(_self) \
(((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self):0))
(((_self)->cb_user ?_BaseMathObject_WriteCallback((BaseMathObject *)_self) : 0))
#define BaseMath_ReadIndexCallback(_self, _index) \
(((_self)->cb_user ? _BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index):0))
(((_self)->cb_user ? _BaseMathObject_ReadIndexCallback((BaseMathObject *)_self, _index) : 0))
#define BaseMath_WriteIndexCallback(_self, _index) \
(((_self)->cb_user ? _BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index):0))
(((_self)->cb_user ? _BaseMathObject_WriteIndexCallback((BaseMathObject *)_self, _index) : 0))

@@ -151,6 +151,6 @@ /* support BASE_MATH_FLAG_IS_FROZEN */

/* zero remaining unused elements of the array */
#define MU_ARRAY_ZERO (1 << 30)
#define MU_ARRAY_ZERO (1u << 30)
/* ignore larger py sequences than requested (just use first elements),
* handy when using 3d vectors as 2d */
#define MU_ARRAY_SPILL (1 << 31)
#define MU_ARRAY_SPILL (1u << 31)

@@ -157,0 +157,0 @@ #define MU_ARRAY_FLAGS (MU_ARRAY_ZERO | MU_ARRAY_SPILL)

@@ -11,1 +11,5 @@ #include "MEM_guardedalloc.h"

void *BLI_memarena_alloc(struct MemArena *ma, int size) { assert(0); return (void *)0; }
#ifndef NDEBUG
void BLI_system_backtrace(FILE *fp) { };
#endif

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display