← Back to team overview

yade-users team mailing list archive

Re: Quaternion question

 

Thank you, Sergei!

I have also tried this way but with no success. Maybe I do not completely
understand quaternions.
I have attached the small XML file, what I generate. Yellow boxes are ok,
but blue ones needs to be rotated a little bit around its long axis.

Could you not give me an advice?

Best Regards / Mit freundlichen Grüßen /  С наилучшими пожеланиями

Anton Gladkyy


2009/5/6 Sergei D. <sj2001@xxxxxxxxx>

> Anton Gladky пишет:
> > Hello all!
> >
> > I have a quaternion question.
> > I have two of them:
> >   Q1 (0, 0, 1, PI/4) (around axis OZ)
> >   Q1 (0, 1, 0, PI/6) (around axis OY)
> > My box should be rotated using first quaternion, and the a second one. It
> is
> > a new topic for me. Can anybody advice me, what should I do to solve this
> > task?
> You can product them:
> if M - first rotation and Q - second rotation, then final rotation R is
> R = Q*M = (q0+q)*(m0+m) = q0 m0 - q Dot m + q0 m + m0 q + q Cross m,
> where q and m is the vector part of quaternions; q0 and m0 is the its
> scalar part.
>
> I don't know if there is quaternion product from python in YADE
> (Vaclav?), but from c++ it is simply as:
>
> Quaternion3r Q,M,R;
> R = Q*M;
>
> ps. Also you can see formulas and references in Appendix of my PhD
> thesis (in russian): http://dl.getdropbox.com/u/714488/DorofeenkoPhD.pdf
>
>
>
<Yade>
	<rootBody _className_="MetaBody"  id="0" groupMask="1" isDynamic="0" clumpId="-1" tags="[author=Anton~Gladkyy~(anton@anton-laptop) isoTime=20090428T150205 id=20090428T150205p28444 description=]" dt="1e-08" currentIteration="0" simulationTime="0" stopAtIteration="0">
		<physicalParameters _className_="ParticleParameters"  se3="{0 0 0 1 0 0 0}" refSe3="{0 0 0 1 0 0 0}" blockedDOFs="0" mass="0" velocity="{0 0 0}" />
		<geometricalModel />
		<interactingGeometry _className_="MetaInteractingGeometry"  diffuseColor="{0 0 1}" />
		<boundingVolume _className_="AABB"  diffuseColor="{0 0 1}" />
		<engines size="10">
			<engines _className_="PhysicalActionContainerReseter"  label="" />
			<engines _className_="BoundingVolumeMetaEngine"  label="" functorNames="[[InteractingSphere AABB InteractingSphere2AABB] [InteractingBox AABB InteractingBox2AABB] [MetaInteractingGeometry AABB MetaInteractingGeometry2AABB]]">
				<functorArguments size="3">
					<functorArguments _className_="InteractingSphere2AABB"  aabbEnlargeFactor="1" />
					<functorArguments _className_="InteractingBox2AABB"  label="" />
					<functorArguments _className_="MetaInteractingGeometry2AABB"  label="" />
				</functorArguments>
			</engines>
			<engines _className_="PersistentSAPCollider"  label="" haveDistantTransient="0" />
			<engines _className_="InteractionGeometryMetaEngine"  label="" functorNames="[[InteractingSphere InteractingSphere InteractingSphere2InteractingSphere4ClosestFeatures] [InteractingBox InteractingSphere InteractingBox2InteractingSphere4ClosestFeatures] [InteractingBox InteractingBox InteractingBox2InteractingBox4ClosestFeatures]]">
				<functorArguments size="3">
					<functorArguments _className_="InteractingSphere2InteractingSphere4ClosestFeatures"  label="" />
					<functorArguments _className_="InteractingBox2InteractingSphere4ClosestFeatures"  label="" />
					<functorArguments _className_="InteractingBox2InteractingBox4ClosestFeatures"  label="" />
				</functorArguments>
			</engines>
			<engines _className_="FrictionLessElasticContactLaw"  label="" />
			<engines _className_="GravityEngine"  label="" subscribedBodies="[]" gravity="{0 -9.81 0}" />
			<engines _className_="PhysicalActionDamper"  label="" functorNames="[[ParticleParameters CundallNonViscousForceDamping] [RigidBodyParameters CundallNonViscousMomentumDamping]]">
				<functorArguments size="2">
					<functorArguments _className_="CundallNonViscousForceDamping"  label="" damping="0.6" />
					<functorArguments _className_="CundallNonViscousMomentumDamping"  label="" damping="0.9" />
				</functorArguments>
			</engines>
			<engines _className_="PhysicalActionApplier"  label="" functorNames="[[ParticleParameters NewtonsForceLaw] [RigidBodyParameters NewtonsMomentumLaw]]">
				<functorArguments size="2">
					<functorArguments _className_="NewtonsForceLaw"  label="" />
					<functorArguments _className_="NewtonsMomentumLaw"  label="" />
				</functorArguments>
			</engines>
			<engines _className_="PhysicalParametersMetaEngine"  label="" functorNames="[[ParticleParameters LeapFrogPositionIntegrator]]">
				<functorArguments size="1">
					<functorArguments _className_="LeapFrogPositionIntegrator"  label="" />
				</functorArguments>
			</engines>
			<engines _className_="PhysicalParametersMetaEngine"  label="" functorNames="[[RigidBodyParameters LeapFrogOrientationIntegrator]]">
				<functorArguments size="1">
					<functorArguments _className_="LeapFrogOrientationIntegrator"  label="" />
				</functorArguments>
			</engines>
		</engines>
		<initializers size="1">
			<initializers _className_="BoundingVolumeMetaEngine"  label="" functorNames="[[InteractingSphere AABB InteractingSphere2AABB] [InteractingBox AABB InteractingBox2AABB] [MetaInteractingGeometry AABB MetaInteractingGeometry2AABB]]">
				<functorArguments size="3">
					<functorArguments _className_="InteractingSphere2AABB"  aabbEnlargeFactor="1" />
					<functorArguments _className_="InteractingBox2AABB"  label="" />
					<functorArguments _className_="MetaInteractingGeometry2AABB"  label="" />
				</functorArguments>
			</initializers>
		</initializers>
		<bodies _className_="BodyRedirectionVector" >

	


<body size="4">
  <body _className_="Body"  id="0" groupMask="1" isDynamic="0" clumpId="-1">
   <physicalParameters _className_="BodyMacroParameters"  se3="{0 0 0 0 0 1 0}" refSe3="{0 0 0 1 0 0 0}" blockedDOFs="0" mass="2400" velocity="{0 0 0}" inertia="{400 400 400}" angularVelocity="{0 0 0}" young="30000000000" poisson="0.3" frictionAngle="0.5236" />
   <geometricalModel _className_="Box"  visible="1" wire="0" shadowCaster="1" diffuseColor="{1 1 0.1}" extents="{0.05 0.5 1}" />
   <interactingGeometry _className_="InteractingBox"  diffuseColor="{0 0 0}" extents="{0.05 0.5 1}" />
   <boundingVolume _className_="AABB"  diffuseColor="{0 0 0}" />
  </body>
  <body _className_="Body"  id="1" groupMask="1" isDynamic="0" clumpId="-1">
   <physicalParameters _className_="BodyMacroParameters"  se3="{0 0 0 0 0 1 0}" refSe3="{0 0 0 1 0 0 0}" blockedDOFs="0" mass="2400" velocity="{0 0 0}" inertia="{400 400 400}" angularVelocity="{0 0 0}" young="30000000000" poisson="0.3" frictionAngle="0.5236" />
   <geometricalModel _className_="Box"  visible="1" wire="0" shadowCaster="1" diffuseColor="{0 0 1}" extents="{0.025 0.6 0.075}" />
   <interactingGeometry _className_="InteractingBox"  diffuseColor="{0 0 0}" extents="{0.025 0.6 0.075}" />
   <boundingVolume _className_="AABB"  diffuseColor="{0 0 0}" />
  </body>
  <body _className_="Body"  id="2" groupMask="1" isDynamic="0" clumpId="-1">
   <physicalParameters _className_="BodyMacroParameters"  se3="{0 0 0 0 0 1 1.5708}" refSe3="{0 0 0 1 0 0 0}" blockedDOFs="0" mass="2400" velocity="{0 0 0}" inertia="{400 400 400}" angularVelocity="{0 0 0}" young="30000000000" poisson="0.3" frictionAngle="0.5236" />
   <geometricalModel _className_="Box"  visible="1" wire="0" shadowCaster="1" diffuseColor="{1 1 0.1}" extents="{0.05 0.5 1}" />
   <interactingGeometry _className_="InteractingBox"  diffuseColor="{0 0 0}" extents="{0.05 0.5 1}" />
   <boundingVolume _className_="AABB"  diffuseColor="{0 0 0}" />
  </body>
  <body _className_="Body"  id="3" groupMask="1" isDynamic="0" clumpId="-1">
   <physicalParameters _className_="BodyMacroParameters"  se3="{0 0 0 0 0 1 1.5708}" refSe3="{0 0 0 1 0 0 0}" blockedDOFs="0" mass="2400" velocity="{0 0 0}" inertia="{400 400 400}" angularVelocity="{0 0 0}" young="30000000000" poisson="0.3" frictionAngle="0.5236" />
   <geometricalModel _className_="Box"  visible="1" wire="0" shadowCaster="1" diffuseColor="{0 0 1}" extents="{0.025 0.6 0.075}" />
   <interactingGeometry _className_="InteractingBox"  diffuseColor="{0 0 0}" extents="{0.025 0.6 0.075}" />
   <boundingVolume _className_="AABB"  diffuseColor="{0 0 0}" />
  </body>
</body>
		</bodies>
  	<transientInteractions _className_="InteractionVecSet" >
			<interaction size="0" />
		</transientInteractions>
		<miscParams size="0" />
		<dispParams size="0" />
	</rootBody>
</Yade>


References