Comments (5)
I think I see what additions would be needed. At the moment I'm having trouble compiling Owl ("Unbound value Eigen.Dense.S.gemm" in owl_dense_common.ml--I'll investigate further), so for now I thought I'd just document what additions I think would be needed to allow different perspectives on 3D plots.
In owl_plot.ml, one would add the following.
In type page {...}
:
mutable altitude : float;
mutable azimuth : float;
And somewhere in the same file:
let set_altitude h s = (h.pages.(h.current_page)).altitude <- s
let set_azimuth h s = (h.pages.(h.current_page)).azimuth <- s
and in the definition of _prepare_page
, in the 3D plot section, in the call to plw3d
, replace 33.
by p.altitude
, and 115.
by p.azimuth
.
And add signatures and comments for set_altitude
and set_azimuth
to the .mli file.
See http://plplot.sourceforge.net/docbook-manual/plplot-html-5.12.0/plw3d.html and http://plplot.sourceforge.net/docbook-manual/plplot-html-5.12.0/plw3d.html .
from owl.
Yes, adding more fields to page type can be one solution. Another possible solution is incorporating the orientation parameters into the plot functions. You might already notice that Owl caches all the drawing operations then executes them one by one in the final stage. So it might be possible to cache
that orientation parameters in the drawing function.
But this is just my current thought, I don't know myself whether it works or not. Or if that is really a cleaner solution comparing to add more fields to the page type.
from owl.
OK, I'll look into those possibilities.
from owl.
I have altitude
and orientation
working as fields in the page in the way I described above: https://github.com/mars0i/owl/blob/master/lib/owl_plot.ml . I added functions set_altitude
and set_azimuth
to allow setting these values in the page structure.
The altitude and azimuth are used by the plplot function plw3d
, which sets up some of the 3D parameters. This is the only way to set the viewing perspective, as far as I know. plw3d
is already called in _prepare_page
in owl_plot.ml, so I simply modified that call so that it would use the altitude
and azimuth
from the page.
It makes some sense to store altitude
and azimuth
in the page structure, since plw3d
uses values from xrange
/yrange
/zrange
, which are also stored in the page.
About passing altitude and azimuth to mesh
and surf
:
Summary: altitude
and azimuth
should remain as fields in the page
structure; there's no other good way to store for execution by output
. It would be easy to add these as optional arguments to mesh
and surf
for these values (i.e. to cause them to be stored in the page structure). I don't have a clear opinion about whether this makes sense from a user perpsective.
At present, the optional parameters for mesh
and surv
are the handle and a contour
boolean. So viewing altitude
and azimuth
would be parameters of a different category than what mesh
and surf
have now. However, many of the 2D plotting functions have parameters that affect display, so maybe this would make sense.
plw3d
is not currently called in mesh
or surf
but is called in _prepare_page
, and plw3d
shouldn't be called within either the body of mesh
and surf
or in the function that they store in p.plots
. In that case the call to plw3d
would be overridden by the call to plw3d
in _prepare_page
when that is called in output
. So the best way to set the altitude and azimuth from mesh
or surf
would be to set fields in the page structure, just as p.is_3d
is currently set in these functions.
I guess for me, personally, I'm not sure that it makes sense to have optional altitude
and azimuth
parameters for mesh
and surf
, because I already set a number of other page parameters, so it's nature to set a couple of additional ones rather than passing arguments to mesh.
What do you think?
No need to comment immediately if you're busy, of course.
from owl.
Thinking about it further, it seems like it would be very convenient for experimentation in utop if mesh
and surf
had optional arguments for altitude
and azimuth
. I'll implement that.
from owl.
Related Issues (20)
- Precedence and associativity with infix operators
- Not all modules have aliases
- Ndarray sum keep_dims:true does not always keep dimensions
- Invalid_argument("index out of bounds") with Algodiff HOT 3
- Painful installation on MacOS HOT 4
- Can't build a module using Owl_stats_dist in dune, works in utop (arm64 mac) HOT 1
- How do I use gaussian_pdf in Owl.Arr? HOT 2
- The setter function for matrices in Owl_algodiff.D.Mat does not work HOT 2
- Cannot install owl-1.1 through opam because of `unmet availability conditions` HOT 2
- `libgfortran.so` not linked and causing compilation error HOT 8
- Cephes build warnings on Arch Linux
- Incorrect `Owl_const.min_float64` value? HOT 1
- Owl_dataframe shouldn' t use 'string_of_float' HOT 1
- Documentation is not in sync with current way plots are working
- OCaml cannot fins owl package HOT 1
- ssqr_diff' modifies inputs in place HOT 2
- Failure to load datasets for neural nets HOT 1
- Broken link to Algodiff module. HOT 2
- Exponential regression -- incorrect case HOT 1
- Test fails with GCC 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from owl.