.title { text-align: center; margin-bottom: .2em }
.subtitle { text-align: center; font-size: medium; font-weight: bold; margin-top: 0 }
.todo { font-family: monospace; color: red }
.done { font-family: monospace; color: green }
.priority { font-family: monospace; color: orange }
.tag { background-color: #eee; font-family: monospace; padding: 2px; font-size: 80%; font-weight: normal }
.timestamp { color: #bebebe }
.timestamp-kwd { color: #5f9ea0 }
.org-right { margin-left: auto; margin-right: 0px; text-align: right }
.org-left { margin-left: 0px; margin-right: auto; text-align: left }
.org-center { margin-left: auto; margin-right: auto; text-align: center }
.underline { text-decoration: underline }
#postamble p,#preamble p { font-size: 90%; margin: .2em }
p.verse { margin-left: 3% }
pre { border: 1px solid #ccc; padding: 8pt; font-family: monospace; overflow: auto; margin: 1.2em }
pre.src { position: relative; overflow: visible; padding-top: 1.2em }
pre.src::before { display: none; position: absolute; background-color: white; top: -10px; right: 10px; padding: 3px; border: 1px solid black }
pre.src:hover::before { display: inline }
pre.src-sh::before { content: "sh" }
pre.src-bash::before { content: "sh" }
pre.src-emacs-lisp::before { content: "Emacs Lisp" }
pre.src-R::before { content: "R" }
pre.src-perl::before { content: "Perl" }
pre.src-java::before { content: "Java" }
pre.src-sql::before { content: "SQL" }
table { border-collapse: collapse }
caption.t-above { caption-side: top }
caption.t-bottom { caption-side: bottom }
td,th { vertical-align: top }
th.org-right { text-align: center }
th.org-left { text-align: center }
th.org-center { text-align: center }
td.org-right { text-align: right }
td.org-left { text-align: left }
td.org-center { text-align: center }
dt { font-weight: bold }
.footpara { display: inline }
.footdef { margin-bottom: 1em }
.figure { padding: 1em }
.figure p { text-align: center }
.inlinetask { padding: 10px; border: 2px solid gray; margin: 10px; background: #ffffcc }
#org-div-home-and-up { text-align: right; font-size: 70%; white-space: nowrap }
textarea { }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00 }
.org-info-js_info-navigation { border-style: none }
#org-info-js_console-label { font-size: 10px; font-weight: bold; white-space: nowrap }
.org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold }
功能模块LinearMath
Table of Contents
- btScalar
- 宏定义
- 类型
- 函数
- btAlignedAllocator
- 宏定义
- 函数
- 类
- btAlignedObjectArray
- 宏定义
- btAlignedObjectArray类
btScalar
针对各系统平台的优化代码。
宏定义
- BT_MANAGED_CODE
托管代码,对齐的结构不支持managed code.
- BT_BULLET_VERSION
版本号,287
- DEBUG和_DEBUG
定义BT_DEBUG
- BT_USE_DOUBLE_PRECISION
单双精度切换
- BT_LARGE_FLOAT
最大的浮点数
- BT_DECLARE_ALIGNED_ALLOCATOR
一系列分配释放内存的宏定义
- USE_APPROXIMATION
使用magic function做开根号之类的近似运算
- 常数
#define SIMD_PI btScalar(3.1415926535897932384626433832795029) #define SIMD_2_PI (btScalar(2.0) * SIMD_PI) #define SIMD_HALF_PI (SIMD_PI * btScalar(0.5)) #define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) #define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) #define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490) #define btRecipSqrt(x) ((btScalar)(btScalar(1.0) / btSqrt(btScalar(x)))) //倒开根数 #define btRecip(x) (btScalar(1.0) / btScalar(x))
类型
- btScalar
指定精度的浮点数。
函数
btScalar btSqrt(btScalar y); btScalar btFabs(btScalar x); btScalar btCos(btScalar x); btScalar btSin(btScalar x); btScalar btTan(btScalar x); btScalar btAcos(btScalar x); btScalar btAsin(btScalar x); btScalar btAtan(btScalar x); btScalar btAtan2(btScalar x, btScalar y); btScalar btExp(btScalar x); btScalar btLog(btScalar x); btScalar btPow(btScalar x, btScalar y); btScalar btFmod(btScalar x, btScalar y);
btAlignedAllocator
自定义的内存分配器。 之后可能再重写_aligned_malloc和_aligned_free,使得其更加通用可控。
宏定义
- BT_DEBUG_MEMORY_ALLOCATIONS
可以在编译时定义,来测试内容泄露
函数
void* btAlignedAlloc(size_t size, int alignment); //按照对齐量分配空间 void btAlignedFree(void* ptr);//按照对齐量释放空间。 void btAlignedAllocSetCustom(btAllocFunc *allocFunc, btFreeFunc *freeFunc);//能够让bullet所有的内容分配器都通过custom memory allocator void btAlignedAllocSetCustomAligned(btAlignedAllocFunc *allocFunc, btAlignedFreeFunc *freeFunc);//如果开发者已经有一个custom aligned allocator,用这个函数。默认的分配器使用非对齐方式来分配额外内存。
类
class btAlignedAllocator //对齐分配器的接口类。分配器可以由自定义的allocator重写,使用btAlignedAllocSetCustom和btAlignedAllocSetCustomAligned。 { pointer address(reference ref) const; const_pointer address (const_reference ref) const; pointer allocate (size_type n, const_pointer*hint = 0); void construct ( pointer ptr, const value_type & value); void deallocate( pointer ptr ); void destroy ( pointer ptr ); self_type & operator=... bool operator==... }
- btAlignedAllocSetCustom
btAlignedObjectArray
宏定义
- BT_USE_PLACEMENT_NEW
定义的时候,支持虚函数 和non-trivial构造函数,用来提高效率,默认启用。
- BT_USE_MEMCPY
定义的时候,交换array中元素的话,会使用memcpy而不是operator=,默认禁用。
- BT_ALLOW_ARRAY_COPY_OPERATOR
深拷贝.
btAlignedObjectArray类
使用stl::vector中的子集,用来代替stl::vector,避免内存对齐问题。
Date: [2018-10-26 Fri 20:00]
Author: fhln
Created: 2018-10-26 Fri 22:27
原文地址:https://www.cnblogs.com/fhln/p/9859081.html