Re: [Bf-committers] Windows SDL Library

2012-11-24 Thread Ummi Nom
Hi!

Don't know about WITH_GHOST_SDL, but afaik sdl's stable version is 1.2 and
the 2.0 is still under construction.

On Sat, Nov 24, 2012 at 8:26 AM, Jason Wilkins jason.a.wilk...@gmail.comwrote:

 I tried to compile with the WITH_GHOST_SDL option on MSVC 2008 and got
 a #error telling me the library needs to be at least version 2.0.  I
 have a fully up to date library directory (lib/windows).

 Is this option supported?
 ___
 Bf-committers mailing list
 Bf-committers@blender.org
 http://lists.blender.org/mailman/listinfo/bf-committers

___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


Re: [Bf-committers] Cursor to center of mass

2012-11-21 Thread Ummi Nom
Hi!

I finished writing some testing code (only prints out the cm though).
Planar convex/concave n-gon centroids should be correct and for closed
meshes there's the tetrahedron stuff which uses either fake tris from
polys or correct tris from tessfaces. Non-planar polys won't be correct
because of the quick triangulation (v[0], v[i-1], v[i]) and because a
flipped tri (vs polynormal) is always considered to have negative area.

http://www.pasteall.org/37425/python

On Thu, Nov 22, 2012 at 12:20 AM, Jason Wilkins
jason.a.wilk...@gmail.comwrote:

 Well, the calculation is used first to map the origin of the object
 and this discussion was just how to extend that to moving the cursor.

 As for it being because of n-gons, I do not think my model contained
 n-gons.  What I did was call the subdivide operator 4 times on one end
 of the model, which created a bunch of new quads.  Do quads count as
 n-gons in this case?

 I'll see if I can duplicate it and provide a .blend that narrows this
 down if there is a problem.

 On Wed, Nov 21, 2012 at 1:08 PM, patrick boelens p_boel...@msn.com
 wrote:
 
  Oops, I forgot this was about the cursor snapping and had something else
 in mind... My apologies. =)
 
  From: p_boel...@msn.com
  To: bf-committers@blender.org
  Date: Wed, 21 Nov 2012 20:07:04 +0100
  Subject: Re: [Bf-committers] Cursor to center of mass
 
 
  I can sort of see the reasoning behind that, but I would also argue
 accuracy can be very important. Maybe it'd be worth it to make a high
 quality operator bool in the same vein as the high quality normals in
 the Solidify modifier?
 
  -Patrick
 
   Date: Wed, 21 Nov 2012 17:36:19 +0001
   From: sergej.re...@googlemail.com
   To: bf-committers@blender.org
   CC: bf-committers@blender.org
   Subject: Re: [Bf-committers] Cursor to center of mass
  
   Hey Jason,
  
   currently there is a problem with n-gons when chalculating the center
 of mass.
   The issue is that we don't have a good way of calculating centroids
 for n-gons and just use the vertex average, so the calculated origin will
 drift a little when your polygons have many vertices.
   I'd prefer to just tirangulate the model and use the triangle
 centroids but after a discussion with Campbell we decided it's not worth
 allocating a bunch of faces just to get a litte more accuracy.
  
   Regards, Sergej.
  
   Am Di, 20. Nov, 2012 um 12:12 ,Jason Wilkins 
 jason.a.wilk...@gmail.com schrieb:
   Brecht, I figured that was what it did after testing it some, but
   since subdividing a face caused the center to move slightly I had my
   doubts. If it was vertexes I expected a really large move (since
   there were 100 times as many vertexes in my subdivided face than the
   rest of the model), but using faces or tets it should not move at all.
   Did I find a bug?
  
   On Mon, Nov 19, 2012 at 5:05 PM, Martin Bürbaum
   wrote:
Just FYI - I did something similar (Snap Cursor to Centroid) as a
 script a while back.
   
   
 http://projects.blender.org/tracker/index.php?func=detailaid=30299group_id=153atid=467
   
Cheers,
Martin
   
 Original-Nachricht 
Datum: Mon, 19 Nov 2012 19:00:23 -0300
Von: Juan Pablo Bouza
An: bf-committers@blender.org
Betreff: [Bf-committers] Cursor to center of mass
   
   
Hi! The addition of the center of mass option for object origins
 is
really cool!
   
Now, there are many times in rigging when you need the center of
 the
object to be at 0 0 0, specially for exporting meshes. So, in these
cases, the origin to center of mass option would not be used.
Nevertheless, the center of mass options would be really usefull
 for
placing objects such as bones...
   
So, I propose to add the center of mass option also in the Cursor
snapping menu (shif+S). That would be cursor to center of mass.
   
Cheers!
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers
   ___
   Bf-committers mailing list
   Bf-committers@blender.org
   http://lists.blender.org/mailman/listinfo/bf-committers
  
   ___
   Bf-committers mailing list
   Bf-committers@blender.org
   http://lists.blender.org/mailman/listinfo/bf-committers
 
  ___
  Bf-committers mailing list
  Bf-committers@blender.org
  http://lists.blender.org/mailman/listinfo/bf-committers
 
  ___
  Bf-committers mailing list
  Bf-committers@blender.org
  http://lists.blender.org/mailman/listinfo/bf-committers
 ___
 Bf-committers mailing list
 Bf-committers@blender.org
 http://lists.blender.org/mailman/listinfo/bf-committers

___
Bf-committers mailing list
Bf-committers@blender.org

Re: [Bf-committers] Cursor to center of mass

2012-11-21 Thread Ummi Nom
Hi!

I'm aiming a bit lower so I prefer to attack the mechanics of the problem.
Limiting the calculation by actual volume to when it makes sense would be
nice, but detecting overlaps etc. seems overkill.

Here's later code which does it basically two ways, one is the tetrahedron
and the other is polygon centroid.
http://www.pasteall.org/37425/python

On Thu, Nov 22, 2012 at 3:46 AM, bjornm...@gmx.net bjornm...@gmx.netwrote:

 Did you check against  'non orientable surfaces'?
 like
 Möbius strip
 Klein Bottle
 I doubt the algorithm stands with that...
 As far as I remember those objects have no defined volume?
 As : how would you like  to make a cylinder from a Möbius strip?
 You can always create a bounding object  .. like in triangulating the
 circle ..
 alas .. it will be getting close enough, which might be sufficient for
 blender, and might be nice to have..

 Well if blender refuses to create  such geometry .. bad enough
 Mathematica and friends can.

 Well I think you should check  the definition of  'closed' and require
 'orientable' and it will work out fine.
 so much for that
 BM

 one more .. your algorithm assumes homogeneous density .. how realistic
 is that ? .. for all cases ?
 Is a balloon filled with air the same as the balloon filled with water?
 As the mass is on the surface versus the mass is in the volume ?

 Am 21.11.2012 04:30, schrieb Ummi Nom:
  Hi!
 
  I've written some center of mass calculations in python for closed
 meshes,
  but there is an issue with using tessfaces in my code; I run mesh.update
  with tessfaces=True but when I loop over mesh.tessfaces there are only 6
  faces in default scene cube so the center of mass is offset.
 
  It seems to work when the mesh is triangulated
  http://www.pasteall.org/37396/python
 
  # Code
  import mathutils
  from mathutils import *
  import bpy
 
  tess_count = 0
 
  # Handle tri as a tetrahedron with fourth point at origo
  def handleTri(v1, v2, v3):
   global tess_count
   tess_count = tess_count + 1
 
   temp = (v3-v1).cross(v2-v1)
   nor = temp.normalized()
   area = 0.5*temp.dot(nor)
   vol = area*nor.dot(v1)/3.0
   centroid = (v1+v2+v3)/4.0
 
   return (centroid, vol)
 
 
  for me in bpy.data.meshes:
   me.update(calc_tessface=True)
 
   sumc= Vector()
   summ = 0
 
 
   for f in me.tessfaces:
   v1 = Vector(me.vertices[f.vertices[0]].co)
   v2 = Vector(me.vertices[f.vertices[1]].co)
   v3 = Vector(me.vertices[f.vertices[2]].co)
 
   centroid, mass = handleTri(v1, v2, v3)
   sumc += centroid * mass
   summ += mass
 
   print(tess_count)
 
   print(sumc/summ)
  ___
  Bf-committers mailing list
  Bf-committers@blender.org
  http://lists.blender.org/mailman/listinfo/bf-committers
 

 ___
 Bf-committers mailing list
 Bf-committers@blender.org
 http://lists.blender.org/mailman/listinfo/bf-committers

___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers


[Bf-committers] Cursor to center of mass

2012-11-20 Thread Ummi Nom
Hi!

I've written some center of mass calculations in python for closed meshes,
but there is an issue with using tessfaces in my code; I run mesh.update
with tessfaces=True but when I loop over mesh.tessfaces there are only 6
faces in default scene cube so the center of mass is offset.

It seems to work when the mesh is triangulated
http://www.pasteall.org/37396/python

# Code
import mathutils
from mathutils import *
import bpy

tess_count = 0

# Handle tri as a tetrahedron with fourth point at origo
def handleTri(v1, v2, v3):
global tess_count
tess_count = tess_count + 1

temp = (v3-v1).cross(v2-v1)
nor = temp.normalized()
area = 0.5*temp.dot(nor)
vol = area*nor.dot(v1)/3.0
centroid = (v1+v2+v3)/4.0

return (centroid, vol)


for me in bpy.data.meshes:
me.update(calc_tessface=True)

sumc= Vector()
summ = 0


for f in me.tessfaces:
v1 = Vector(me.vertices[f.vertices[0]].co)
v2 = Vector(me.vertices[f.vertices[1]].co)
v3 = Vector(me.vertices[f.vertices[2]].co)

centroid, mass = handleTri(v1, v2, v3)
sumc += centroid * mass
summ += mass

print(tess_count)

print(sumc/summ)
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers