Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3354 > unrolled thread

Strange Mobius strip in rendering a cylinder with pm3d

Started bymusiphil@bawi.org
First post2016-06-27 21:43 -0700
Last post2016-07-03 18:47 -0700
Articles 6 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Strange Mobius strip in rendering a cylinder with pm3d musiphil@bawi.org - 2016-06-27 21:43 -0700
    Re: Strange Mobius strip in rendering a cylinder with pm3d Michael Okuntsov <okuntsov.mikhail@yandex.ru> - 2016-06-28 16:20 +0700
      Re: Strange Mobius strip in rendering a cylinder with pm3d musiphil@bawi.org - 2016-06-28 09:46 -0700
      Re: Strange Mobius strip in rendering a cylinder with pm3d musiphil@bawi.org - 2016-06-28 10:27 -0700
    Re: Strange Mobius strip in rendering a cylinder with pm3d Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2016-06-29 00:04 +0200
      Re: Strange Mobius strip in rendering a cylinder with pm3d musiphil@bawi.org - 2016-07-03 18:47 -0700

#3354 — Strange Mobius strip in rendering a cylinder with pm3d

Frommusiphil@bawi.org
Date2016-06-27 21:43 -0700
SubjectStrange Mobius strip in rendering a cylinder with pm3d
Message-ID<baced62a-4792-4aa4-a004-25b172c98d41@googlegroups.com>
Hello group,

I have the following gnuplot script:

set palette rgbformula 22,13,-31  # optional
splot "data" using (3*cos($1)):(2*sin($1)):2:3 palette with pm3d notitle

where "data" is generated by the following program (made up for illustrative purposes):

#!/usr/bin/python
import math

T = 36
H = 36

for i in xrange(T + 1):
	t = (2.0 * i / T - 1) * math.pi
	for j in xrange(H):
		h = 1.0 * j / H
		print '%+.4f\t%.4f\t%.4f' % (t, h, h)
	print

The graph I get, https://snag.gy/52RVPv.jpg, is twisted strangely like a Mobius strip.
Is there anything I did wrong and could correct, or is it a bug in gnuplot?
(Tested on: gnuplot 5.0 patchlevel 0 on Mac OS X.)

Thank you.

[toc] | [next] | [standalone]


#3355

FromMichael Okuntsov <okuntsov.mikhail@yandex.ru>
Date2016-06-28 16:20 +0700
Message-ID<nktfh7$n0k$1@dont-email.me>
In reply to#3354
28.06.2016 11:43, musiphil@bawi.org пишет:
> splot "data" using (3*cos($1)):(2*sin($1)):2:3 palette with pm3d notitle

I've tried to plot it in gnuplot 4.6, and it plots without this effect.
Try set hidden3d.

[toc] | [prev] | [next] | [standalone]


#3356

Frommusiphil@bawi.org
Date2016-06-28 09:46 -0700
Message-ID<dbe5a3f0-9e78-47c5-9122-a48a4a76bf2b@googlegroups.com>
In reply to#3355
On Tuesday, June 28, 2016 at 2:20:41 AM UTC-7, Michael Okuntsov wrote:
> 28.06.2016 11:43, musi....@bawi.org пишет:
> > splot "data" using (3*cos($1)):(2*sin($1)):2:3 palette with pm3d notitle
> 
> I've tried to plot it in gnuplot 4.6, and it plots without this effect.
> Try set hidden3d.

Thank you. I've tried set hidden3d as well, but the result is similar: https://snag.gy/t3GW1K.jpg

[toc] | [prev] | [next] | [standalone]


#3357

Frommusiphil@bawi.org
Date2016-06-28 10:27 -0700
Message-ID<e406a022-073c-4532-924b-da5126700b73@googlegroups.com>
In reply to#3355
On Tuesday, June 28, 2016 at 2:20:41 AM UTC-7, Michael Okuntsov wrote:
> 28.06.2016 11:43, musi...@bawi.org пишет:
> > splot "data" using (3*cos($1)):(2*sin($1)):2:3 palette with pm3d notitle
> 
> I've tried to plot it in gnuplot 4.6, and it plots without this effect.
> Try set hidden3d.

Also tried with gnuplot 4.6 patchlevel 4 on Linux; got the same thing: https://snag.gy/v6LmjY.jpg
set hidden3d seems to make no difference.

So far I've shared only the "best" shots, but sometimes a weird "cut" appears, depending on the viewing angle; e.g. https://snag.gy/BgwAfX.jpg

[toc] | [prev] | [next] | [standalone]


#3358

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2016-06-29 00:04 +0200
Message-ID<dtgakaF7thaU1@mid.dfncis.de>
In reply to#3354
Am 28.06.2016 um 06:43 schrieb musiphil@bawi.org:

> splot "data" using (3*cos($1)):(2*sin($1)):2:3 palette with pm3d notitle
>
> where "data" is generated by the following program (made up for illustrative purposes):

[...]

Just FTR, there's not really a need to use a datafile to get that effect:

	set parametric
	splot [h=0:1][phi=-pi:pi] cos(phi),sin(phi),h w pm3d

And the root cause is quite simple: pm3d doesn't actually respect the 
screen z coordinate (i.e. front-to-back) by default.  It draws the 
patches of colour in the same order they have in your input.  And yes, 
that drawing order is quite wrong in a large fraction of possible 
orientations of this particular surface.

The solution is to read "help pm3d" and find out about "depthorder".

[toc] | [prev] | [next] | [standalone]


#3365

Frommusiphil@bawi.org
Date2016-07-03 18:47 -0700
Message-ID<c9e15b73-05a0-43df-b740-74c7370e9262@googlegroups.com>
In reply to#3358
On Tuesday, June 28, 2016 at 3:04:59 PM UTC-7, Hans-Bernhard Bröker wrote:
> 
> Just FTR, there's not really a need to use a datafile to get that effect:
> 
> 	set parametric
> 	splot [h=0:1][phi=-pi:pi] cos(phi),sin(phi),h w pm3d

Yeah. My use case involves a datafile, so I wanted to reproduce the behavior in a situation as similar as possible. It's useful to know the same behavior is observed wth function plots.

> And the root cause is quite simple: pm3d doesn't actually respect the 
> screen z coordinate (i.e. front-to-back) by default.  It draws the 
> patches of colour in the same order they have in your input.  And yes, 
> that drawing order is quite wrong in a large fraction of possible 
> orientations of this particular surface.
> 
> The solution is to read "help pm3d" and find out about "depthorder".

Yes, "set pm3d depthorder" was the solution indeed. (I wonder why that's not the default, but others may have different situations.) Thanks a lot!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web