Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-07-11 14:06:13 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-07-11 14:16:32 +0400
commit4633e655dc59b68d622e3319102d5050245a22eb (patch)
tree08982a589dd5a3e96fbf342c8319fe46ad65d642 /source/blender/blenkernel/BKE_mesh.h
parent78d38a90332027609933be102e61438cb4c7f9f0 (diff)
Fix T41019: Calculate Mass does not calculate actual volume.
This was a ToDo item, for mesh-based rigid body shapes (trimesh, convex) the operator was simply using the bounding box volume, which can grossly overestimate the volume and mass. Calculating the actual volume of a mesh is not so difficult after all, see e.g. http://research.microsoft.com/en-us/um/people/chazhang/publications/icip01_ChaZhang.pdf This patch also allows calculating the center-of-mass in the same way. This is currently unused, because the rigid body system assumes the CoM to be the same as the geometric object center. This is fine most of the time, adding such user settings for "center-of-mass offset" would also add quite a bit of complexity in user space, but it could be necessary at some point. A number of other physical properties could be calculated using the same principle, e.g. the moment of inertia.
Diffstat (limited to 'source/blender/blenkernel/BKE_mesh.h')
-rw-r--r--source/blender/blenkernel/BKE_mesh.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 587dea5095c..975a8fd63df 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -212,6 +212,10 @@ bool BKE_mesh_center_median(struct Mesh *me, float cent[3]);
bool BKE_mesh_center_bounds(struct Mesh *me, float cent[3]);
bool BKE_mesh_center_centroid(struct Mesh *me, float cent[3]);
+void BKE_mesh_calc_volume(struct MVert *mverts, int numVerts,
+ struct MFace *mfaces, int numFaces,
+ float *r_vol, float *r_com);
+
/* tessface */
void BKE_mesh_loops_to_mface_corners(
struct CustomData *fdata, struct CustomData *ldata,