Пример #1
0
void SimObjBase::setRotation(const Rotation &r)
{
	if (dynamics()) { return; }
	
	const dReal *q = r.q();
	setQ(q);
}
Пример #2
0
void SimObjBase::setAxisAndAngle(double ax, double ay, double az, double angle)
{
	if (dynamics()) { return; }

	Rotation r;
	r.setAxisAndAngle(ax, ay, az, angle);
	const dReal *q = r.q();
	setQ(q);
}
Пример #3
0
/*!
 * @brief It rotates for the specification of the relative angle.
 * @param[in] x-axis rotation weather(i of quaternion complex part)
 * @param[in] y-axis rotation weather(j of quaternion complex part)
 * @param[in] z-axis rotation weather(k of quaternion complex part)
 * @param[in] flag for ansolute / relational (1.0=absolute, else=relational)
 */
void SimObjBase::setAxisAndAngle(double ax, double ay, double az, double angle, double direct)
{
  // The angle is used now at the relative angle specification.
  if (dynamics()) { return; }


  Rotation r;
  if (direct != 1.0) r.setQuaternion(qw(), qx(), qy(), qz());

  // alculate relational angle
  r.setAxisAndAngle(ax, ay, az, angle, direct);
  const dReal *q = r.q();
  setQ(q);

}
Пример #4
0
void SParts::build(const Vector3d &ov, const Rotation &r, bool dynamics)
{
	if (isBody()) {
		const dReal *q = r.q();
		setPosition(ov);
		setQuaternion(q);
	}
	else {
		Vector3d v(m_pos.x(), m_pos.y(), m_pos.z());
		v.rotate(r);
		v += ov;
		setPosition(v);

		Rotation rr(r);
		rr *= m_rot;

		setRotation(rr);
	}

	enableDynamics(dynamics);
}