Vec3faxis[3];// R[i] is the ith column of the orientation matrix, or the axis of the OBB
/// @brief Orientation of OBB. axis[i] is the ith column of the orientation matrix for the box; it is also the i-th principle direction of the box.
/// We assume that axis[0] corresponds to the axis with the longest box edge, axis[1] corresponds to the shorter one and axis[2] corresponds to the shortest one.
Vec3faxis[3];
/** \brief center of OBB */
/// @brief Center of OBB
Vec3fTo;
/** \brief Half dimensions of OBB */
/// @brief Half dimensions of OBB
Vec3fextent;
OBB(){}
/** \brief Check collision between two OBB */
/// @brief Check collision between two OBB, return true if collision happens.
booloverlap(constOBB&other)const;
/** \brief Check collision between two OBB and return the overlap part.
* For OBB, we return nothing, as the overlap part of two obbs usually is not an obb
*/
/// @brief Check collision between two OBB and return the overlap part. For OBB, the overlap_part return value is NOT used as the overlap part of two obbs usually is not an obb.
booloverlap(constOBB&other,OBB&overlap_part)const
{
returnoverlap(other);
}
/** \brief Check whether the OBB contains a point */
/// @brief Check whether the OBB contains a point.
boolcontain(constVec3f&p)const;
/** \brief A simple way to merge the OBB and a point, not compact. */
/// @brief A simple way to merge the OBB and a point (the result is not compact).
OBB&operator+=(constVec3f&p);
/** \brief Merge the OBB and another OBB */
/// @brief Merge the OBB and another OBB (the result is not compact).
OBB&operator+=(constOBB&other)
{
*this=*this+other;
return*this;
}
/** \brief Return the merged OBB of current OBB and the other one */
/// @brief Return the merged OBB of current OBB and the other one (the result is not compact).
OBBoperator+(constOBB&other)const;
/** \brief Width of the OBB */
/// @brief Width of the OBB.
inlineFCL_REALwidth()const
{
return2*extent[0];
}
/** \brief Height of the OBB */
/// @brief Height of the OBB.
inlineFCL_REALheight()const
{
return2*extent[1];
}
/** \brief Depth of the OBB */
/// @brief Depth of the OBB
inlineFCL_REALdepth()const
{
return2*extent[2];
}
/** \brief Volume of the OBB */
/// @brief Volume of the OBB
inlineFCL_REALvolume()const
{
returnwidth()*height()*depth();
}
/** \brief Size of the OBB, for split order */
/// @brief Size of the OBB (used in BV_Splitter to order two OBBs)
/// @brief Computate distance between two OBBRSS, b1 is in configuation (R0, T0) and b2 is in indentity; P and Q, is not NULL, returns the nearest points
/// @brief A class for rectangle sphere-swept bounding volume
classRSS
{
public:
/** \brief Orientation of RSS */
/// @brief Orientation of RSS. axis[i] is the ith column of the orientation matrix for the RSS; it is also the i-th principle direction of the RSS.
/// We assume that axis[0] corresponds to the axis with the longest length, axis[1] corresponds to the shorter one and axis[2] corresponds to the shortest one.
Vec3faxis[3];
/** \brief position of rectangle (origin of the rectangle) */
/// @brief Origin of the rectangle in RSS
Vec3fTr;
/** \brief side lengths of rectangle */
/// @brief Side lengths of rectangle
FCL_REALl[2];
/** \brief radius of sphere summed with rectangle to form RSS */
/// @brief Radius of sphere summed with rectangle to form RSS
FCL_REALr;
RSS(){}
/** \brief Check collision between two RSS */
/// @brief Check collision between two RSS
booloverlap(constRSS&other)const;
/** \brief Check collision between two RSS and return the overlap part.
* For RSS, we return nothing, as the overlap part of two RSSs usually is not a RSS
*/
/// @brief Check collision between two RSS and return the overlap part.
/// For RSS, we return nothing, as the overlap part of two RSSs usually is not a RSS.
booloverlap(constRSS&other,RSS&overlap_part)const
{
returnoverlap(other);
}
/** \brief Check whether the RSS contains a point */
/// @brief Check whether the RSS contains a point
inlineboolcontain(constVec3f&p)const;
/** \brief A simple way to merge the RSS and a point, not compact.
* THIS FUNCTION STILL HAS PROBLEM!!
*/
/// @brief A simple way to merge the RSS and a point, not compact.
/// @todo This function may have some bug.
RSS&operator+=(constVec3f&p);
/** \brief Merge the RSS and another RSS */
/// @brief Merge the RSS and another RSS
inlineRSS&operator+=(constRSS&other)
{
*this=*this+other;
return*this;
}
/** \brief Return the merged RSS of current RSS and the other one */
/// @brief Return the merged RSS of current RSS and the other one