

Hello,
I've got an ellipsoid, x and y with same dimensions (xr = yr =6800), and want to show only one half of it. When I set the ylimits so that only one half is shown (ylim([0 6800]), the graph is stretched, so that it looks like half of an egg.
I've tried to set the dataspectratio to [1 1 1] but then the graph is only shown in right dimensions when I look from the front( like 2D).
For Matlab I've found the "axis vis3d" function which allows to rotate a 3Dgraph showing the right dimensons from all directions, but I can't find something like that for Octave.
(mathworks.com: "axis vis3d freezes aspect ratio properties to enable rotation of 3D objects and overrides stretchtofill.")
I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2
I would be very very thankful if someone has a solution for that, because I've been trying to solve it by myself for many many frustrating hours.
Greetings!
Clara
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


2011/5/3 Clara Brück < [hidden email]>:
> For Matlab I've found the "axis vis3d" function which allows to
> rotate a 3Dgraph showing the right dimensons from all directions,
> but I can't find something like that for Octave.
If you try axis([xlo,xhi,ylo,yhi,zlo,zli],"square"), do you get what
you want?
> I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2
This is a very old Octave version. Are you unable to get a newer
version? I'm almost sure the solution I proposed above won't work on
an older version.
HTH,
 Jordi G. H.
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


> For Matlab I've found the "axis vis3d" function which allows to
> rotate a 3Dgraph showing the right dimensons from all directions,
> but I can't find something like that for Octave.
Hello, Clara
I wrote something in the online wiki about this. Have a look at the section headed "Adjusting axes on threedimensional plots" on the following page to see if it addresses your problem.
http://wiki.octave.org/wiki.pl?Producing_Graphical_OutputYou might need to experiment with the vector (denoted [a b c d]) in the set(gca(), 'position', [ a b c d]) command  I'm afraid I can't remember whether there was some reason for the numbers I used or whether I found them by trial and error.
Best wishes
However good you think Octave is, it's much, much better.


Hi,
Thanks for your answers!
>2011/5/3 Jordi Gutiérrez Hermoso [hidden email]
>
>> I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2
>
> This is a very old Octave version. Are you unable to get a newer
> version? I'm almost sure the solution I proposed above won't work on
> an older version.
I need a portable version, because I'm supposed to test a portable Version of Octave.
It should be for students in University, so that they can use it from a USBStick everywhere.
This version is the newest portable Version that I've found.
> If you try axis([xlo,xhi,ylo,yhi,zlo,zli],"square"), do you get what
> you want?
Tried this:
octave:5> axis([8000,8000,0,8000,8000,8000],"square")
but the result is exactly the same (2D okay, 3D>"1/2egg") :(
But I'dont want it to be a squere anyway.
I want the x and z axis to have the same length and y should be half as long.
>2011/5/3 "pathematica"
> I wrote something in the online wiki about this. Have a look at the section
> headed "Adjusting axes on threedimensioinal plots" to see if it addresses
> your problem.
>
> You might need to experiment with the vector (denoted [a b c d]) in the
> set(gca(), 'position', [ a b c d]) command  I'm afraid I can't remember
> whether there was some reason for the numbers I used or whether I found them
> by trial and error.
>>octave:4> set (gca (), "position", [0.13000 0.05000 0.77500 1.08000]); %force cubic aspect
Tried this also:
octave:17> axis([8000,8000,0,8000,8000,8000],"square")
octave:18> hold("on")
octave:19> plot3 ([0 8000]', [0 8000]', [0 8000]', "r")
octave:20> set (gca (), "position", [0.13000 0.05000 0.77500 1.08000]);
But that changes absolutely nothing, too :(
Tried other values, but always the same result>nothing changes
I think I have to come to the conclusion, that Octave(at least the portable version) can't be used for this purpose.
Thanks for your suggestions anyway!!
Greetings
Clara
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


2011/5/4 Clara Brück < [hidden email]>:
>
>>2011/5/3 Jordi Gutiérrez Hermoso [hidden email]
>>
>>> I'm using a portable version : Octave 3.0.0 whith QtOctave 0.7.2
>>
>> This is a very old Octave version. Are you unable to get a newer
>> version? I'm almost sure the solution I proposed above won't work on
>> an older version.
>
> I need a portable version,
Excuse my ignorance, but what is a portable version of Octave? Where
did you find this very old 3.0.0 version? The graphics support was
very beta back then, but it's gotten better. Can we help you get a
newer version?
>> If you try axis([xlo,xhi,ylo,yhi,zlo,zli],"square"), do you get what
>> you want?
>
> Tried this:
>
> octave:5> axis([8000,8000,0,8000,8000,8000],"square")
>
> but the result is exactly the same (2D okay, 3D>"1/2egg") :(
> But I'dont want it to be a squere anyway.
Square doesn't mean that all axes will be the same length. It means
the projection deformation along each axis will be the same. I'm
almost sure this is what you want.
Can you show me the full code for making your ellipsoid? I can take a
screenshot with Octave 3.4 and square projection and show it to you.
If it's what you want, maybe we can work on getting a version of
Octave 3.4 that you can easily share with your students.
 Jordi G. H.
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


On 4 May 2011, at 14:29, Jordi Gutiérrez Hermoso wrote:
> Square doesn't mean that all axes will be the same length. It means
> the projection deformation along each axis will be the same. I'm
> almost sure this is what you want.
I might be mistaken, but isn't that done with the option "equal" rather than "square"?
c.
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


Tried this also:
octave:17> axis([8000,8000,0,8000,8000,8000],"square")
octave:18> hold("on")
octave:19> plot3 ([0 8000]', [0 8000]', [0 8000]', "r")
octave:20> set (gca (), "position", [0.13000 0.05000 0.77500 1.08000]);
This works on my Octave version 3.2.3 (just tried it)
May I just check that you noticed that your axes do not have a cubic ratio. Did you mean to write
axis([8000,8000, 8000,8000,8000,8000],"square")?
With regard to your other question
>Is there a possibility to make the ellipsoid transparent, so that these 3 Lines are visible?
the command that you need is
hidden()
This may be used as above; under these circumstances, it will toggle between 'off' and 'on', or you could specify explicitly eg
hidden('off')
Hope this works.
_______________________________________________
Helpoctave mailing list
[hidden email]https://mailman.cae.wisc.edu/listinfo/helpoctave
However good you think Octave is, it's much, much better.


> hidden off
I apologise  I did not notice that Jordi had already answered this.
However, there is a refinement.
I have just experimented with plotting a plane in plot3() and a cube that intersects with the plane.
I found that the order of plotting is important.
The following appears to work:
Plot the plane (or your spheroid), then
octave:>hidden off
then plot the other structure
For some reason, plotting the structure before specifying hidden off makes the plane transparent for the axes but not for the object.
Hope this might work.
However good you think Octave is, it's much, much better.


Clara
I have just noticed that you intentionally made your axes asymmetric, presumably so that the spheroid was cut in half. The set(gca() ...) command is forcing the plot to a cubic aspect, so that one of your axes is stretched. I tried to experiment with the parameters passed to see if this might be ameliorated but I did not succeed.
Does the following do what you wanted (it actually highlights some bugs, which you might note)?
octave:1> clf;
octave:2> axis([(1+3*eps) 1 1 1 1 1], 'square');
octave:3> hold on;
octave:4> [x,y,z] = sphere;
octave:5> mesh(x1, y, z);
octave:6> hidden off;
octave:7> set (gca (), "position", [0.13000 0.05000 0.77500 1.08000]);
octave:8> plot3 ([1 1], [0 0], [1 1], "r", 'linewidth', 2);
octave:9> plot3 ([1 1], [1 1], [0 0], "r", 'linewidth', 2);
octave:10> plot3 ([1 1], [0 0], [0 0], "r", 'linewidth', 2);
octave:11> box off;
octave:12> axis off;
Notes
1) I cleared the figure.
2) I gave the axes equal scales (each from from 1 to 1 rather than your scales  see below).
I added 3*eps for a particular reason (eps denotes the smallest number in Octave's float representation)  see step 6.
3) I set hold on so that the axes would not be altered by subsequent plots.
4) I loaded the values for a unit sphere (I see you had a sphere of radius 8000  I could not see how to do that but presumably you know!).
5) I plotted the sphere as a mesh rather than as a surface. I placed it with its centre at (1, 0, 0) so that it would be bisected at the yz plane through x = 1.
6) I set hidden off at this point so that the axes would be visible (to be plotted). This appears to highlight some bugs  there are some stray lines on my plot at various points, including from the "south pole" off in the positive x direction and some stray mesh lines in the negative x direction on one side of the sphere. I found that the great circle through in the yz plane at x=1 did not plot fully with the x axis specified as 1 to 1, which is why I added a small number (arbitrary 3 times the smallest float number  perhaps the smallest float would have worked just as well).
7) This step forces a cubic aspect ratio. As I have made the magnitude of each axis the same, the hemisphere assumes the correct spherical symmetry.
8, 9 and 10) This plots coordinate axes by hand. I made them red and with a linewidth of 2 to emphasise them.
11 and 12) I turned off the box and the axes, so that the red axes that I had created were left as the only coordinate axes.
As noted, whilst this might be what you intended (I leave you to scale the axes and the sphere to the size that you want) it features a few bugs in the mesh plot with hidden off.
Best wishes
However good you think Octave is, it's much, much better.


This was the output ...
However good you think Octave is, it's much, much better.


This is without hidden off to show that the bugs do not appear under these circumstances
However good you think Octave is, it's much, much better.


Hi!
That's perfect!
Many Many Thanks!!
Thats my Code and it works :)
clf;
xc=0
yc=0
zc=0
xr=yr= 7000
zr=5000
n = 20
axis([8000 8000 8000 8000 8000 8000], 'square');
hold on;
[x,y,z] = ellipsoid(xc,yc,zc,xr,yr,zr,n);
mesh(x8000, y, z);
#hidden off;
set (gca (), "position", [0.13000 0.05000 0.77500 1.08000]);
plot3 ([8000 8000], [0 0], [8000 8000], "color", "r", 'linewidth', 2);
plot3 ([8000 8000], [8000 8000], [0 0], "color", "r", 'linewidth', 2);
plot3 ([8000 8000], [0 0], [0 0], "color","r", 'linewidth', 2);
box off;
#axis off;
I've got the problems with the wrong lines with hidden off, too.
But the lines are visible from the front. I think that should do it.
Greetings!
Clara


Hi, Clara
I have submitted a bug report (#33239 at http://savannah.gnu.org/bugs/?group=octave). I see Jordi has already confirmed it !
I am sure you would know yourself, but would it suit your purpose better to plot the ellipsoid centred on the origin, with the scale on the axis that is orthogonal to the bisection specified as 0 to 16000?
David
However good you think Octave is, it's much, much better.


Clara
Thank you for drawing my attention to the "ellipsoid" function. It's fun!
I have experimented with it a little. As you will probably have noted yourself, your code (as it stands, plotting the centre so that it is at x=8000) might be rationalised slightly by setting:
xc = 8000 (rather than 0) during the declarations
and calling
mesh(x, y, z)
However good you think Octave is, it's much, much better.


Jordi
Do you know whether there is a particular reason why the "offset" for the mesh plot does not reflect the mathematical logic behind passing parameters to a function to specify a translation?
As you will know eg:
f(x k) translates f(x) in the positive direction along the x axis.
Whereas (unless I have made a silly mistake that will come back to embarrass me!), this conflicts with the notation for the mesh function eg:
mesh(x k, y, z) translates the (3d) plot in the negative direction (in this particular case along the x axis also).
However good you think Octave is, it's much, much better.


Hi David,
Do you mean that the y and z axis goes from 8000 to 8000 and the xaxis from 0 to 16000?
Tried this, but then there is a missing section on the negative side of the yaxis. It's not "fully" half. Don't know why, I've only changed
>>axis([8000 8000 8000 8000 8000 8000], 'square'); to
>>axis([0 16000 8000 8000 8000 8000], 'square');
Clara


Hello Clara
C.B. wrote
Do you mean that the y and z axis goes from 8000 to 8000 and the xaxis from 0 to 16000?
Tried this, but then there is a missing section on the negative side of the yaxis. It's not "fully" half.
The problem you have noted is related to notes 2 and 6 in my post above.
Presumably, the plotting routine considers one of the lines of longitude (the one which is missing) just the wrong side of the bounding plane whereas it considers the other within the active region to be plotted.
In my original post, I added a small number (a small multiple of eps) to the relevant end of the relevant axis to avoid this problem. It is possible to achieve the same thing for the scales at which you are working by specifying the x axis as 1 to 16000.
So, the following works (note the xlo and xhi)
octave3.2.3:1> clf;
octave3.2.3:2> xc=0; yc=0; zc=0; xr=7000; yr=7000; zr=5000; n=20;
octave3.2.3:3> axis([1 16000 8000 8000 8000 8000], 'square');
octave3.2.3:4> hold on;
octave3.2.3:5> [x y z]= ellipsoid(xc, yc, zc, xr, yr, zr, n);
octave3.2.3:6> mesh(x, y, z);
octave3.2.3:7> set (gca(), 'position', [0.13 0.05 0.775 1.08]);
octave3.2.3:8> plot3 ([0 0], [0 0], [8000 8000], 'color', 'r', 'linewidth', 2);
octave3.2.3:9> plot3 ([0 0], [8000 8000], [0 0], 'color', 'r', 'linewidth', 2);
octave3.2.3:10> plot3 ([0 16000], [0 0], [0 0], 'color', 'r', 'linewidth', 2);
However good you think Octave is, it's much, much better.

