Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Aug 26, 2010 2:17 pm 
Offline

Joined: Fri Jul 09, 2010 9:09 pm
Posts: 3
I created a simple 3d object and exported it as an ascii stl file from meshlab, and then ran tetgen -p on it (version 1.4.1). Then I put the contents of .ele and .node into an inl file modeled after bunny.inl with quotes and \n line end characters around every line. But when I recompiled SoftDemo (bullet 2.77) to use my inl file I get a crash:

Code:
*** glibc detected *** ./AppSoftBodyDemo: malloc(): memory corruption: 0x0830ac38 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x34a591]
/lib/tls/i686/cmov/libc.so.6(+0x6e395)[0x34d395]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x5c)[0x34ef9c]
/usr/lib/nvidia-current/libGL.so.1(+0x33e80)[0x24de80]
======= Memory map: ========
00110000-00114000 r-xp 00000000 08:04 2541164    /usr/lib/libXxf86vm.so.1.0.0
00114000-00115000 r--p 00003000 08:04 2541164    /usr/lib/libXxf86vm.so.1.0.0
00115000-00116000 rw-p 00004000 08:04 2541164    /usr/lib/libXxf86vm.so.1.0.0
00116000-00122000 r-xp 00000000 08:04 2541132    /usr/lib/libXi.so.6.1.0
00122000-00123000 r--p 0000c000 08:04 2541132    /usr/lib/libXi.so.6.1.0
...


This is on ubuntu 10.04. Do I need different flags with tetgen, have to do something different in the inl, or is my source 3d file wrong?

I also tried passing the tetgen smesh output through tetgen again with the -YY flags, but got the same crash.

test.inl:
Code:
static const char* getNodes() { return(
"28  3  0  0\n"
"   1    1  -1  -1\n"
"   2    1  -1  1\n"
"   3    1  1  -1\n"
"   4    0.199656  -0.199656  2.2071109999999998\n"
"   5    -0.199656  0.199656  2.2071109999999998\n"
"   6    -1  -1  -1\n"
"   7    -1  1  1\n"
"   8    -1  1  -1\n"
"   9    1  1  1\n"
"  10    0.56399999999999995  0.56399999999999995  1.9119999999999999\n"
"  11    -1  -1  1\n"
"  12    -0.56399999999999995  -0.56399999999999995  1.9119999999999999\n"
"  13    -0.199656  -0.199656  2.2071109999999998\n"
"  14    0.199656  0.199656  2.2071109999999998\n"
"  15    0.56399999999999995  -0.56399999999999995  1.9119999999999999\n"
"  16    -0.56399999999999995  0.56399999999999995  1.9119999999999999\n"
"  17    0.00072999999999999996  -1  -1\n"
"  18    -1  -1  -0.00071599999999999995\n"
"  19    1  -0.00034499999999999998  1\n"
"  20    1  -1  0.00047399999999999997\n"
"  21    -0.199656  -0.00014540000000000001  2.2071109999999998\n"
"  22    5.2200000000000002e-05  -0.199656  2.2071109999999998\n"
"  23    -1  1  0.00081300000000000003\n"
"  24    0.000165  1  1\n"
"  25    -0.00099799999999999997  -1  1\n"
"  26    -1  0.00077899999999999996  1\n"
"  27    0.56399999999999995  -0.00055489999999999999  1.9119999999999999\n"
"  28    0.00031530000000000002  0.56399999999999995  1.9119999999999999\n"
"# Generated by tetgen -YY test.1.smesh \n"); }

static const char* getElements() { return(
"48  4  0\n"
"    1      26    28    16    12\n"
"    2      28    21    16    12\n"
"    3      25    19     2    20\n"
"    4      28    27    10    14\n"
"    5      17     3    20     1\n"
"    6      20    24    18    19\n"
"    7      28    25    26    27\n"
"    8      21    27    28    22\n"
"    9      28    10    27    19\n"
"   10      21    27    22    12\n"
"   11      27    25    26    19\n"
"   12      24    17    18    23\n"
"   13      21    27    12    28\n"
"   14      21    14    28     5\n"
"   15      21    12    22    13\n"
"   16      23     3    17     8\n"
"   17      10    24     9    19\n"
"   18       9    19    24     3\n"
"   19      21    22    28    14\n"
"   20      27    26    28    19\n"
"   21      14    27    22    28\n"
"   22      19    17     3    20\n"
"   23      17    24     3    23\n"
"   24      22    15    12    27\n"
"   25      27    14    22     4\n"
"   26      19     2    15    25\n"
"   27      27    25    15    12\n"
"   28      16    24    26     7\n"
"   29      16    24    28    26\n"
"   30      26     7    24    23\n"
"   31      18    17     8    23\n"
"   32      22    27     4    15\n"
"   33      28    25    27    12\n"
"   34      28    24    10    19\n"
"   35      20    24    19    17\n"
"   36      18    19    25    20\n"
"   37      28    25    12    26\n"
"   38       6    18    17     8\n"
"   39      25    26    11    12\n"
"   40      28    21     5    16\n"
"   41      19    18    25    26\n"
"   42      24    19    28    26\n"
"   43      27    25    19    15\n"
"   44      20    24    17    18\n"
"   45      26    25    11    18\n"
"   46      18    24    26    19\n"
"   47      18    24    23    26\n"
"   48      17    24    19     3\n"
"# Generated by tetgen -YY test.1.smesh \n"); }



test.1.smesh:
Code:
# test.1.smesh.  TetGen's input file.

# part 1: node list.
0  3  0  0  # nodes are found in test.1.node.

# part 2: facet list.
52  0
3      18    20    25
3      17    20    18
3       1     3    20
3       3     9    19
3       6     8    17
3      17     8     3
3      21    22    14
3      14     5    21
3       3    23    24
3      23     3     8
3      11    26    18
3      18    23     8
3      25     2    15
3      15    12    25
3      19    10    27
3      19     9    10
3      24    16    28
3      24     7    16
3      26    11    12
3      12    16    26
3      12    15    22
3      22    13    12
3      27    14     4
3      27    10    14
3      28     5    14
3      28    16     5
3      16    12    21
3      21     5    16
3       1    17     3
3      17     1    20
3      18     6    17
3       6    18     8
3      15     2    19
3       3    19    20
3      19     2    20
3       2    25    20
3      12    13    21
3      21    13    22
3      22     4    14
3      15     4    22
3      18    26    23
3      24    23     7
3       3    24     9
3      10     9    24
3      11    18    25
3      12    11    25
3      23    26     7
3      16     7    26
3      19    27    15
3       4    15    27
3      24    28    10
3      14    10    28

# part 3: hole list.
0

# part 4: region list.
0
# Generated by tetgen -p test.stl


test.stl
Code:
solid vcg
  facet normal  0.000000e+00 -1.000000e+00  0.000000e+00
    outer loop
      vertex  -1.000000e+00 -1.000000e+00 -1.000000e+00
      vertex   1.000000e+00 -1.000000e+00 -1.000000e+00
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal -0.000000e+00 -1.000000e+00  0.000000e+00
    outer loop
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
      vertex  -1.000000e+00 -1.000000e+00  1.000000e+00
      vertex  -1.000000e+00 -1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal  1.000000e+00  0.000000e+00  0.000000e+00
    outer loop
      vertex   1.000000e+00 -1.000000e+00 -1.000000e+00
      vertex   1.000000e+00  1.000000e+00 -1.000000e+00
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal  1.000000e+00  0.000000e+00 -0.000000e+00
    outer loop
      vertex   1.000000e+00  1.000000e+00 -1.000000e+00
      vertex   1.000000e+00  1.000000e+00  1.000000e+00
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00  0.000000e+00 -1.000000e+00
    outer loop
      vertex  -1.000000e+00 -1.000000e+00 -1.000000e+00
      vertex  -1.000000e+00  1.000000e+00 -1.000000e+00
      vertex   1.000000e+00 -1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00  0.000000e+00 -1.000000e+00
    outer loop
      vertex  -1.000000e+00  1.000000e+00 -1.000000e+00
      vertex   1.000000e+00  1.000000e+00 -1.000000e+00
      vertex   1.000000e+00 -1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00 -0.000000e+00  1.000000e+00
    outer loop
      vertex   1.996560e-01 -1.996560e-01  2.207111e+00
      vertex   1.996560e-01  1.996560e-01  2.207111e+00
      vertex  -1.996560e-01 -1.996560e-01  2.207111e+00
    endloop
  endfacet
  facet normal  0.000000e+00  0.000000e+00  1.000000e+00
    outer loop
      vertex   1.996560e-01  1.996560e-01  2.207111e+00
      vertex  -1.996560e-01  1.996560e-01  2.207111e+00
      vertex  -1.996560e-01 -1.996560e-01  2.207111e+00
    endloop
  endfacet
  facet normal -0.000000e+00  1.000000e+00  0.000000e+00
    outer loop
      vertex  -1.000000e+00  1.000000e+00  1.000000e+00
      vertex   1.000000e+00  1.000000e+00  1.000000e+00
      vertex   1.000000e+00  1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00  1.000000e+00  0.000000e+00
    outer loop
      vertex  -1.000000e+00  1.000000e+00  1.000000e+00
      vertex   1.000000e+00  1.000000e+00 -1.000000e+00
      vertex  -1.000000e+00  1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal -1.000000e+00  0.000000e+00  0.000000e+00
    outer loop
      vertex  -1.000000e+00 -1.000000e+00  1.000000e+00
      vertex  -1.000000e+00  1.000000e+00  1.000000e+00
      vertex  -1.000000e+00 -1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal -1.000000e+00  0.000000e+00 -0.000000e+00
    outer loop
      vertex  -1.000000e+00  1.000000e+00  1.000000e+00
      vertex  -1.000000e+00  1.000000e+00 -1.000000e+00
      vertex  -1.000000e+00 -1.000000e+00 -1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00 -9.022012e-01  4.313155e-01
    outer loop
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
      vertex   5.640000e-01 -5.640000e-01  1.912000e+00
      vertex  -5.640000e-01 -5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal  0.000000e+00 -9.022012e-01  4.313155e-01
    outer loop
      vertex  -5.640000e-01 -5.640000e-01  1.912000e+00
      vertex  -1.000000e+00 -1.000000e+00  1.000000e+00
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal  9.022012e-01  0.000000e+00  4.313155e-01
    outer loop
      vertex   5.640000e-01  5.640000e-01  1.912000e+00
      vertex   5.640000e-01 -5.640000e-01  1.912000e+00
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal  9.022012e-01 -0.000000e+00  4.313155e-01
    outer loop
      vertex   1.000000e+00 -1.000000e+00  1.000000e+00
      vertex   1.000000e+00  1.000000e+00  1.000000e+00
      vertex   5.640000e-01  5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal -0.000000e+00  9.022012e-01  4.313155e-01
    outer loop
      vertex  -5.640000e-01  5.640000e-01  1.912000e+00
      vertex   5.640000e-01  5.640000e-01  1.912000e+00
      vertex   1.000000e+00  1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00  9.022012e-01  4.313155e-01
    outer loop
      vertex   1.000000e+00  1.000000e+00  1.000000e+00
      vertex  -1.000000e+00  1.000000e+00  1.000000e+00
      vertex  -5.640000e-01  5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal -9.022012e-01  0.000000e+00  4.313155e-01
    outer loop
      vertex  -1.000000e+00 -1.000000e+00  1.000000e+00
      vertex  -5.640000e-01 -5.640000e-01  1.912000e+00
      vertex  -5.640000e-01  5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal -9.022012e-01  0.000000e+00  4.313155e-01
    outer loop
      vertex  -5.640000e-01  5.640000e-01  1.912000e+00
      vertex  -1.000000e+00  1.000000e+00  1.000000e+00
      vertex  -1.000000e+00 -1.000000e+00  1.000000e+00
    endloop
  endfacet
  facet normal  0.000000e+00 -6.294121e-01  7.770717e-01
    outer loop
      vertex   5.640000e-01 -5.640000e-01  1.912000e+00
      vertex   1.996560e-01 -1.996560e-01  2.207111e+00
      vertex  -1.996560e-01 -1.996560e-01  2.207111e+00
    endloop
  endfacet
  facet normal  0.000000e+00 -6.294121e-01  7.770717e-01
    outer loop
      vertex  -1.996560e-01 -1.996560e-01  2.207111e+00
      vertex  -5.640000e-01 -5.640000e-01  1.912000e+00
      vertex   5.640000e-01 -5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal  6.294121e-01  0.000000e+00  7.770717e-01
    outer loop
      vertex   1.996560e-01  1.996560e-01  2.207111e+00
      vertex   1.996560e-01 -1.996560e-01  2.207111e+00
      vertex   5.640000e-01 -5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal  6.294121e-01 -0.000000e+00  7.770717e-01
    outer loop
      vertex   5.640000e-01 -5.640000e-01  1.912000e+00
      vertex   5.640000e-01  5.640000e-01  1.912000e+00
      vertex   1.996560e-01  1.996560e-01  2.207111e+00
    endloop
  endfacet
  facet normal -0.000000e+00  6.294121e-01  7.770717e-01
    outer loop
      vertex  -1.996560e-01  1.996560e-01  2.207111e+00
      vertex   1.996560e-01  1.996560e-01  2.207111e+00
      vertex   5.640000e-01  5.640000e-01  1.912000e+00
    endloop
  endfacet
  facet normal  0.000000e+00  6.294121e-01  7.770717e-01
    outer loop
      vertex   5.640000e-01  5.640000e-01  1.912000e+00
      vertex  -5.640000e-01  5.640000e-01  1.912000e+00
      vertex  -1.996560e-01  1.996560e-01  2.207111e+00
    endloop
  endfacet
  facet normal -6.294121e-01  0.000000e+00  7.770717e-01
    outer loop
      vertex  -5.640000e-01 -5.640000e-01  1.912000e+00
      vertex  -1.996560e-01 -1.996560e-01  2.207111e+00
      vertex  -1.996560e-01  1.996560e-01  2.207111e+00
    endloop
  endfacet
  facet normal -6.294121e-01  0.000000e+00  7.770717e-01
    outer loop
      vertex  -1.996560e-01  1.996560e-01  2.207111e+00
      vertex  -5.640000e-01  5.640000e-01  1.912000e+00
      vertex  -5.640000e-01 -5.640000e-01  1.912000e+00
    endloop
  endfacet
endsolid vcg


Top
 Profile  
 
PostPosted: Mon Sep 06, 2010 4:53 pm 
Offline

Joined: Fri Jul 09, 2010 9:09 pm
Posts: 3
I should have seen it earlier, tetgen is producing one-based indices by default. The -z flag will make them zero based and SoftDemo won't crash.


Top
 Profile  
 
PostPosted: Wed Oct 13, 2010 4:47 pm 
Offline

Joined: Fri Jun 11, 2010 2:12 pm
Posts: 4
Hi,
now I'm working with soft bodies. How do you create your .inl files? Manualy?
I know this isn't a reply for your answer, but you already found your solution. I hope you can say by topics the way you create your inl files.
Regards. :wink:


Top
 Profile  
 
PostPosted: Wed Oct 13, 2010 6:18 pm 
Offline

Joined: Fri Jul 09, 2010 9:09 pm
Posts: 3
I took the .ele and .node files and put them together, added quotes around lines with search-and-replace text editor functions (I was using vim, a regular editor may make it more difficult) and the function code around them to make it match bunny.inl.

There are some more details here: http://binarymillenium.com/2010/08/first-steps-in-bullet-physics.html

It probably wouldn't be hard to write a python script to automate it, but I've gotten sidetracked from using bullet in custom software to learning how to use it in Blender.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Google [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group