GMT.jl goes more 3D

This has turned out more difficult to make the plot that I had liked.

Colors are modulated by the normals to each face (triangles)

using GMT

# Read the three 3D G,M,T letters
G, M, T = gmtread("G.obj"), gmtread("M.obj"),gmtread("T.obj");

C=makecpt(T="0/1", C="red,green");
plot3(G,  p=(20,20), cmap=C, frame=:none)
plot3!(M, R="-2/60/-0.4/15.6/-2/52", p=(20,20), cmap=C, X=16)
plot3!(T, R="-2/46/-0.4/15.6/-2/52", p=(20,20), cmap=C, X=15.5, show=1)

and

FV = gmtread("motherChild_20k.obj");
viz(FV, C=makecpt(T="0/1", C="brown,beige"), view=(140,30))

2 Likes

Can. obj files be used as markers for line points ?

I predict raytracing coming to GMT.jl … :wink:

One day, one day :slight_smile: But before I would be satisfied if I could control Blender programmatically from Julia.

What allows doing these plots turn out to be small functions (~30 lines)

Not sure I understand. You mean custom symbols?

Yes. Remember that the 3D point markers for GMT can only be cubes.

Ah, that. Annoying limitation yes and I thought I could have better news but not. I thought that if we had a 3D custom symbol, then we could use it in 3D. Slow but workable. But not. Custom symbols seem to be 2D only.

# Create a low res sphere (not documented yet)(
FV = GMT.geosphere(2);

# Create a EPS file that will be used as a custom symbol (it HAS to be an EPS)
plot3(FV, frame=:none, name="sph.eps", show=true)

Now, use that sphere as a custom symbol.

plot3(rand(5,3), cmarker=(name="sph", size=1), show=true)

Shit, the spheres were smashed.

1 Like

Getting better, but still complicated by the often axes non-isometry and since these symbols have map instead of paper coordinates. Also, potential slow when the 3D symbols are complex and have many triangles.

FV = gmtread("motherChild_20k.obj");
viz(FV, replicate=(centers=rand(10,3)*100, scales=0.1))

1 Like