乐趣区

关于编辑器:Chai-3D之形状基元

举荐:将 NSDT 场景编辑器 退出你的 3D 开发工具链介绍 

 尽管网格对象的通用性令人难以置信,但当多边形数量变大时,在工具和对象之间执行碰撞检测所需的计算量可能会变得很大。为了解决这个问题,CHAI3D 提供了一系列可用于模仿简略形态的基元,如球体、圆柱体、盒子等。隐式模型不是计算与大型三角形集的碰撞,而是用于疾速计算工具是位于形态外部还是内部。通过将这些模型与触觉成果相结合,咱们能够大大减少计算触觉设施和环境之间交互力所需的计算量。

形态基元长方体对象上面的示例演示如何创立框对象并指定外表触觉成果。using namespace chai3d;// create a box and define its dimensionsobject = new cShapeBox(0.1, 0.2, 0.3)// add object to worldworld->addChild(object);// set haptic propertiesobject->m_material->setStiffness(500);// create a haptic surface effectobject->createEffectSurface(); 球体对象上面的示例阐明如何创立球体对象并指定外表触觉成果。using namespace chai3d;// create a sphere and define its radiusobject = new cShapeSphere(0.3);// add object to worldworld->addChild(object);// set haptic propertiesobject->m_material->setStiffness(500);// create a haptic surface effectobject->createEffectSurface(); 圆柱体对象上面的示例演示如何创立圆柱对象并指定外表触觉成果。using namespace chai3d;// create a cylinder by defining its bottom and top radius, and its heightobject = new cShapeCylinder(0.1, 0.1, 0.3)// add object to worldworld->addChild(object);// set haptic propertiesobject->m_material->setStiffness(500);// create a haptic surface effectobject->createEffectSurface(); 圆环体对象上面的示例阐明如何创立圆环对象并指定外表触觉成果。using namespace chai3d;// create a torusobject = new cShapeTorus(0.25, 0.50);// add object to worldworld->addChild(object);// set haptic propertiesobject->m_material->setStiffness(500);// create a haptic surface effectobject->createEffectSurface();line 对象上面的示例阐明如何创立线条对象并调配磁性触觉成果。using namespace chai3d;// create a lineline = new cShapeLine(cVector3d(0.0, 0.0, 0.0), cVector3d(1.0, 1.0, 1.0));world->addChild(line);// set color at each pointline->m_colorPointA.setWhite();line->m_colorPointB.setWhite();// create haptic effect and set haptic propertiesline->createEffectMagnetic();line->m_material->setMagnetMaxDistance(0.05);line->m_material->setMagnetMaxForce(5.0);line->m_material->setStiffness(500);

https://www.mvrlink.com/chai3d-shape-primitives/

退出移动版