Logo Search packages:      
Sourcecode: blender version File versions

ATTRIBUTE_ALIGNED16 ( class   ) 

Class for transforming a model1 to the space of model0.

Axis aligned box.

Apply a transform to an AABB

Apply a transform to an AABB

Merges a Box

Merges a point

Gets the extend and center

Finds the intersecting box between this box and the other.

Finds the Ray intersection parameter.

Parameters:
aabb Aligned box
vorigin A vec3f with the origin of the ray
vdir A vec3f with the direction of the ray
transcache is the transformation cache from box to this AABB

Simple test for planes.

test for a triangle, with edges

Definition at line 164 of file btBoxCollision.h.

References btTransform::getBasis(), btTransform::getOrigin(), btMatrix3x3::inverse(), btTransform::inverse(), btQuadWord::x(), btQuadWord::y(), and btQuadWord::z().

Referenced by btDbvtBroadphase::getBroadphaseAabb().

{
public:
    btVector3  m_T1to0;//!< Transforms translation of model1 to model 0
      btMatrix3x3 m_R1to0;//!< Transforms Rotation of model1 to model 0, equal  to R0' * R1
      btMatrix3x3 m_AR;//!< Absolute value of m_R1to0

      SIMD_FORCE_INLINE void calc_absolute_matrix()
      {
//          static const btVector3 vepsi(1e-6f,1e-6f,1e-6f);
//          m_AR[0] = vepsi + m_R1to0[0].absolute();
//          m_AR[1] = vepsi + m_R1to0[1].absolute();
//          m_AR[2] = vepsi + m_R1to0[2].absolute();

            int i,j;

        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++ )
            {
                  m_AR[i][j] = 1e-6f + fabsf(m_R1to0[i][j]);
            }
        }

      }

      BT_BOX_BOX_TRANSFORM_CACHE()
      {
      }



      //! Calc the transformation relative  1 to 0. Inverts matrics by transposing
      SIMD_FORCE_INLINE void calc_from_homogenic(const btTransform & trans0,const btTransform & trans1)
      {

            btTransform temp_trans = trans0.inverse();
            temp_trans = temp_trans * trans1;

            m_T1to0 = temp_trans.getOrigin();
            m_R1to0 = temp_trans.getBasis();


            calc_absolute_matrix();
      }

      //! Calcs the full invertion of the matrices. Useful for scaling matrices
      SIMD_FORCE_INLINE void calc_from_full_invert(const btTransform & trans0,const btTransform & trans1)
      {
            m_R1to0 = trans0.getBasis().inverse();
            m_T1to0 = m_R1to0 * (-trans0.getOrigin());

            m_T1to0 += m_R1to0*trans1.getOrigin();
            m_R1to0 *= trans1.getBasis();

            calc_absolute_matrix();
      }

      SIMD_FORCE_INLINE btVector3 transform(const btVector3 & point) const
      {
            return btVector3(m_R1to0[0].dot(point) + m_T1to0.x(),
                  m_R1to0[1].dot(point) + m_T1to0.y(),
                  m_R1to0[2].dot(point) + m_T1to0.z());
      }
};


Generated by  Doxygen 1.6.0   Back to index