Marching Cube

First u should be sure that zone is contains cubes nothing else

If(zone.elementtype.equal(Elementtype.FEBrick) || zone.elementtype.equal(Elementtype.ijkBrick))
}
1- Determine cube index

2- Get triangles

3- Get positions

4- Rendering



Else

MessegeBox.Show(“msh ynfa3 ”);

Deterine cube index

If u get all vertices in cube u will not be sure that its in the same order with marching cube structure

Sooooooooooo

U should get vertices from the top and buttom faces

U have builtin function in element called

Element.getbreackbuttomface

And the same with front face (cant remember the fn. Name sry)

Foreach vertix in front and buttom face u should check each vertix date if < ISO so u should write 1 in the cube index

Example


If vertix 3,7 data < ISO


Sooo


Index should be


01000100


Get triangles

Then u should convert this index to decimal(int) then get the value from tritable(in link u should take it copy paste) (edgetable nt important )

Tritable returns the ordered edges which ISO intersect with

Example


If tritable returned [3 7 5 2 7 3 -1 -1 -1 -1 -1 -1]


That’s mean edges 3,7,5 form triangle and edges 2,7,3 form another triangle and so on


Get positions

Then u wanna to get positions of intersection

U should tc that ur structure is defferent

Soooo

U should determine each edge (manualy) start, and end vertix

bY

swich case , if statement, OR table u construct for that purpose

u chech each edge between which vertices and then interpolate to get intersection position




Example


[3 7 5 2 7 3 -1 -1 -1 -1 -1 -1]


U check


Edge 3 between vertix 0 and 3


Then u should get intersection


P = P1 + (isovalue - V1) (P2 - P1) / (V2 - V1)


Rendering

U draw triangle between each 3 points u determine from last step

Dnt forget to get color of each ISO



If u have more than 1 ISO

Apply the last steps for each ISO

I use min value as ISO u can start ur ISO.s after min ISO

Results

Order1

Min value 0.3337…

Max value 0.9

Sooo

Using 9 colors LUT

ISO = 0.4




ISO=0.5




ISO = 0.6




ISO = 0.7




ISO = 0.8




ISO = 0.9






Using 9 colors TF

ISO=0.4




ISO=0.5




ISO=0.6




ISO=0.7




ISO=0.8




ISO=0.9






Multi ISO TF



# ISO= 3




# ISO= 4




# ISO= 5




Multi ISO LUT

ISO=3




ISO=4




# ISO= 5