hi,

i know i've done this at least twice before, but never can
remember how it goes.  i'm looking at the various options
of decomposing prisms into tetrahedra.   option 1 seems
to require 3 tets per prism, but you may have edge matching
problems (an example is enclosed below).  option 2 seems
to require 10 tetrahedra, which is more than i remember.
am i making too many tets in the second case?

i'll append the following 4 files:  a dx data file, and 3 scripts.
if you have the option of hardware rendering, you can run
it thus:  dx -script
then:  include "t1"
and you should be able to interactively rotate the image.
then: include "t2"
and: include "t3"

thanks for any suggestions on cutting down the number of
tets in the final case.

oh, if you look at script "t2" - you'll see that i had to decide
to subdivide quad (0, 1, 4, 3) so a new edge is created either
between (0, 4) or (1, 3).  i picked (0,4).  but if there is another
prism next to this one which also shares face (0, 1, 4, 3), then
you need to be sure to also pick diagonal (0, 4) or you may
end up with rendering artifacts.  depending on how your prisms
are laid out, it may not be possible to always match edges.
thus my investigations into creating new midpoints in each
quad, and a decomposition into more tets.

thanks,
nancy

-------------- cut here and put into tet.dx ---------------------
# test of various decompositions of a prism into tets

object 1 array rank 1 shape 3 type float items 9 data follows
 0.0 0.0 0.0
 2.0 0.0 2.0
 2.0 0.0 0.0
 0.0 2.0 0.0
 2.0 2.0 2.0
 2.0 2.0 0.0
# midpoints - not in original decomposition
 1.0 1.0 1.0
 2.0 1.0 1.0
 1.0 1.0 0.0

# original connections for prism - lines only
object 4 array rank 1 shape 2 type int items 9 data follows
 0 1    1 2    2 0
 0 3    1 4    2 5
 3 4    4 5    5 3
attribute "element type" string "lines"
attribute "ref" string "positions"

# connections for decomposition 1 into 3 tets
object 2 array rank 1 shape 4 type int items 3 data follows
 0 1 2 4
 0 2 3 4
 2 3 4 5
attribute "element type" string "tetrahedra"
attribute "ref" string "positions"

# connections for decomposition 2 into 10? tets
object 3 array rank 1 shape 4 type int items 10 data follows
 0 6 3 8
 0 1 6 8
 3 6 4 8
 3 4 5 8
 2 5 7 8
 8 7 4 5
 7 4 6 8
 1 2 7 8
 6 1 4 7
 2 1 0 8
attribute "element type" string "tetrahedra"
attribute "ref" string "positions"


# fields

# original line connections for prism
object "f0" field
 component "positions" value 1
 component "connections" value 4

# prism decomposed into only 3 tets, but with 'handed-ness'.
object "f1" field
 component "positions" value 1
 component "connections" value 2

# decomposition which uses midpoints in each quad plane
object "f2" field
 component "positions" value 1
 component "connections" value 3

end
-------------- cut here and put into t1 ---------------------
# experiments with prisms

# first, the original prism.

dat = Import("tet.dx", "f0");

points = Include(dat, cull=1);
dots = AutoGlyph(points, scale=0.25);

counts = Enumerate(0, 5, delta=1);
index = Replace(counts, points);
labels = AutoGlyph(index, "text");

lines = ShowConnections(dat);

cam = AutoCamera(dat, "off-front");

all = Collect(lines, dots, labels);
all = Options(all, "rendering mode", "hardware");
Display(all, cam);
-------------- cut here and put into t2 ---------------------
# experiments with prisms, cont.

# now, subdivided into 3 tets

dat = Import("tet.dx", "f1");

points = Include(dat, cull=1);
dots = AutoGlyph(points, scale=0.25);

counts = Enumerate(0, 5, delta=1);
index = Replace(counts, points);
labels = AutoGlyph(index, "text");

lines = ShowConnections(dat);

tetbound = Isolate(dat, 0.8);
tetbound = ShowBoundary(tetbound);
tetbound = Color(tetbound, "red");
tetbound = FaceNormals(tetbound);

prismbound = ShowBoundary(dat);
prismbound = Color(prismbound, opacity=0.2);
prismbound = FaceNormals(prismbound);

cam = AutoCamera(dat, "off-front");

all = Collect(prismbound, tetbound, lines, dots, labels);
all = Options(all, "rendering mode", "hardware");
Display(all, cam);
-------------- cut here and put into t3 ---------------------
# experiments with prisms, cont.

# now, subdivided into 10? tets

dat = Import("tet.dx", "f2");

points = Include(dat, cull=1);
dots = AutoGlyph(points, scale=0.25);

counts = Enumerate(0, 8, delta=1);
index = Replace(counts, points);
labels = AutoGlyph(index, "text");

lines = ShowConnections(dat);

tetbound = Isolate(dat, 0.8);
tetbound = ShowBoundary(tetbound);
tetbound = Color(tetbound, "red");
tetbound = FaceNormals(tetbound);

prismbound = ShowBoundary(dat);
prismbound = Color(prismbound, opacity=0.2);
prismbound = FaceNormals(prismbound);

cam = AutoCamera(dat, "off-front");

all = Collect(prismbound, tetbound, lines, dots, labels);
all = Options(all, "rendering mode", "hardware");
Display(all, cam);


Reply via email to