51 lines
2.1 KiB
Java
51 lines
2.1 KiB
Java
package org.atriaSoft.ephysics.collision.shapes;
|
|
|
|
/**
|
|
* @brief This class represents a cone collision shape centered at the
|
|
* origin and alligned with the Y axis. The cone is defined
|
|
* by its height and by the radius of its base. The center of the
|
|
* cone is at the half of the height. The "transform" of the
|
|
* corresponding rigid body gives an orientation and a position
|
|
* to the cone. This collision shape uses an extra margin distance around
|
|
* it for collision detection purpose. The default margin is 4cm (if your
|
|
* units are meters, which is recommended). In case, you want to simulate small
|
|
* objects (smaller than the margin distance), you might want to reduce the margin
|
|
* by specifying your own margin distance using the "margin" parameter in the
|
|
* ructor of the cone shape. Otherwise, it is recommended to use the
|
|
* default margin distance by not using the "margin" parameter in the ructor.
|
|
*/
|
|
class ConeShape extends ConvexShape {
|
|
public :
|
|
/**
|
|
* @brief Constructor
|
|
* @param radius Radius of the cone (in meters)
|
|
* @param height Height of the cone (in meters)
|
|
* @param margin Collision margin (in meters) around the collision shape
|
|
*/
|
|
ConeShape(float radius, float height, float margin = OBJECTMARGIN);
|
|
protected :
|
|
float radius; //!< Radius of the base
|
|
float halfHeight; //!< Half height of the cone
|
|
float sinTheta; //!< sine of the semi angle at the apex point
|
|
Vector3f getLocalSupportPointWithoutMargin( Vector3f direction, void** cachedCollisionData) ;
|
|
boolean testPointInside( Vector3f localPoint, ProxyShape* proxyShape) ;
|
|
boolean raycast( Ray ray, RaycastInfo raycastInfo, ProxyShape* proxyShape) ;
|
|
long getSizeInBytes() ;
|
|
public:
|
|
/**
|
|
* @brief Return the radius
|
|
* @return Radius of the cone (in meters)
|
|
*/
|
|
float getRadius();
|
|
/**
|
|
* @brief Return the height
|
|
* @return Height of the cone (in meters)
|
|
*/
|
|
float getHeight();
|
|
|
|
void setLocalScaling( Vector3f scaling) ;
|
|
void getLocalBounds(Vector3f min, Vector3f max) ;
|
|
void computeLocalInertiaTensor(Matrix3f tensor, float mass) ;
|
|
};
|
|
}
|