Code Monkey home page Code Monkey logo

Comments (5)

mars0i avatar mars0i commented on May 13, 2024 1

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.

ryanrhymes avatar ryanrhymes commented on May 13, 2024

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.

mars0i avatar mars0i commented on May 13, 2024

OK, I'll look into those possibilities.

from owl.

mars0i avatar mars0i commented on May 13, 2024

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.

mars0i avatar mars0i commented on May 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.