2
$\begingroup$

I wanted to parameterize and draw a pyramid with a square base. The base was parameterized as a function of t , getting:

Show[ParametricPlot3D[{t, 0, 0}, {t, 0, 4}], 
 ParametricPlot3D[{4, t - 4, 0}, {t, 4, 8}], 
 ParametricPlot3D[{12 - t, 4, 0}, {t, 8, 12}], 
 ParametricPlot3D[{0, 16 - t, 0}, {t, 12, 16}], PlotRange -> Full]

The pyramid would be lifted from a point (2,2,8) , but when I draw the line between that vertex and one of the base lines, nothing works, and it separates all the graphs. Is there a better way for me to do this?

$\endgroup$
2
  • $\begingroup$ Do you really need the parametrization, or do you just want to draw a pyramid? In latter, you can use Pyramid. Also, instead of ParametricPlot3D, you can simply use Line. $\endgroup$
    – Domen
    Mar 26 at 20:51
  • $\begingroup$ I actually need the parametrization. I already used the Line command to do that but it's not really what I wanted. $\endgroup$
    – Sara
    Mar 26 at 20:53

1 Answer 1

2
$\begingroup$
Show[
{ParametricPlot3D[{0, 0, 0} t + (1 - t) {4, 0, 0}, {t, 0, 1}],
  ParametricPlot3D[{4, 0, 0} t + (1 - t) {4, 4, 0}, {t, 0, 1}],
  ParametricPlot3D[{4, 4, 0} t + (1 - t) {0, 4, 0}, {t, 0, 1}],
  ParametricPlot3D[{0, 4, 0} t + (1 - t) {0, 0, 0}, {t, 0, 1}],
  ParametricPlot3D[{0, 0, 0} t + (1 - t) {2, 2, 6}, {t, 0, 1}],
  ParametricPlot3D[{4, 0, 0} t + (1 - t) {2, 2, 6}, {t, 0, 1}],
  ParametricPlot3D[{0, 4, 0} t + (1 - t) {2, 2, 6}, {t, 0, 1}],
  ParametricPlot3D[{4, 4, 0} t + (1 - t) {2, 2, 6}, {t, 0, 1}]
},  PlotRange -> Full]

You forgot the list bracket of objects. The line parametrization is done conventionally by the convex combination of two points with factors t amd 1-t for t in the unit interval

$\endgroup$
2
  • $\begingroup$ Oh, I see. Thank you for the help! $\endgroup$
    – Sara
    Mar 26 at 22:00
  • $\begingroup$ Show works with or without the curly brackets, as illustrated in the documentation. $\endgroup$
    – bbgodfrey
    Mar 27 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.