Ask Your Question

Revision history [back]

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 :(

click to hide/show revision 2
reference to another question whose answer may be useful

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 will probably solve this problem too!