xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
| 命名空间 | 概念 | 宏定义 | 类型定义 | 变量
vec.hpp 文件参考

N-dimensional mathematical vector implementation with template metaprogramming support 更多...

#include <assert.h>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <type_traits>
#include "../utils/compiling.hpp"
#include "./declaration.hpp"
vec.hpp 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

struct  xcmath::VecInfo< _Tp >
 
struct  xcmath::__batchHelper< T, len, lens >
 Metaclassfor constructing a vector from a pack of arguments 更多...
 
struct  xcmath::__batchHelper< T, len >
 Metaclass for constructing a vector from a pack of arguments 更多...
 
class  xcmath::vec< _Tp, _length >
 Vector class template 更多...
 
struct  xcmath::vec< _Tp, _length >::__subVecHelper< __Tp, __len, __lens >
 Metafunction for type transformation 更多...
 
struct  xcmath::vec< _Tp, _length >::__subVecHelper< size_t, __len, __lens... >
 
struct  xcmath::vec< _Tp, _length >::__subVecHelper< size_t, __len >
 

命名空间

namespace  xcmath
 Compiler-specific type information handling for MSVC
 

概念

concept  xcmath::Vec
 Type requirement concept for vector types
 
concept  xcmath::VecItem
 Concept for valid vector component types
 

宏定义

#define VEC_H
 
#define __VEC_OP_VEC_ON_EQ_LENGTH(op)
 Macro generating component-wise vector operations
 
#define __VEC_OP_ITEM_ON_OP_ABLE(op)
 Macro generating vector-scalar operations
 
#define __ITEM_OP_VEC_ON_OP_ENABLE(op)
 

类型定义

template<class T , size_t... lens>
using xcmath::batch = __batchHelper< T, lens... >::Type
 Metafunction for constructing a vector from a pack of arguments
 

变量

template<class Arg , class... Args>
constexpr size_t xcmath::VecConstructPackSize
 Metafunction computing total size of vector constructor arguments
 
template<class Arg >
constexpr size_t xcmath::VecConstructPackSize< Arg >
 Metafunction computing total size of vector constructor arguments
 

详细描述

N-dimensional mathematical vector implementation with template metaprogramming support

作者
XCDH
版本
2.1
日期
2023-10-05

Provides a type-safe, dimension-aware vector implementation supporting:

在文件 vec.hpp 中定义.

宏定义说明

◆ __ITEM_OP_VEC_ON_OP_ENABLE

#define __ITEM_OP_VEC_ON_OP_ENABLE (   op)
值:
template <class _OTp, Vec _Tp> \
requires(VecInfo<_OTp>::dim == 0 || \
(VecInfo<_OTp>::dim == _Tp::dim - 1)) \
inline constexpr auto operator op(const _OTp& other, const _Tp& o) { \
typename _Tp::template Self<decltype(other op o[0])> res; \
for (size_t i = 0; i < _Tp::length; i++) res[i] = other op o[i]; \
return res; \
}

在文件 vec.hpp907 行定义.

◆ __VEC_OP_ITEM_ON_OP_ABLE

#define __VEC_OP_ITEM_ON_OP_ABLE (   op)
值:
template <class _OTp> \
requires(VecInfo<_OTp>::dim == 0 || dim == VecInfo<_OTp>::dim + 1) \
inline constexpr auto operator op(const _OTp& o) const { \
Self<decltype(data[0] op o)> res; \
for (size_t i = 0; i < _length; i++) { \
res[i] = data[i] op o; \
} \
return res; \
}

Macro generating vector-scalar operations

参数
opOperator to apply (+, -, *, /, etc.)
注解
Applies operator to each component with scalar Allows mixed-type operations through decltype deduction

在文件 vec.hpp880 行定义.

◆ __VEC_OP_VEC_ON_EQ_LENGTH

#define __VEC_OP_VEC_ON_EQ_LENGTH (   op)
值:
template <class _OTp> \
requires(dim == VecInfo<_OTp>::dim) \
auto operator op(const _OTp& o) const { \
Self<decltype(data[0] op o[0])> res; \
auto length = (_length > _OTp::length) ? _OTp::length : _length; \
for (size_t i = 0; i < length; i++) { \
res[i] = data[i] op o[i]; \
} \
return res; \
}

Macro generating component-wise vector operations

参数
opOperator to apply (+, -, *, /, etc.)
注解
Requires both vectors to have same dimensionality. Creates new vector with operator applied to each component pair.

在文件 vec.hpp846 行定义.

◆ VEC_H

#define VEC_H

在文件 vec.hpp18 行定义.