Blender  V3.3
Macros | Enumerations | Functions | Variables
btBoxCollision.h File Reference
#include "LinearMath/btTransform.h"

Go to the source code of this file.

Macros

#define BT_SWAP_NUMBERS(a, b)
 Swap numbers. More...
 
#define BT_MAX(a, b)   (a < b ? b : a)
 
#define BT_MIN(a, b)   (a > b ? b : a)
 
#define BT_GREATER(x, y)   btFabs(x) > (y)
 
#define BT_MAX3(a, b, c)   BT_MAX(a, BT_MAX(b, c))
 
#define BT_MIN3(a, b, c)   BT_MIN(a, BT_MIN(b, c))
 
#define TEST_CROSS_EDGE_BOX_MCR(edge, absolute_edge, pointa, pointb, _extend, i_dir_0, i_dir_1, i_comp_0, i_comp_1)
 
#define TEST_CROSS_EDGE_BOX_X_AXIS_MCR(edge, absolute_edge, pointa, pointb, _extend)
 
#define TEST_CROSS_EDGE_BOX_Y_AXIS_MCR(edge, absolute_edge, pointa, pointb, _extend)
 
#define TEST_CROSS_EDGE_BOX_Z_AXIS_MCR(edge, absolute_edge, pointa, pointb, _extend)
 
#define BOX_PLANE_EPSILON   0.000001f
 

Enumerations

enum  eBT_PLANE_INTERSECTION_TYPE { BT_CONST_BACK_PLANE = 0 , BT_CONST_COLLIDE_PLANE , BT_CONST_FRONT_PLANE }
 

Functions

SIMD_FORCE_INLINE btScalar bt_mat3_dot_col (const btMatrix3x3 &mat, const btVector3 &vec3, int colindex)
 Returns the dot product between a vec3f and the col of a matrix. More...
 
SIMD_FORCE_INLINE void calc_absolute_matrix ()
 
SIMD_FORCE_INLINE void calc_from_homogenic (const btTransform &trans0, const btTransform &trans1)
 Calc the transformation relative 1 to 0. Inverts matrics by transposing. More...
 
SIMD_FORCE_INLINE void calc_from_full_invert (const btTransform &trans0, const btTransform &trans1)
 Calcs the full invertion of the matrices. Useful for scaling matrices. More...
 
SIMD_FORCE_INLINE btVector3 transform (const btVector3 &point) const
 
 btAABB (const btVector3 &V1, const btVector3 &V2, const btVector3 &V3)
 
 btAABB (const btVector3 &V1, const btVector3 &V2, const btVector3 &V3, btScalar margin)
 
 btAABB (const btAABB &other)
 
 btAABB (const btAABB &other, btScalar margin)
 
SIMD_FORCE_INLINE void invalidate ()
 
SIMD_FORCE_INLINE void increment_margin (btScalar margin)
 
SIMD_FORCE_INLINE void copy_with_margin (const btAABB &other, btScalar margin)
 
template<typename CLASS_POINT >
SIMD_FORCE_INLINE void calc_from_triangle (const CLASS_POINT &V1, const CLASS_POINT &V2, const CLASS_POINT &V3)
 
template<typename CLASS_POINT >
SIMD_FORCE_INLINE void calc_from_triangle_margin (const CLASS_POINT &V1, const CLASS_POINT &V2, const CLASS_POINT &V3, btScalar margin)
 
SIMD_FORCE_INLINE void appy_transform (const btTransform &trans)
 Apply a transform to an AABB. More...
 
SIMD_FORCE_INLINE void appy_transform_trans_cache (const BT_BOX_BOX_TRANSFORM_CACHE &trans)
 Apply a transform to an AABB. More...
 
SIMD_FORCE_INLINE void merge (const btAABB &box)
 Merges a Box. More...
 
template<typename CLASS_POINT >
SIMD_FORCE_INLINE void merge_point (const CLASS_POINT &point)
 Merges a point. More...
 
SIMD_FORCE_INLINE void get_center_extend (btVector3 &center, btVector3 &extend) const
 Gets the extend and center. More...
 
SIMD_FORCE_INLINE void find_intersection (const btAABB &other, btAABB &intersection) const
 Finds the intersecting box between this box and the other. More...
 
SIMD_FORCE_INLINE bool has_collision (const btAABB &other) const
 
SIMD_FORCE_INLINE bool collide_ray (const btVector3 &vorigin, const btVector3 &vdir) const
 Finds the Ray intersection parameter. More...
 
SIMD_FORCE_INLINE void projection_interval (const btVector3 &direction, btScalar &vmin, btScalar &vmax) const
 
SIMD_FORCE_INLINE eBT_PLANE_INTERSECTION_TYPE plane_classify (const btVector4 &plane) const
 
SIMD_FORCE_INLINE bool overlapping_trans_conservative (const btAABB &box, btTransform &trans1_to_0) const
 
SIMD_FORCE_INLINE bool overlapping_trans_conservative2 (const btAABB &box, const BT_BOX_BOX_TRANSFORM_CACHE &trans1_to_0) const
 
SIMD_FORCE_INLINE bool overlapping_trans_cache (const btAABB &box, const BT_BOX_BOX_TRANSFORM_CACHE &transcache, bool fulltest) const
 transcache is the transformation cache from box to this AABB More...
 
SIMD_FORCE_INLINE bool collide_plane (const btVector4 &plane) const
 Simple test for planes. More...
 
SIMD_FORCE_INLINE bool collide_triangle_exact (const btVector3 &p1, const btVector3 &p2, const btVector3 &p3, const btVector4 &triangle_plane) const
 test for a triangle, with edges More...
 
SIMD_FORCE_INLINE bool btCompareTransformsEqual (const btTransform &t1, const btTransform &t2)
 Compairison of transformation objects. More...
 

Variables

 BT_BOX_BOX_TRANSFORM_CACHE
 Class for transforming a model1 to the space of model0. More...
 
btMatrix3x3 m_R1to0
 Transforms Rotation of model1 to model 0, equal to R0' * R1. More...
 
btMatrix3x3 m_AR
 Absolute value of m_R1to0. More...
 
 btAABB
 Axis aligned box. More...
 
btVector3 m_max
 

Macro Definition Documentation

◆ BOX_PLANE_EPSILON

#define BOX_PLANE_EPSILON   0.000001f

Definition at line 211 of file btBoxCollision.h.

◆ BT_GREATER

#define BT_GREATER (   x,
  y 
)    btFabs(x) > (y)

Definition at line 40 of file btBoxCollision.h.

◆ BT_MAX

#define BT_MAX (   a,
 
)    (a < b ? b : a)

Definition at line 37 of file btBoxCollision.h.

◆ BT_MAX3

#define BT_MAX3 (   a,
  b,
 
)    BT_MAX(a, BT_MAX(b, c))

Definition at line 42 of file btBoxCollision.h.

◆ BT_MIN

#define BT_MIN (   a,
 
)    (a > b ? b : a)

Definition at line 38 of file btBoxCollision.h.

◆ BT_MIN3

#define BT_MIN3 (   a,
  b,
 
)    BT_MIN(a, BT_MIN(b, c))

Definition at line 43 of file btBoxCollision.h.

◆ BT_SWAP_NUMBERS

#define BT_SWAP_NUMBERS (   a,
 
)
Value:
{ \
a = a + b; \
b = a - b; \
a = a - b; \
}
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)

Swap numbers.

Definition at line 30 of file btBoxCollision.h.

◆ TEST_CROSS_EDGE_BOX_MCR

#define TEST_CROSS_EDGE_BOX_MCR (   edge,
  absolute_edge,
  pointa,
  pointb,
  _extend,
  i_dir_0,
  i_dir_1,
  i_comp_0,
  i_comp_1 
)
Value:
{ \
const btScalar dir0 = -edge[i_dir_0]; \
const btScalar dir1 = edge[i_dir_1]; \
btScalar pmin = pointa[i_comp_0] * dir0 + pointa[i_comp_1] * dir1; \
btScalar pmax = pointb[i_comp_0] * dir0 + pointb[i_comp_1] * dir1; \
if (pmin > pmax) \
{ \
BT_SWAP_NUMBERS(pmin, pmax); \
} \
const btScalar abs_dir0 = absolute_edge[i_dir_0]; \
const btScalar abs_dir1 = absolute_edge[i_dir_1]; \
const btScalar rad = _extend[i_comp_0] * abs_dir0 + _extend[i_comp_1] * abs_dir1; \
if (pmin > rad || -rad > pmax) return false; \
}
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314

Definition at line 112 of file btBoxCollision.h.

◆ TEST_CROSS_EDGE_BOX_X_AXIS_MCR

#define TEST_CROSS_EDGE_BOX_X_AXIS_MCR (   edge,
  absolute_edge,
  pointa,
  pointb,
  _extend 
)
Value:
{ \
TEST_CROSS_EDGE_BOX_MCR(edge, absolute_edge, pointa, pointb, _extend, 2, 1, 1, 2); \
}

Definition at line 128 of file btBoxCollision.h.

◆ TEST_CROSS_EDGE_BOX_Y_AXIS_MCR

#define TEST_CROSS_EDGE_BOX_Y_AXIS_MCR (   edge,
  absolute_edge,
  pointa,
  pointb,
  _extend 
)
Value:
{ \
TEST_CROSS_EDGE_BOX_MCR(edge, absolute_edge, pointa, pointb, _extend, 0, 2, 2, 0); \
}

Definition at line 133 of file btBoxCollision.h.

◆ TEST_CROSS_EDGE_BOX_Z_AXIS_MCR

#define TEST_CROSS_EDGE_BOX_Z_AXIS_MCR (   edge,
  absolute_edge,
  pointa,
  pointb,
  _extend 
)
Value:
{ \
TEST_CROSS_EDGE_BOX_MCR(edge, absolute_edge, pointa, pointb, _extend, 1, 0, 0, 1); \
}

Definition at line 138 of file btBoxCollision.h.

Enumeration Type Documentation

◆ eBT_PLANE_INTERSECTION_TYPE

Enumerator
BT_CONST_BACK_PLANE 
BT_CONST_COLLIDE_PLANE 
BT_CONST_FRONT_PLANE 

Definition at line 45 of file btBoxCollision.h.

Function Documentation

◆ appy_transform()

SIMD_FORCE_INLINE void appy_transform ( const btTransform trans)

Apply a transform to an AABB.

Definition at line 342 of file btBoxCollision.h.

References btVector3, center, and m_max.

◆ appy_transform_trans_cache()

SIMD_FORCE_INLINE void appy_transform_trans_cache ( const BT_BOX_BOX_TRANSFORM_CACHE trans)

Apply a transform to an AABB.

Definition at line 358 of file btBoxCollision.h.

References btVector3, center, and m_max.

◆ bt_mat3_dot_col()

SIMD_FORCE_INLINE btScalar bt_mat3_dot_col ( const btMatrix3x3 mat,
const btVector3 vec3,
int  colindex 
)

Returns the dot product between a vec3f and the col of a matrix.

Definition at line 144 of file btBoxCollision.h.

Referenced by overlapping_trans_cache().

◆ btAABB() [1/4]

btAABB ( const btAABB &  other)

Definition at line 259 of file btBoxCollision.h.

◆ btAABB() [2/4]

btAABB ( const btAABB &  other,
btScalar  margin 
)

Definition at line 263 of file btBoxCollision.h.

References m_max.

◆ btAABB() [3/4]

btAABB ( const btVector3 V1,
const btVector3 V2,
const btVector3 V3 
)

Definition at line 225 of file btBoxCollision.h.

References BT_MAX3, BT_MIN3, and m_max.

◆ btAABB() [4/4]

btAABB ( const btVector3 V1,
const btVector3 V2,
const btVector3 V3,
btScalar  margin 
)

Definition at line 238 of file btBoxCollision.h.

References BT_MAX3, BT_MIN3, and m_max.

◆ btCompareTransformsEqual()

SIMD_FORCE_INLINE bool btCompareTransformsEqual ( const btTransform t1,
const btTransform t2 
)

Compairison of transformation objects.

Definition at line 610 of file btBoxCollision.h.

◆ calc_absolute_matrix()

SIMD_FORCE_INLINE void calc_absolute_matrix ( )

Definition at line 159 of file btBoxCollision.h.

References btFabs(), m_AR, and m_R1to0.

Referenced by calc_from_full_invert(), and calc_from_homogenic().

◆ calc_from_full_invert()

SIMD_FORCE_INLINE void calc_from_full_invert ( const btTransform trans0,
const btTransform trans1 
)

Calcs the full invertion of the matrices. Useful for scaling matrices.

Definition at line 194 of file btBoxCollision.h.

References calc_absolute_matrix(), and m_R1to0.

◆ calc_from_homogenic()

SIMD_FORCE_INLINE void calc_from_homogenic ( const btTransform trans0,
const btTransform trans1 
)

Calc the transformation relative 1 to 0. Inverts matrics by transposing.

Definition at line 182 of file btBoxCollision.h.

References btTransform, calc_absolute_matrix(), and m_R1to0.

◆ calc_from_triangle()

template<typename CLASS_POINT >
SIMD_FORCE_INLINE void calc_from_triangle ( const CLASS_POINT &  V1,
const CLASS_POINT &  V2,
const CLASS_POINT &  V3 
)

Definition at line 305 of file btBoxCollision.h.

References BT_MAX3, BT_MIN3, and m_max.

◆ calc_from_triangle_margin()

template<typename CLASS_POINT >
SIMD_FORCE_INLINE void calc_from_triangle_margin ( const CLASS_POINT &  V1,
const CLASS_POINT &  V2,
const CLASS_POINT &  V3,
btScalar  margin 
)

Definition at line 320 of file btBoxCollision.h.

References BT_MAX3, BT_MIN3, and m_max.

◆ collide_plane()

SIMD_FORCE_INLINE bool collide_plane ( const btVector4 plane) const

Simple test for planes.

Definition at line 554 of file btBoxCollision.h.

References BT_CONST_COLLIDE_PLANE, and plane_classify().

Referenced by collide_triangle_exact().

◆ collide_ray()

SIMD_FORCE_INLINE bool collide_ray ( const btVector3 vorigin,
const btVector3 vdir 
) const

Finds the Ray intersection parameter.

Parameters
aabbAligned box
voriginA vec3f with the origin of the ray
vdirA vec3f with the direction of the ray

Definition at line 436 of file btBoxCollision.h.

References BT_GREATER, btFabs(), btVector3, center, and get_center_extend().

◆ collide_triangle_exact()

SIMD_FORCE_INLINE bool collide_triangle_exact ( const btVector3 p1,
const btVector3 p2,
const btVector3 p3,
const btVector4 triangle_plane 
) const

◆ copy_with_margin()

SIMD_FORCE_INLINE void copy_with_margin ( const btAABB other,
btScalar  margin 
)

Definition at line 293 of file btBoxCollision.h.

References m_max.

◆ find_intersection()

SIMD_FORCE_INLINE void find_intersection ( const btAABB other,
btAABB intersection 
) const

Finds the intersecting box between this box and the other.

Definition at line 406 of file btBoxCollision.h.

References BT_MAX, BT_MIN, and m_max.

◆ get_center_extend()

SIMD_FORCE_INLINE void get_center_extend ( btVector3 center,
btVector3 extend 
) const

Gets the extend and center.

Definition at line 399 of file btBoxCollision.h.

References center, and m_max.

Referenced by collide_ray(), collide_triangle_exact(), and overlapping_trans_cache().

◆ has_collision()

SIMD_FORCE_INLINE bool has_collision ( const btAABB other) const

Definition at line 417 of file btBoxCollision.h.

References m_max.

Referenced by overlapping_trans_conservative(), and overlapping_trans_conservative2().

◆ increment_margin()

SIMD_FORCE_INLINE void increment_margin ( btScalar  margin)

Definition at line 283 of file btBoxCollision.h.

References m_max.

◆ invalidate()

SIMD_FORCE_INLINE void invalidate ( )

Definition at line 273 of file btBoxCollision.h.

References m_max, and SIMD_INFINITY.

Referenced by BM_mesh_decimate_collapse().

◆ merge()

SIMD_FORCE_INLINE void merge ( const btAABB box)

Merges a Box.

Definition at line 374 of file btBoxCollision.h.

References BT_MAX, BT_MIN, and m_max.

◆ merge_point()

template<typename CLASS_POINT >
SIMD_FORCE_INLINE void merge_point ( const CLASS_POINT &  point)

Merges a point.

Definition at line 387 of file btBoxCollision.h.

References BT_MAX, BT_MIN, m_max, and point.

◆ overlapping_trans_cache()

SIMD_FORCE_INLINE bool overlapping_trans_cache ( const btAABB box,
const BT_BOX_BOX_TRANSFORM_CACHE transcache,
bool  fulltest 
) const

transcache is the transformation cache from box to this AABB

Definition at line 502 of file btBoxCollision.h.

References BT_GREATER, bt_mat3_dot_col(), btVector3, get_center_extend(), r, T, and t.

◆ overlapping_trans_conservative()

SIMD_FORCE_INLINE bool overlapping_trans_conservative ( const btAABB box,
btTransform trans1_to_0 
) const

Definition at line 486 of file btBoxCollision.h.

References btAABB, and has_collision().

◆ overlapping_trans_conservative2()

SIMD_FORCE_INLINE bool overlapping_trans_conservative2 ( const btAABB box,
const BT_BOX_BOX_TRANSFORM_CACHE trans1_to_0 
) const

Definition at line 493 of file btBoxCollision.h.

References btAABB, and has_collision().

◆ plane_classify()

SIMD_FORCE_INLINE eBT_PLANE_INTERSECTION_TYPE plane_classify ( const btVector4 plane) const

◆ projection_interval()

SIMD_FORCE_INLINE void projection_interval ( const btVector3 direction,
btScalar vmin,
btScalar vmax 
) const

Definition at line 458 of file btBoxCollision.h.

References btVector3, center, and m_max.

Referenced by plane_classify().

◆ transform()

SIMD_FORCE_INLINE btVector3 transform ( const btVector3 point) const

Definition at line 205 of file btBoxCollision.h.

References m_R1to0, and point.

Referenced by accessor_get_ibuf(), accessor_get_image_callback(), InstancesComponent::add_instance(), BCMatrix::add_inverted_transform(), AnimationExporter::add_source_parameters(), BCMatrix::add_transform(), BCMatrix::apply_transform(), Freestyle::ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(), AnimationImporter::Assign_transform_animations(), autokeyframe_sequencer_image(), Freestyle::AverageAreaGridDensityProvider::AverageAreaGridDensityProvider(), bc_apply_global_transform(), BKE_shrinkwrap_compute_smooth_normal(), BKE_shrinkwrap_snap_point_to_surface(), BKE_volume_grid_transform_matrix(), blf_glyph_transform_slant(), btGImpactBvh::boxQueryTrans(), btGImpactQuantizedBvh::boxQueryTrans(), GIM_BOX_TREE_TEMPLATE_SET< _GIM_PRIMITIVE_MANAGER_PROTOTYPE, _GIM_BOX_TREE_PROTOTYPE >::boxQueryTrans(), Freestyle::GridDensityProvider::calculateQuickProscenium(), cloth_filter_apply_forces_task_cb(), Freestyle::ViewMapBuilder::ComputeCumulativeVisibility(), Freestyle::ViewMapBuilder::ComputeDetailedVisibility(), HdCyclesInstancer::ComputeInstanceTransforms(), FallbackImpl::configGetProcessorWithNames(), blender::nodes::node_geo_mesh_primitive_ico_sphere_cc::create_ico_sphere_mesh(), blender::nodes::node_geo_scale_elements_cc::create_single_axis_transform(), FallbackImpl::createDisplayProcessor(), do_transform_effect(), btIDebugDraw::drawCapsule(), btIDebugDraw::drawCone(), btIDebugDraw::drawCylinder(), btIDebugDraw::drawPlane(), btIDebugDraw::drawSphere(), btIDebugDraw::drawTransform(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_instances(), InstancesComponent::ensure_geometry_instances(), exr_has_rgb(), AnimationImporter::find_frames_old(), Freestyle::GeomUtils::fromCoordAToCoordB(), Freestyle::GeomUtils::fromWorldToImage(), blender::geometry::gather_realize_tasks_for_instances(), blender::bke::geometry_set_collect_recursive(), blender::bke::geometry_set_collect_recursive_collection(), blender::bke::geometry_set_collect_recursive_collection_instance(), blender::bke::geometry_set_collect_recursive_object(), AnimationImporter::get_animation_type(), blender::ed::sculpt_paint::SlideOperationExecutor::get_slide_transform(), blender::bke::get_transform_position(), gim_inertia_add_transformed(), gizmo2d_calc_rotation(), init_transform_effect(), blender::nodes::node_geo_join_geometry_cc::join_components(), libmv_frameAccessorgetTransformKey(), libmv_frameAccessorgetTransformRun(), mesh_filter_task_cb(), modifyMesh(), Freestyle::ArbitraryGridDensityProviderFactory::newGridDensityProvider(), Freestyle::AverageAreaGridDensityProviderFactory::newGridDensityProvider(), Freestyle::HeuristicGridDensityProviderFactory::newGridDensityProvider(), Freestyle::Pow23GridDensityProviderFactory::newGridDensityProvider(), blender::nodes::node_geo_collection_info_cc::node_geo_exec(), blender::nodes::node_geo_object_info_cc::node_geo_exec(), GHOST_DirectManipulationViewportEventHandler::OnContentUpdated(), output_handle_geometry(), Freestyle::Pow23GridDensityProvider::Pow23GridDensityProvider(), blender::geometry::realize_instances(), recalcData_sequencer_image(), blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center_with_symmetry(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical_with_symmetry(), SEQ_image_transform_origin_offset_pixelspace_get(), seq_image_transform_quad_get_ex(), SEQ_set_scale_to_fit(), seq_transform_filter_set(), seq_transform_origin_set(), SeqToTransData(), sequencer_image_crop_transform_matrix(), sequencer_preprocess_transform_crop(), sequencer_strip_transform_clear_exec(), sequencer_use_transform(), blender::bke::set_transform_position(), btGImpactCompoundShape::setChildTransform(), btGImpactMeshShapePart::setChildTransform(), btGImpactMeshShape::setChildTransform(), shrinkwrap_get_tarmat(), special_aftertrans_update__sequencer_image(), string_to_lower(), blender::ed::sculpt_paint::transform_brush_radius(), blender::nodes::transform_curve_edit_hints(), blender::nodes::transform_geometry_set(), blender::nodes::transform_instances(), blender::nodes::transform_mesh(), blender::nodes::transform_pointcloud(), blender::nodes::transform_volume(), AnimationImporter::translate_Animations(), and blender::nodes::translate_instances().

Variable Documentation

◆ BT_BOX_BOX_TRANSFORM_CACHE

BT_BOX_BOX_TRANSFORM_CACHE
Initial value:
{
public:
btVector3 m_T1to0
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82

Class for transforming a model1 to the space of model0.

Transforms translation of model1 to model 0

Definition at line 152 of file btBoxCollision.h.

Referenced by btGImpactBvh::find_collision(), and btGImpactQuantizedBvh::find_collision().

◆ btAABB

btAABB

◆ m_AR

Absolute value of m_R1to0.

Definition at line 157 of file btBoxCollision.h.

Referenced by calc_absolute_matrix().

◆ m_max

btVector3 m_max

◆ m_R1to0

btMatrix3x3 m_R1to0

Transforms Rotation of model1 to model 0, equal to R0' * R1.

Definition at line 156 of file btBoxCollision.h.

Referenced by calc_absolute_matrix(), calc_from_full_invert(), calc_from_homogenic(), and transform().