ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 25 Apr 2011 16:23:50 +0200Can I cache a rendered 3d graphic (for @interact)?https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/I'd like to make a simple interact for the notebook which shows a certain 3d object, and lets the user move a point around in the object and see data about that point. (For example, the object could be the domain of a certain function, and the data could have to do with values of the function in `RR^2`). The problem is that the 3d object takes a few seconds to render, and every time the point moves, the object has to be re-rendered. This makes the interact unusable.
So can I somehow tell Sage to just add one point to the object which it's already rendered? Note that I am pre-computing the 3d object and storing it in a variable, `g`. Then my interact function just takes coordinates as input and does
(g + point3d(x,y,z)).show()
But this is still too slow :(
----
UPDATE: The method described in the question about [fast show for cached plots](http://ask.sagemath.org/question/517/fast-show-for-cached-plots-for-interact) will probably solve this problem too!Fri, 25 Feb 2011 16:44:16 +0100https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/Comment by Kelvin Li for <p>I'd like to make a simple interact for the notebook which shows a certain 3d object, and lets the user move a point around in the object and see data about that point. (For example, the object could be the domain of a certain function, and the data could have to do with values of the function in <code>RR^2</code>). The problem is that the 3d object takes a few seconds to render, and every time the point moves, the object has to be re-rendered. This makes the interact unusable.</p>
<p>So can I somehow tell Sage to just add one point to the object which it's already rendered? Note that I am pre-computing the 3d object and storing it in a variable, <code>g</code>. Then my interact function just takes coordinates as input and does</p>
<pre><code>(g + point3d(x,y,z)).show()
</code></pre>
<p>But this is still too slow :(</p>
<hr/>
<p>UPDATE: The method described in the question about <a href="http://ask.sagemath.org/question/517/fast-show-for-cached-plots-for-interact">fast show for cached plots</a> will probably solve this problem too!</p>
https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/?comment=21799#post-id-21799Try: `your_3d_object.show(viewer='canvas3d')`. It uses the <canvas> HTML5 element, so it might load faster than Jmol or tachyon. However, you'll just get a simple wireframe, and it can be very slow if your 3d object is complex (i.e. highly-detailed mesh).Mon, 25 Apr 2011 16:23:50 +0200https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/?comment=21799#post-id-21799Comment by niles for <p>I'd like to make a simple interact for the notebook which shows a certain 3d object, and lets the user move a point around in the object and see data about that point. (For example, the object could be the domain of a certain function, and the data could have to do with values of the function in <code>RR^2</code>). The problem is that the 3d object takes a few seconds to render, and every time the point moves, the object has to be re-rendered. This makes the interact unusable.</p>
<p>So can I somehow tell Sage to just add one point to the object which it's already rendered? Note that I am pre-computing the 3d object and storing it in a variable, <code>g</code>. Then my interact function just takes coordinates as input and does</p>
<pre><code>(g + point3d(x,y,z)).show()
</code></pre>
<p>But this is still too slow :(</p>
<hr/>
<p>UPDATE: The method described in the question about <a href="http://ask.sagemath.org/question/517/fast-show-for-cached-plots-for-interact">fast show for cached plots</a> will probably solve this problem too!</p>
https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/?comment=22049#post-id-22049It could be a fixed background, although I had wanted people to be able to rotate and zoom it (I've been using jMol). But I could have one 3d graphic showing the object, and then for the interact maybe some kind of "wireframe" which would render faster.Sat, 26 Feb 2011 08:23:19 +0100https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/?comment=22049#post-id-22049Comment by DSM for <p>I'd like to make a simple interact for the notebook which shows a certain 3d object, and lets the user move a point around in the object and see data about that point. (For example, the object could be the domain of a certain function, and the data could have to do with values of the function in <code>RR^2</code>). The problem is that the 3d object takes a few seconds to render, and every time the point moves, the object has to be re-rendered. This makes the interact unusable.</p>
<p>So can I somehow tell Sage to just add one point to the object which it's already rendered? Note that I am pre-computing the 3d object and storing it in a variable, <code>g</code>. Then my interact function just takes coordinates as input and does</p>
<pre><code>(g + point3d(x,y,z)).show()
</code></pre>
<p>But this is still too slow :(</p>
<hr/>
<p>UPDATE: The method described in the question about <a href="http://ask.sagemath.org/question/517/fast-show-for-cached-plots-for-interact">fast show for cached plots</a> will probably solve this problem too!</p>
https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/?comment=22050#post-id-22050Does the 3d image itself need to change, or is it basically a fixed background? And is it jmol or matplolib or tachyon?Fri, 25 Feb 2011 19:29:20 +0100https://ask.sagemath.org/question/7969/can-i-cache-a-rendered-3d-graphic-for-interact/?comment=22050#post-id-22050