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.Sun, 23 Feb 2020 04:13:52 +0100How to get the points from a contour plot object?https://ask.sagemath.org/question/50024/how-to-get-the-points-from-a-contour-plot-object/I've defined a plot object for the hyperboloid in R^(-1,1).
hyperboloid = region_plot(-x^2+y^2 == 1, (x,-3,3),(y,-3,3))
I want to reflect this hyperboloid across a plane, and to do that I can't think of a better way than to somehow extract the points from the ContourPlot object behind the hyperboloid and then apply a reflection transformation to each point, then plot the points I get back. How do I get the points backing the plot? If that's not possible, or if there is a better way, how can I achieve my desired reflection?Sat, 22 Feb 2020 20:28:36 +0100https://ask.sagemath.org/question/50024/how-to-get-the-points-from-a-contour-plot-object/Answer by Juanjo for <p>I've defined a plot object for the hyperboloid in R^(-1,1).</p>
<pre><code>hyperboloid = region_plot(-x^2+y^2 == 1, (x,-3,3),(y,-3,3))
</code></pre>
<p>I want to reflect this hyperboloid across a plane, and to do that I can't think of a better way than to somehow extract the points from the ContourPlot object behind the hyperboloid and then apply a reflection transformation to each point, then plot the points I get back. How do I get the points backing the plot? If that's not possible, or if there is a better way, how can I achieve my desired reflection?</p>
https://ask.sagemath.org/question/50024/how-to-get-the-points-from-a-contour-plot-object/?answer=50036#post-id-50036I don't understand what it is $R^{(-1,1)}$ and, IMHO, an hyperboloid is a surface, so it should be traced in 3D. In such a case, you can play with [translations, scales and rotations](http://doc.sagemath.org/html/en/reference/plot3d/sage/plot/plot3d/base.html) to apply reflections. For example, this code plots a one sheet hyperboloid and mirrors it on the plane $y=2$:
var("x,y,z")
p = implicit_plot3d(x^2+y^2-z^2==1, (x,-2,2), (y,-2,2), (z,-1.5,1.5), color="green")
q = p.translate([0,-2,0]).scale([1,-1,1]).translate([0,2,0])
plane = implicit_plot3d(y==2,(x,-2,2), (y,-2,2), (z,-1.5,1.5), color="orange")
show(p+q+plane)
![image description](/upfiles/158242748748239.png)Sun, 23 Feb 2020 04:13:52 +0100https://ask.sagemath.org/question/50024/how-to-get-the-points-from-a-contour-plot-object/?answer=50036#post-id-50036