Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Plotting a triangular mesh -- using splot and pm3d

992 views
Skip to first unread message

Olumide

unread,
Aug 7, 2007, 3:03:20 PM8/7/07
to
Hello -

I've just discovered pm3d and I would like to know if it can be used
to plot a triangular mesh surface (all the demos at
http://ayapin.film.s.dendai.ac.jp/~matuda/Gnuplot/pm3d.html use quad
faces).

Also, the glass datafile (glass.dat) at
http://ayapin.film.s.dendai.ac.jp/~matuda/Gnuplot/Pm3d/glass.dat does
not appear to have any structure other than containing what seems to
be a list of vertexes. Would someone please explain the structure of
this file, or does splot simply builds a face out of 4 consecutive
vertexes?

Thanks,

- Olumide

Hans-Bernhard Bröker

unread,
Aug 8, 2007, 7:09:25 AM8/8/07
to
Olumide wrote:

> Also, the glass datafile (glass.dat) at
> http://ayapin.film.s.dendai.ac.jp/~matuda/Gnuplot/Pm3d/glass.dat does
> not appear to have any structure other than containing what seems to
> be a list of vertexes.

It does have structure --- you're just not seeing it. Consult "help
splot datafile", and maybe look at your local copy of glass.dat in a
text editor, instead of looking at a web copy in your browser, to see it.

Olumide

unread,
Aug 8, 2007, 7:35:37 AM8/8/07
to

will do, thanks. Do you mean that glass.dat comes with the
installation? ... In which directory is it? (Sorry, I'm still new to
gnuplot).

On plotting triangular faces: I'm considering repeating the starting
(or ending vertex) e.g. v1,v2,v3,v1 ... if gnuplot only handles quads.
Is this the best way of plotting triangular faces?

Hans-Bernhard Bröker

unread,
Aug 8, 2007, 7:45:18 AM8/8/07
to
Olumide wrote:

> will do, thanks. Do you mean that glass.dat comes with the
> installation? ... In which directory is it? (Sorry, I'm still new to
> gnuplot).

It's in the 'demo' directory. Where your installation has it depends on
how you installed gnuplot.

> On plotting triangular faces: I'm considering repeating the starting
> (or ending vertex) e.g. v1,v2,v3,v1 ... if gnuplot only handles quads.
> Is this the best way of plotting triangular faces?

Not really. gnuplot does require quadrangles, but the best way of
describing those would be more like this:

v1
v2

v3
v3

>

Olumide

unread,
Aug 8, 2007, 8:40:08 AM8/8/07
to
On 8 Aug, 12:45, Hans-Bernhard Bröker <HBBroe...@t-online.de> wrote:
> Olumide wrote:
> > will do, thanks. Do you mean that glass.dat comes with the
> > installation? ... In which directory is it? (Sorry, I'm still new to
> > gnuplot).
>
> It's in the 'demo' directory. Where your installation has it depends on
> how you installed gnuplot.

found it in ...\usr\share\doc\gnuplot-4.2.0\demo :-)

The comment: "# 16x16 grid Glass shape." is particularity interesting.
Is it 16x16 because there are 16 levels (i.e. latitude-like
divisions), each having 16 segments (i.e. longitude-like
divisions)? ....

Are the spaces in the file important? ... 'cos the file still looks
like a long list of vertices. Are 4 consecutive vertices used to build
a quad?

> > On plotting triangular faces: I'm considering repeating the starting
> > (or ending vertex) e.g. v1,v2,v3,v1 ... if gnuplot only handles quads.
> > Is this the best way of plotting triangular faces?
>
> Not really. gnuplot does require quadrangles, but the best way of
> describing those would be more like this:

Do you mean that gnuplot wont allow me to simulate triangles by
repeating vertices?

Olumide

unread,
Aug 8, 2007, 10:44:16 AM8/8/07
to
I think I realize what the problem is. My dataset an unstructured
triangle mesh and gnuplot cannot handle ungridded data.

Can someone please recommend a utility that handles ungridded data. I
know of mview (http://mview.sourceforge.net/), unfortunately, mview
supports triangles alone, whereas I wish to plot points and lines and
not just triangles, ... or do I have to resort to OpenGL?

Hans-Bernhard Bröker

unread,
Aug 8, 2007, 11:38:49 AM8/8/07
to
Olumide wrote:
> I think I realize what the problem is. My dataset an unstructured
> triangle mesh and gnuplot cannot handle ungridded data.

It can handle lots of very small grids, though (again: see "help splot
datafile", and pay particular attention to "index"), and a triangles can
be disguised as quadrangles.

Olumide

unread,
Aug 8, 2007, 1:26:34 PM8/8/07
to

I've been reading the manual (this: http://www.gnuplot.info/docs/node329.html),
and I'm having trouble figuring how to do it. Would you please give me
small example or some more pointers?

Olumide

unread,
Aug 8, 2007, 1:55:58 PM8/8/07
to
On 8 Aug, 18:26, Olumide <50...@web.de> wrote:
> ...

> I've been reading the manual (this:http://www.gnuplot.info/docs/node329.html),
> and I'm having trouble figuring how to do it. Would you please give me
> small example or some more pointers?

Take for example, the following sequence of points,

A: 0 0 0
B: 10 0 0
C: 0 10 0
D: 20 10 0
E: 10 20 0
F: 20 20 0

forming two triangle as shown below (an unusual case, I know)


E .__________. F
\ |
\ |
\ |
\ |
\ |
\ |
\ |
\ |
\ |
C \|
. D
|\
| \
| \
| \
| \
| \
| \
| \
| \
----------.
A B


how would the sequence be presented to gnuplot in order to achieve the
desired effect?

Hans-Bernhard Bröker

unread,
Aug 8, 2007, 2:11:02 PM8/8/07
to
Olumide wrote:
> On 8 Aug, 18:26, Olumide <50...@web.de> wrote:
>> ...
>> I've been reading the manual (this:http://www.gnuplot.info/docs/node329.html),
>> and I'm having trouble figuring how to do it. Would you please give me
>> small example or some more pointers?
>
> Take for example, the following sequence of points,

> A: 0 0 0
> B: 10 0 0
> C: 0 10 0
> D: 20 10 0
> E: 10 20 0
> F: 20 20 0

Minimally:

splot '-' with lines
0 0 0
10 0 0

0 10 0
0 10 0


20 10 0
10 20 0

20 20 0
20 20 0
E

Olumide

unread,
Aug 8, 2007, 3:01:09 PM8/8/07
to
On 8 Aug, 19:11, Hans-Bernhard Bröker <HBBroe...@t-online.de> wrote:
> Minimally:
>
> splot '-' with lines
> 0 0 0
> 10 0 0
>
> 0 10 0
> 0 10 0
>
> 20 10 0
> 10 20 0
>
> 20 20 0
> 20 20 0


Erm ... not quite. There's an extra triangle (0, 10, 0) (20, 10, 0)
(10, 20, 0)


Hans-Bernhard Bröker

unread,
Aug 8, 2007, 3:04:43 PM8/8/07
to
Olumide wrote:
> On 8 Aug, 19:11, Hans-Bernhard Bröker <HBBroe...@t-online.de> wrote:
>> Minimally:
> Erm ... not quite. There's an extra triangle (0, 10, 0) (20, 10, 0)
> (10, 20, 0)

That's because you broke the data in copying them from my post. You
removed one empty line.

Olumide

unread,
Aug 8, 2007, 3:15:21 PM8/8/07
to

Thanks Hans, this worked ("-"s represent new lines):

0 0 0
10 0 0

-


0 10 0
0 10 0

-
-


20 10 0
10 20 0

-
20 20 0
2 20 0

Thanks again for helping an annoying n00b like myself. Seriously, tell
me, why do you do it ;-)
?

0 new messages