← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2200: 1. Quaterion.Rotate() wrapper is added

 

------------------------------------------------------------
revno: 2200
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-05-05 16:06:30 +0200
message:
  1. Quaterion.Rotate() wrapper is added
  2. mill.py fixed
modified:
  examples/mill.py
  py/miniWm3Wrap/manualWrap.cpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'examples/mill.py'
--- examples/mill.py	2010-05-02 20:53:04 +0000
+++ examples/mill.py	2010-05-05 14:06:30 +0000
@@ -67,12 +67,12 @@
 		[Ig2_Sphere_Sphere_Dem3DofGeom(),Ig2_Facet_Sphere_Dem3DofGeom()],
 		[Ip2_FrictMat_FrictMat_FrictPhys()],
 		[Law2_Dem3DofGeom_FrictPhys_Basic()],
-	),
+	),	
 	GravityEngine(gravity=(0,0,-50)), # gravity artificially high, to make it faster going ;-)
+	NewtonIntegrator(damping=.3),
 	RotationEngine(rotateAroundZero=True,zeroPoint=(0,0,0),rotationAxis=(1,0,0),angularVelocity=-20,subscribedBodies=millIds),
 	SnapshotEngine(iterPeriod=30,fileBase='/tmp/mill-',viewNo=0,label='snapshooter'),
 	VTKRecorder(iterPeriod=100,recorders=['spheres','facets','colors'],fileName='/tmp/millVTK-')
-	NewtonIntegrator(damping=.3),
 ]
 
 O.saveTmp()

=== modified file 'py/miniWm3Wrap/manualWrap.cpp'
--- py/miniWm3Wrap/manualWrap.cpp	2010-05-04 21:57:09 +0000
+++ py/miniWm3Wrap/manualWrap.cpp	2010-05-05 14:06:30 +0000
@@ -85,6 +85,7 @@
 
 static Matrix3r* Matrix3r_fromElements(Real m00, Real m01, Real m02, Real m10, Real m11, Real m12, Real m20, Real m21, Real m22){ Matrix3r* m(new Matrix3r); (*m)<<m00,m01,m02,m10,m11,m12,m20,m21,m22; return m; }
 static Quaternionr Quaternionr_setFromTwoVectors(Quaternionr& q, const Vector3r& u, const Vector3r& v){ return q.setFromTwoVectors(u,v); }
+static Vector3r Quaternionr_Rotate(Quaternionr& q, const Vector3r& u){ return q*u; }
 static Quaternionr* Quaternionr_fromAxisAngle(const Vector3r& axis, const Real angle){ return new Quaternionr(AngleAxisr(angle,axis)); }
 static Quaternionr* Quaternionr_fromAngleAxis(const Real angle, const Vector3r& axis){ return new Quaternionr(AngleAxisr(angle,axis)); }
 static bp::tuple Quaternionr_toAxisAngle(const Quaternionr& self){ AngleAxisr aa(self); return bp::make_tuple(aa.axis(),aa.angle());}
@@ -184,7 +185,7 @@
 		.def("setFromTwoVectors",&Quaternionr_setFromTwoVectors,((bp::arg("v1"),bp::arg("v2"))))
 		.def("conjugate",&Quaternionr::conjugate)
 		.def("toAxisAngle",&Quaternionr_toAxisAngle).def("toAngleAxis",&Quaternionr_toAxisAngle)
-		//.def("rotate",&Quaternionr::Rotate,((bp::arg("v"))))
+		.def("Rotate",&Quaternionr_Rotate,((bp::arg("v"))))
 		.def("inverse",&Quaternionr::inverse)
 		.def("norm",&Quaternionr::norm)
 		.def("normalize",&Quaternionr::normalize)