## 12 Replies - 2056 Views - Last Post: 31 August 2012 - 02:42 PM

### #1

# Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 30 August 2012 - 10:52 AM

I haven't been using DISLIN by VC++2010 for a long time, so this may sound crazy.

I generally use DISLIN to plot my Finite element results of some problems. It seems ok to plot 1d and 2d problems in DISLIN, but for a 3d problem, it's not that easy. For example, if I already have a tetrahedron mesh on the object I'm interested in, and calculated the displacements of the nodes by FEM, is there a simple way to plot the mesh and indicate the displacement withing each tetrahedron by color? Assume I have a number and position of the nodes.

As I know, there is a Matlab function called 'delaunay' that can do this job (given number and position of the nodes, and function value at each node, this function can interpolate the function values within the tetrahedron and plot the mesh and function values).

Don't know if DISLIN has similar functions. It'll also be great if there is a similar function in other plotting software.

Thanks for any advice!

##
**Replies To:** Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

### #2

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 30 August 2012 - 12:44 PM

No you haven't been using it long I know

sounds like your getting on great though...

The routine

**TRIANG**calculates the Delaunay triangulation of an arbitrary collection of points in the plane. The Delaunay triangulation can directly be used to display surfaces and contours of irregularily distributed data points. The corresponding routines are

**CRVTRI**,

**SURTRI**and

**CONTRI**.

The routines CURVE3, CURVX3, CURVY3, CRVMAT, CRVTRI and CRVQDR plot three-dimensional data points. CURVE3 plots random points from X-, Y- and Z-arrays, CURVY3 plots points as columns, CURVX3 plots data points as rows and CRVMAT plots a coloured surface according to a matrix. The routines

**CRVTRI**and CRVQDR plot triangles and quadrangles as they are often used in finite element methods.

**TRIANG**

The routine TRIANG calculates the Delaunay triangulation of an arbitrary collection of points in the plane. The Delaunay triangulation can directly be used to display surfaces and contour lines of irregularly distributed data points.

The

**Watson algorithm**is used for calculating the Delaunay triangulation. The algorithm increases with the number of points as approximately O(N^{1.5}).

Reference: S.W. Sloan and G.T. Houlsby, An Implementation of Watson's algorithm for computing 2-dimensional Delaunay triangulations, Advanced Engineering Software, 1984, Vol. 6, No. 4.

Surfaces and contours can be directly plotted from the triangulation with the routines

**CRVTRI, SURTRI and CONTRI.**

**SURTRI**

The routine SURTRI plots a shaded surface from triangulated data that can be calculated by the routine TRIANG from a set of irregularly distributed data points.

**SURSHD**

The routine SURSHD plots a shaded surface from a matrix where colour values are calculated from the Z-scaling in the routine GRAF3D or from the parameters of the routine ZSCALE.

Snoopy.

### #3

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 30 August 2012 - 02:15 PM

snoopy11, on 30 August 2012 - 02:44 PM, said:

**TRIANG**

The routine TRIANG calculates the Delaunay triangulation of an arbitrary collection of points in the plane. The Delaunay triangulation can directly be used to display surfaces and contour lines of irregularly distributed data points.

The

**Watson algorithm**is used for calculating the Delaunay triangulation. The algorithm increases with the number of points as approximately O(N^{1.5}).

Reference: S.W. Sloan and G.T. Houlsby, An Implementation of Watson's algorithm for computing 2-dimensional Delaunay triangulations, Advanced Engineering Software, 1984, Vol. 6, No. 4.

Surfaces and contours can be directly plotted from the triangulation with the routines

**CRVTRI, SURTRI and CONTRI.**

Wow that's awesome! Obviously I should do more search in the manual about TRIANG. It saves a lot of work for 2D visualization.

What I still want to know is, is there a function that can do dalaunay triangulation in 3D, i.e., to generate tetrahedron from 4 points in 3d space? If there are also functions that can do the same thing as TRIFLC to interpolate color in 3d it will be perfect.

Thank you very much! Appreciate your time!

### #4

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 30 August 2012 - 02:23 PM

### #5

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 30 August 2012 - 02:50 PM

Skydiver, on 30 August 2012 - 04:23 PM, said:

I got your point. For visualization purpose, I would say yes, since we can't see the color within the tetrahedron, the color of the 4 triangles will do the job.

I'm not very familiar with those functions yet, but I think we can use TRIANG to do triangulation for a collection of points, and use that triangulation in CRVTRI to plot the triangles.

### #6

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 30 August 2012 - 06:17 PM

Skydiver, on 30 August 2012 - 09:23 PM, said:

Yes you got it... +1

In this case SURTRI is most useful for colors...

remember also that two-dimensional graphics in the XY-plane can be projected onto a plane in 3-D space. Therefore, all 2-D plot routines can be used in 3-D space. The routine

**GRFINI**defines a plane in the 3-D box onto which all plot vectors will be projected.

You have to set up your 3D world views etc lighting and so on of course...

Useful routines

VIEW3D defines the viewpoint.

VUP3D defines the camera rotation.

VANG3D defines the viewing angle.

**GRAF3D**This routine must be called before any objects can be plotted in the 3-D box.

**LIGHT**The routine

**LIGHT**enables lighting for shading routines such as SURTRI etc.

LIGHTMOD turns on or off light sources in the range 1-8.

LITPOS defines the positions of up to 8 light sources.

Best Wishes

Snoopy.

### #7

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 08:49 AM

snoopy11, on 30 August 2012 - 08:17 PM, said:

VUP3D defines the camera rotation.

VANG3D defines the viewing angle.

**GRAF3D**This routine must be called before any objects can be plotted in the 3-D box.

Hi Snoopy,

As you suggested, I tried SURTRI and TRIANG for a very simple case to see how they work. I think the triangulation by TRIANG is just like what many commercial FE software do. So I guess I can do the triangulation in some FE software and import the triangulation information to Dislin to do the plot. I think CRVTRI will do the job in this case.

Thank you for your help! I'll try more later.

Prosper

### #8

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 10:13 AM

Prosper2012, on 31 August 2012 - 03:49 PM, said:

snoopy11, on 30 August 2012 - 08:17 PM, said:

VUP3D defines the camera rotation.

VANG3D defines the viewing angle.

**GRAF3D**This routine must be called before any objects can be plotted in the 3-D box.

Hi Snoopy,

As you suggested, I tried SURTRI and TRIANG for a very simple case to see how they work. I think the triangulation by TRIANG is just like what many commercial FE software do. So I guess I can do the triangulation in some FE software and import the triangulation information to Dislin to do the plot. I think CRVTRI will do the job in this case.

Thank you for your help! I'll try more later.

Prosper

sure ok,

### #9

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 11:21 AM

I realized that the colors display on the triangles are determined by values of the z-coordinate stored in zray[]. Is there a way I can make the color to reflect other values(like the temperature) on the triangles?

I also want to make the color on the triangles to be transparent, if possible, so that I can see the colors of the triangles located within some area. Is there a function I can use to do that?

Thanks!

-Prosper

### #10

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 11:51 AM

Hidden surfaces:

With typical 3D pipelines a triangle face that has a surface normal pointing away from the camera is not rendered. By making the tetrahedron transparent, won't you need two sets of triangles otherwise you still won't see anything through the transparency? One set with the surfaces facing out and the z values applied normally, and another set with surfaces facing in and the application of the values transformed as a mirror of the surface.

False colors:

I'm playing with my 4 sided die here and if any of the faces that is facing me was transparent by the use of alpha blending, then won't I give the user the incorrect impression of color values because the color for any given point on a face will be influenced not only by your z-value for the point on that face, but the z-value of the point intersected by the ray projected from the camera to the hidden face?

### #11

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 12:16 PM

Skydiver, on 31 August 2012 - 01:51 PM, said:

With typical 3D pipelines a triangle face that has a surface normal pointing away from the camera is not rendered. By making the tetrahedron transparent, won't you need two sets of triangles otherwise you still won't see anything through the transparency? One set with the surfaces facing out and the z values applied normally, and another set with surfaces facing in and the application of the values transformed as a mirror of the surface.

Don't know if I get you point correctly. Total transparency doesn't work. What I want to achieve is like about 30% transparency so that even when some triangles are hidden, we will know they are there.

Quote

I'm playing with my 4 sided die here and if any of the faces that is facing me was transparent by the use of alpha blending, then won't I give the user the incorrect impression of color values because the color for any given point on a face will be influenced not only by your z-value for the point on that face, but the z-value of the point intersected by the ray projected from the camera to the hidden face?

You are right. When two triangles superpose they'll give us incorrect color values. I'm still thinking how to get accurate information from such figures. One possible way is to have different view points.

### #12

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 02:29 PM

Prosper2012, on 31 August 2012 - 06:21 PM, said:

I realized that the colors display on the triangles are determined by values of the z-coordinate stored in zray[]. Is there a way I can make the color to reflect other values(like the temperature) on the triangles?

I also want to make the color on the triangles to be transparent, if possible, so that I can see the colors of the triangles located within some area. Is there a function I can use to do that?

Thanks!

-Prosper

Hi,

The routine SURVIS determines which part of a surface is plotted. so you can see inside structures, there is no transparency as such.

The routine SURTRI plots a

**shaded**surface from triangulated data that can be calculated by the routine TRIANG,

The routine SURCLR defines the colours of the upper and lower side of surfaces, note its only upper and lower.

Snoopy.

### #13

## Re: Plot 3D tetrahedron meshes in DISLIN (like 'delaunay' in Matla

Posted 31 August 2012 - 02:42 PM

snoopy11, on 31 August 2012 - 04:29 PM, said:

OK. I think I'll give up on that though.

Quote

**shaded**surface from triangulated data that can be calculated by the routine TRIANG,

The routine SURCLR defines the colours of the upper and lower side of surfaces, note its only upper and lower.

I'll try surclr. But based on the description it seems that it can't interpolate the values at three vertices, i.e., show the color of a point in the triangle to represent it's temperature interpolated from the temperature of the three vertices.