📄 obbcollision.h
字号:
// OBBCollision.h: interface for the COBBCollision class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_OBBCOLLISION_H__DE22BB81_444C_4CA2_9A36_6FCFDA13F180__INCLUDED_)
#define AFX_OBBCOLLISION_H__DE22BB81_444C_4CA2_9A36_6FCFDA13F180__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//#include "Matrix.h"
//#include "Vector3.h"
#include "Screws.h"
struct point
{
float x;
float y;
float z;
};
struct element
{
int NUMPTS;
struct point center_point;
struct point points[72];
struct point max;
struct point min;
};
struct object
{
int NUMPTS;
CMatrix center_pointgst;
struct point center_point;
struct point points[50];
struct point max;
struct point min;
};
struct object_cylinder
{
int NUMELE_i,NUMELE_j;
struct point center_point[48];
struct element elements[48][72];
};
class COBBCollision
{
public:
void Build_Mold();
void Build_MoldGst();
void Collision_Detection();
struct object objects[3];
struct object hand[3][5];
struct object_cylinder hand_cylinder[3];
float first[3];
float second[3];
float third[3];
struct point fingerInit[3];
bool ob_Sphere,ob_Box,ob_Cylinder;
float ob_Sphere_radius;
float ob_Box_length,ob_Box_width,ob_Box_height;
float ob_Cylinder_radius,ob_Cylinder_height;
float moveX,moveY,moveZ;
float rotatedX,rotatedY,rotatedZ;
float hand_ry;//虚拟手绕y轴的旋转角度
float hand_rx;//虚拟手绕x轴的旋转角度
float hand_rz;//虚拟手绕z轴的旋转角度
/*
//手指各关节质心位形
CMatrix finger11c_pgst;
CMatrix finger12c_pgst;
CMatrix finger13c_pgst;
CMatrix finger21c_pgst;
CMatrix finger22c_pgst;
CMatrix finger23c_pgst;
CMatrix finger31c_pgst;
CMatrix finger32c_pgst;
CMatrix finger33c_pgst;
*/
COBBCollision();
virtual ~COBBCollision();
private:
void BoundingBox(struct point points[8],struct point *max,struct point *min);
void Vertex_Cylinder(struct point points[64],float radius, float height);
void Point_Center(struct point *ptr,struct point pt1,struct point pt2,int i,int n);
void Translate(struct point *ptr,struct point center_point);
void RotateZ(struct point *ptr,float angle);
void RotateY(struct point *ptr,float angle);
void RotateX(struct point *ptr,float angle);
void Dingdian_Zuobiao(struct point points[8],struct point center_point,double x,double y,double z,double angle0=0.0,double angle1=0.0);
void Dingdian_ZuobiaoGst(struct point points[8],CMatrix center_pointgst,double x,double y,double z);
float width,radius;//指关节的宽度
float flength,slength,tlength,length;//指关节的长度
};
#endif // !defined(AFX_OBBCOLLISION_H__DE22BB81_444C_4CA2_9A36_6FCFDA13F180__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -