当前位置: 首页>>代码示例>>C++>>正文


C++ ChMatrix33::Get33Element方法代码示例

本文整理汇总了C++中ChMatrix33::Get33Element方法的典型用法代码示例。如果您正苦于以下问题:C++ ChMatrix33::Get33Element方法的具体用法?C++ ChMatrix33::Get33Element怎么用?C++ ChMatrix33::Get33Element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ChMatrix33的用法示例。


在下文中一共展示了ChMatrix33::Get33Element方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AABB_Overlap

bool CHAABB::AABB_Overlap(ChMatrix33<>& B, Vector T, CHAABB *b1, CHAABB *b2)
{
	  ChMatrix33<> Bf;
	  const double reps = (double)1e-6;

	  // Bf = fabs(B)
	  Bf(0,0) = myfabs(B.Get33Element(0,0));  Bf(0,0) += reps;
	  Bf(0,1) = myfabs(B.Get33Element(0,1));  Bf(0,1) += reps;
	  Bf(0,2) = myfabs(B.Get33Element(0,2));  Bf(0,2) += reps;
	  Bf(1,0) = myfabs(B.Get33Element(1,0));  Bf(1,0) += reps;
	  Bf(1,1) = myfabs(B.Get33Element(1,1));  Bf(1,1) += reps;
	  Bf(1,2) = myfabs(B.Get33Element(1,2));  Bf(1,2) += reps;
	  Bf(2,0) = myfabs(B.Get33Element(2,0));  Bf(2,0) += reps;
	  Bf(2,1) = myfabs(B.Get33Element(2,1));  Bf(2,1) += reps;
	  Bf(2,2) = myfabs(B.Get33Element(2,2));  Bf(2,2) += reps;

	  return AABB_Overlap(B, Bf, T, b1, b2);
}
开发者ID:DavidHammen,项目名称:chrono,代码行数:18,代码来源:ChCAABB.cpp

示例2: OBB_Overlap

bool CHOBB::OBB_Overlap(ChMatrix33<>& B, Vector T, Vector a, Vector b)
{
	  register double t, s;
	  register int r;
	  static ChMatrix33<> Bf;
	  const double reps = (double)1e-6;

	  //Vector& a = b1->d;
	  //Vector& b = b2->d;

	  // Bf = fabs(B)
	  Bf(0,0) = myfabs(B.Get33Element(0,0));  Bf(0,0) += reps;
	  Bf(0,1) = myfabs(B.Get33Element(0,1));  Bf(0,1) += reps;
	  Bf(0,2) = myfabs(B.Get33Element(0,2));  Bf(0,2) += reps;
	  Bf(1,0) = myfabs(B.Get33Element(1,0));  Bf(1,0) += reps;
	  Bf(1,1) = myfabs(B.Get33Element(1,1));  Bf(1,1) += reps;
	  Bf(1,2) = myfabs(B.Get33Element(1,2));  Bf(1,2) += reps;
	  Bf(2,0) = myfabs(B.Get33Element(2,0));  Bf(2,0) += reps;
	  Bf(2,1) = myfabs(B.Get33Element(2,1));  Bf(2,1) += reps;
	  Bf(2,2) = myfabs(B.Get33Element(2,2));  Bf(2,2) += reps;

	  // if any of these tests are one-sided, then the polyhedra are disjoint
	  r = 1;

	  // A1 x A2 = A0
	  t = myfabs(T.x);

	  r &= (t <=
		  (a.x + b.x * Bf.Get33Element(0,0) + b.y * Bf.Get33Element(0,1) + b.z * Bf.Get33Element(0,2)));
	  if (!r) return false;

	  // B1 x B2 = B0
	  s = T.x*B.Get33Element(0,0) + T.y*B.Get33Element(1,0) + T.z*B.Get33Element(2,0);
	  t = myfabs(s);

	  r &= ( t <=
		  (b.x + a.x * Bf.Get33Element(0,0) + a.y * Bf.Get33Element(1,0) + a.z * Bf.Get33Element(2,0)));
	  if (!r) return false;

	  // A2 x A0 = A1
	  t = myfabs(T.y);

	  r &= ( t <=
		  (a.y + b.x * Bf.Get33Element(1,0) + b.y * Bf.Get33Element(1,1) + b.z * Bf.Get33Element(1,2)));
	  if (!r) return false;

	  // A0 x A1 = A2
	  t = myfabs(T.z);

	  r &= ( t <=
		  (a.z + b.x * Bf.Get33Element(2,0) + b.y * Bf.Get33Element(2,1) + b.z * Bf.Get33Element(2,2)));
	  if (!r) return false;

	  // B2 x B0 = B1
	  s = T.x*B.Get33Element(0,1) + T.y*B.Get33Element(1,1) + T.z*B.Get33Element(2,1);
	  t = myfabs(s);

	  r &= ( t <=
		  (b.y + a.x * Bf.Get33Element(0,1) + a.y * Bf.Get33Element(1,1) + a.z * Bf.Get33Element(2,1)));
	  if (!r) return false;

	  // B0 x B1 = B2
	  s = T.x*B.Get33Element(0,2) + T.y*B.Get33Element(1,2) + T.z*B.Get33Element(2,2);
	  t = myfabs(s);

	  r &= ( t <=
		  (b.z + a.x * Bf.Get33Element(0,2) + a.y * Bf.Get33Element(1,2) + a.z * Bf.Get33Element(2,2)));
	  if (!r) return false;

	  // A0 x B0
	  s = T.z * B.Get33Element(1,0) - T.y * B.Get33Element(2,0);
	  t = myfabs(s);

	  r &= ( t <=
		(a.y * Bf.Get33Element(2,0) + a.z * Bf.Get33Element(1,0) +
		 b.y * Bf.Get33Element(0,2) + b.z * Bf.Get33Element(0,1)));
	  if (!r) return false;

	  // A0 x B1
	  s = T.z * B.Get33Element(1,1) - T.y * B.Get33Element(2,1);
	  t = myfabs(s);

	  r &= ( t <=
		(a.y * Bf.Get33Element(2,1) + a.z * Bf.Get33Element(1,1) +
		 b.x * Bf.Get33Element(0,2) + b.z * Bf.Get33Element(0,0)));
	  if (!r) return false;

	  // A0 x B2
	  s = T.z * B.Get33Element(1,2) - T.y * B.Get33Element(2,2);
	  t = myfabs(s);

	  r &= ( t <=
		  (a.y * Bf.Get33Element(2,2) + a.z * Bf.Get33Element(1,2) +
		   b.x * Bf.Get33Element(0,1) + b.y * Bf.Get33Element(0,0)));
	  if (!r) return false;

	  // A1 x B0
	  s = T.x * B.Get33Element(2,0) - T.z * B.Get33Element(0,0);
	  t = myfabs(s);

//.........这里部分代码省略.........
开发者ID:DavidHammen,项目名称:chrono,代码行数:101,代码来源:ChCOBB.cpp


注:本文中的ChMatrix33::Get33Element方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。