本文整理汇总了C++中Triangle3D::barycentricCoords方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle3D::barycentricCoords方法的具体用法?C++ Triangle3D::barycentricCoords怎么用?C++ Triangle3D::barycentricCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangle3D
的用法示例。
在下文中一共展示了Triangle3D::barycentricCoords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ContactNormal
//Returns a contact normal for the closest point to the triangle t. p is the point on the triangle.
//The direction is the one in which triangle 1 can move to get away from closestpt
Vector3 ContactNormal(const CollisionMesh& m,const Vector3& p,int t,const Vector3& closestPt)
{
Triangle3D tri;
m.GetTriangle(t,tri);
Vector3 b=tri.barycentricCoords(p);
int type=FeatureType(b);
switch(type) {
case 1: //pt
//get the triangle normal
{
Vector3 n = VertexNormal(m,t,VertexIndex(b));
n.inplaceNegative();
return n;
}
break;
case 2: //edge
{
int e = EdgeIndex(b);
Vector3 n = EdgeNormal(m,t,e);
n.inplaceNegative();
return n;
}
break;
case 3: //face
return m.currentTransform.R*(-tri.normal());
}
static int warnedCount = 0;
if(warnedCount % 10000 == 0)
printf("ODECustomMesh: Warning, degenerate triangle, types %d\n",type);
warnedCount++;
//AssertNotReached();
return Vector3(Zero);
}