コード例 #1
0
//=============================================================================
// Simbody Model building.
//=============================================================================
//_____________________________________________________________________________
void PinJoint::addToSystem(SimTK::MultibodySystem& system) const
{
	const SimTK::Vec3& orientation = getProperty_orientation().getValue();
	const SimTK::Vec3& location = getProperty_location().getValue();

	// CHILD TRANSFORM
	Rotation rotation(BodyRotationSequence, orientation[0],XAxis, orientation[1],YAxis, orientation[2],ZAxis);
	SimTK::Transform childTransform(rotation, location);

	const SimTK::Vec3& orientationInParent = getProperty_orientation_in_parent().getValue();
	const SimTK::Vec3& locationInParent = getProperty_location_in_parent().getValue();

	// PARENT TRANSFORM
	Rotation parentRotation(BodyRotationSequence, orientationInParent[0],XAxis, orientationInParent[1],YAxis, orientationInParent[2],ZAxis);
	SimTK::Transform parentTransform(parentRotation, locationInParent);

	PinJoint* mutableThis = const_cast<PinJoint*>(this);
	mutableThis->createMobilizedBody(parentTransform, childTransform);

    // TODO: Joints require super class to be called last.
    Super::addToSystem(system);
}