关于人工智能:Chai-3D之形状基元

1次阅读

共计 1782 个字符,预计需要花费 5 分钟才能阅读完成。

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

介绍

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

形态基元长方体对象上面的示例演示如何创立框对象并指定外表触觉成果。

using namespace chai3d;
// create a box and define its dimensions
object = new cShapeBox(0.1, 0.2, 0.3)
// add object to world
world->addChild(object);
// set haptic properties
object->m_material->setStiffness(500);
// create a haptic surface effect
object->createEffectSurface();

球体对象

上面的示例阐明如何创立球体对象并指定外表触觉成果。

using namespace chai3d;
// create a sphere and define its radius
object = new cShapeSphere(0.3);
// add object to world
world->addChild(object);
// set haptic properties
object->m_material->setStiffness(500);
// create a haptic surface effect
object->createEffectSurface();

圆柱体对象

上面的示例演示如何创立圆柱对象并指定外表触觉成果

using namespace chai3d;
// create a cylinder by defining its bottom and top radius, and its height
object = new cShapeCylinder(0.1, 0.1, 0.3)
// add object to world
world->addChild(object);
// set haptic properties
object->m_material->setStiffness(500);
// create a haptic surface effect
object->createEffectSurface();

圆环体对象

上面的示例阐明如何创立圆环对象并指定外表触觉成果。

using namespace chai3d;
// create a torus
object = new cShapeTorus(0.25, 0.50);
// add object to world
world->addChild(object);
// set haptic properties
object->m_material->setStiffness(500);
// create a haptic surface effect
object->createEffectSurface();

line 对象

上面的示例阐明如何创立线条对象并调配磁性触觉成果。

using namespace chai3d;
// create a line
line = new cShapeLine(cVector3d(0.0, 0.0, 0.0), cVector3d(1.0, 1.0, 1.0));
world->addChild(line);
// set color at each point
line->m_colorPointA.setWhite();
line->m_colorPointB.setWhite();
// create haptic effect and set haptic properties
line->createEffectMagnetic();
line->m_material->setMagnetMaxDistance(0.05);
line->m_material->setMagnetMaxForce(5.0);
line->m_material->setStiffness(500);

3D 建模学习工作室翻译整顿,转载请表明出处!

正文完
 0