← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3859: VTKRecorder, added orientation for box export (question #293635)

 

------------------------------------------------------------
revno: 3859
committer: Jan Stransky <jan.stransky@xxxxxxxxxxx>
timestamp: Fri 2016-05-13 15:07:22 +0200
message:
  VTKRecorder, added orientation for box export (question #293635)
modified:
  pkg/dem/VTKRecorder.cpp


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp	2015-06-04 20:57:50 +0000
+++ pkg/dem/VTKRecorder.cpp	2016-05-13 13:07:22 +0000
@@ -698,19 +698,29 @@
 			if (box){
 
 				Vector3r pos(scene->isPeriodic ? scene->cell->wrapShearedPt(b->state->pos) : b->state->pos);
+				Quaternionr ori(b->state->ori);
 				Vector3r ext(box->extents);
 				vtkSmartPointer<vtkQuad> boxes = vtkSmartPointer<vtkQuad>::New();
-				
-				Vector3r A = Vector3r(pos[0]-ext[0], pos[1]-ext[1], pos[2]-ext[2]);
-				Vector3r B = Vector3r(pos[0]-ext[0], pos[1]+ext[1], pos[2]-ext[2]);
-				Vector3r C = Vector3r(pos[0]+ext[0], pos[1]+ext[1], pos[2]-ext[2]);
-				Vector3r D = Vector3r(pos[0]+ext[0], pos[1]-ext[1], pos[2]-ext[2]);
-				
-				Vector3r E = Vector3r(pos[0]-ext[0], pos[1]-ext[1], pos[2]+ext[2]);
-				Vector3r F = Vector3r(pos[0]-ext[0], pos[1]+ext[1], pos[2]+ext[2]);
-				Vector3r G = Vector3r(pos[0]+ext[0], pos[1]+ext[1], pos[2]+ext[2]);
-				Vector3r H = Vector3r(pos[0]+ext[0], pos[1]-ext[1], pos[2]+ext[2]);
-				
+
+				Vector3r A = Vector3r(-ext[0], -ext[1], -ext[2]);
+				Vector3r B = Vector3r(-ext[0], +ext[1], -ext[2]);
+				Vector3r C = Vector3r(+ext[0], +ext[1], -ext[2]);
+				Vector3r D = Vector3r(+ext[0], -ext[1], -ext[2]);
+				
+				Vector3r E = Vector3r(-ext[0], -ext[1], +ext[2]);
+				Vector3r F = Vector3r(-ext[0], +ext[1], +ext[2]);
+				Vector3r G = Vector3r(+ext[0], +ext[1], +ext[2]);
+				Vector3r H = Vector3r(+ext[0], -ext[1], +ext[2]);
+
+				A = pos + ori*A;
+				B = pos + ori*B;
+				C = pos + ori*C;
+				D = pos + ori*D;
+				E = pos + ori*E;
+				F = pos + ori*F;
+				G = pos + ori*G;
+				H = pos + ori*H;
+
 				addWallVTK(boxes, boxesPos, A, B, C, D);
 				boxesCells->InsertNextCell(boxes);