← Back to team overview

yade-dev team mailing list archive

[svn] r1624 - in trunk/pkg: common/Engine/DeusExMachina snow snow/DataClass snow/Engine snow/PreProcessor

 

Author: cosurgi
Date: 2009-01-14 04:17:46 +0100 (Wed, 14 Jan 2009)
New Revision: 1624

Added:
   trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.cpp
   trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.hpp
Modified:
   trunk/pkg/common/Engine/DeusExMachina/RotationEngine.cpp
   trunk/pkg/snow/DataClass/BshSnowGrain.cpp
   trunk/pkg/snow/PreProcessor/SnowVoxelsLoader.cpp
   trunk/pkg/snow/SConscript
Log:
1. small snow update
2. fix compilation error by Vaclav (hey, you didn't compile again before commit! ;p )



Modified: trunk/pkg/common/Engine/DeusExMachina/RotationEngine.cpp
===================================================================
--- trunk/pkg/common/Engine/DeusExMachina/RotationEngine.cpp	2009-01-13 16:00:41 UTC (rev 1623)
+++ trunk/pkg/common/Engine/DeusExMachina/RotationEngine.cpp	2009-01-14 03:17:46 UTC (rev 1624)
@@ -32,6 +32,7 @@
 	axis.Normalize();
 	Quaternionr q;
 	q.FromAxisAngle(axis,angularVelocity*dt);
+	shared_ptr<BodyContainer> bodies = rb->bodies;
 	FOREACH(body_id_t id,subscribedBodies){
 		assert(id<bodies->size());
 		Body* b=Body::byId(id,rb).get();

Modified: trunk/pkg/snow/DataClass/BshSnowGrain.cpp
===================================================================
--- trunk/pkg/snow/DataClass/BshSnowGrain.cpp	2009-01-13 16:00:41 UTC (rev 1623)
+++ trunk/pkg/snow/DataClass/BshSnowGrain.cpp	2009-01-14 03:17:46 UTC (rev 1624)
@@ -15,7 +15,7 @@
 	REGISTER_ATTRIBUTE(color);
 	REGISTER_ATTRIBUTE(selection);
 	REGISTER_ATTRIBUTE(layer_distance);
-	REGISTER_ATTRIBUTE(gr_gr);
+	REGISTER_ATTRIBUTE(gr_gr); // slices
 }
 
 BshSnowGrain::BshSnowGrain(const T_DATA& dat,Vector3r c_ax,int SELECTION,Vector3r col, Real one_voxel_in_meters_is) : GeometricalModel()

Added: trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.cpp
===================================================================
--- trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.cpp	2009-01-13 16:00:41 UTC (rev 1623)
+++ trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.cpp	2009-01-14 03:17:46 UTC (rev 1624)
@@ -0,0 +1,66 @@
+/*************************************************************************
+*  Copyright (C) 2008 by Janek Kozicki                                   *
+*  cosurgi@xxxxxxxxxx                                                    *
+*                                                                        *
+*  This program is free software; it is licensed under the terms of the  *
+*  GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+ 
+#include"Ef2_BssSnowGrain_AABB_makeAABB.hpp"
+#include<yade/pkg-common/InteractingSphere.hpp>
+#include<yade/pkg-snow/BssSnowGrain.hpp>
+#include<yade/pkg-common/AABB.hpp>
+
+void Ef2_BssSnowGrain_AABB_makeAABB::go(const shared_ptr<InteractingGeometry>& cm, shared_ptr<BoundingVolume>& bv, const Se3r& se3, const Body* b)
+{
+	BssSnowGrain* bss = static_cast<BssSnowGrain*>(cm.get());
+	AABB* aabb = static_cast<AABB*>(bv.get());
+
+/*
+	public:
+		Vector3r center,c_axis;
+		Vector3r start,end;
+		Vector3r color;
+		int selection;
+		std::vector<std::vector<Vector3r> > slices;
+		Real layer_distance;
+
+	m_copy.center   =grain->center;
+	m_copy.c_axis   =grain->c_axis;
+	m_copy.start    =grain->start;
+	m_copy.end      =grain->end;
+	m_copy.color    =grain->color;
+	m_copy.selection=grain->selection;
+	m_copy.slices   =grain->slices;
+	m_copy.layer_distance = grain->layer_distance;
+*/
+
+	Quaternionr q(b->physicalParameters->se3.orientation);
+
+	Vector3r min(q*(bss->m_copy.slices[0][0]));
+	Vector3r max(min);
+	BOOST_FOREACH(std::vector<Vector3r>& vv, bss->m_copy.slices)
+	BOOST_FOREACH(Vector3r v, vv)
+	{
+	 	max = componentMaxVector(max,q*v);
+ 		min = componentMinVector(min,q*v);
+	}
+	
+	max += b->physicalParameters->se3.position;
+	min += b->physicalParameters->se3.position;
+
+	aabb->center = (max+min)*0.5;
+	aabb->halfSize = (max-min)*0.5;
+	
+	aabb->min = min;
+	aabb->max = max;
+/*
+	aabb->center = se3.position;
+	aabb->halfSize = 2.0*Vector3r(sphere->radius,sphere->radius,sphere->radius);
+	
+	aabb->min = aabb->center-aabb->halfSize;
+	aabb->max = aabb->center+aabb->halfSize;	
+*/
+}
+	
+YADE_PLUGIN();

Added: trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.hpp
===================================================================
--- trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.hpp	2009-01-13 16:00:41 UTC (rev 1623)
+++ trunk/pkg/snow/Engine/Ef2_BssSnowGrain_AABB_makeAABB.hpp	2009-01-14 03:17:46 UTC (rev 1624)
@@ -0,0 +1,25 @@
+/*************************************************************************
+*  Copyright (C) 2009 by Janek Kozicki                                   *
+*  cosurgi@xxxxxxxxxx                                                    *
+*                                                                        *
+*  This program is free software; it is licensed under the terms of the  *
+*  GNU General Public License v2 or later. See file LICENSE for details. *
+*************************************************************************/
+ 
+#pragma once
+
+#include<yade/pkg-common/BoundingVolumeEngineUnit.hpp>
+
+class Ef2_BssSnowGrain_AABB_makeAABB : public BoundingVolumeEngineUnit
+{
+	public :
+		Ef2_BssSnowGrain_AABB_makeAABB() {};
+		void go(const shared_ptr<InteractingGeometry>& cm, shared_ptr<BoundingVolume>& bv, const Se3r& se3, const Body*);
+
+	FUNCTOR2D(BssSnowGrain,AABB);
+	REGISTER_CLASS_NAME(Ef2_BssSnowGrain_AABB_makeAABB);
+	REGISTER_BASE_CLASS_NAME(BoundingVolumeEngineUnit);
+};
+
+REGISTER_SERIALIZABLE(Ef2_BssSnowGrain_AABB_makeAABB);
+

Modified: trunk/pkg/snow/PreProcessor/SnowVoxelsLoader.cpp
===================================================================
--- trunk/pkg/snow/PreProcessor/SnowVoxelsLoader.cpp	2009-01-13 16:00:41 UTC (rev 1623)
+++ trunk/pkg/snow/PreProcessor/SnowVoxelsLoader.cpp	2009-01-14 03:17:46 UTC (rev 1624)
@@ -375,7 +375,7 @@
 	interactionPhysicsDispatcher->add(cohesiveFrictionalRelationships);
 		
 	shared_ptr<BoundingVolumeMetaEngine> boundingVolumeDispatcher	= shared_ptr<BoundingVolumeMetaEngine>(new BoundingVolumeMetaEngine);
-	boundingVolumeDispatcher->add("InteractingSphere2AABB");
+	boundingVolumeDispatcher->add("Ef2_BssSnowGrain_AABB_makeAABB");
 	boundingVolumeDispatcher->add("InteractingBox2AABB");
 	boundingVolumeDispatcher->add("MetaInteractingGeometry2AABB");
 

Modified: trunk/pkg/snow/SConscript
===================================================================
--- trunk/pkg/snow/SConscript	2009-01-13 16:00:41 UTC (rev 1623)
+++ trunk/pkg/snow/SConscript	2009-01-14 03:17:46 UTC (rev 1624)
@@ -9,6 +9,9 @@
 		LIBS=env['LIBS']+['BshSnowGrain','yade-opengl','yade-base',
 		'BssSnowGrain','InteractingBox','InteractingBox2InteractingSphere4SpheresContactGeometry']),
 	
+	env.SharedLibrary('Ef2_BssSnowGrain_AABB_makeAABB',['Engine/Ef2_BssSnowGrain_AABB_makeAABB.cpp'],
+		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingSphere','BssSnowGrain','AABB']),
+	
 	env.SharedLibrary('Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry',['Engine/Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry.cpp'],
 		LIBS=env['LIBS']+['BshSnowGrain','yade-opengl','yade-base',
 		'BssSnowGrain','InteractingSphere','InteractingSphere2InteractingSphere4SpheresContactGeometry']),