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.Sat, 28 May 2016 22:53:48 +0200How to plot a 3D Triangle (prism) using parametric_plot3dhttps://ask.sagemath.org/question/33571/how-to-plot-a-3d-triangle-prism-using-parametric_plot3d/ I need to plot a 3d Triangle (prism), but i dont have any idea of how to make it. I try a lot of things but didn't work, please help me. Sat, 28 May 2016 21:33:05 +0200https://ask.sagemath.org/question/33571/how-to-plot-a-3d-triangle-prism-using-parametric_plot3d/Answer by calc314 for <p>I need to plot a 3d Triangle (prism), but i dont have any idea of how to make it. I try a lot of things but didn't work, please help me. </p>
https://ask.sagemath.org/question/33571/how-to-plot-a-3d-triangle-prism-using-parametric_plot3d/?answer=33572#post-id-33572Here is one approach. This does not plot the ends.
var('s t')
p0start=vector([1,0,0])
p1start=vector([-1/2,0,sqrt(3)/2])
p2start=vector([-1/2,0,-sqrt(3)/2])
p0end=vector([1,1,0])
p1end=vector([-1/2,1,sqrt(3)/2])
p2end=vector([-1/2,1,-sqrt(3)/2])
side1=(1-s)*((1-t)*p0start+t*p1start)+s*((1-t)*p0end+t*p1end)
side2=(1-s)*((1-t)*p1start+t*p2start)+s*((1-t)*p1end+t*p2end)
side3=(1-s)*((1-t)*p2start+t*p0start)+s*((1-t)*p2end+t*p0end)
parametric_plot3d(side1,(t,0,1),(s,0,1))+parametric_plot3d(side2,(t,0,1),(s,0,1))+parametric_plot3d(side3,(t,0,1),(s,0,1)) Sat, 28 May 2016 22:53:48 +0200https://ask.sagemath.org/question/33571/how-to-plot-a-3d-triangle-prism-using-parametric_plot3d/?answer=33572#post-id-33572