1
$\begingroup$

I have to plot the line 1 + 4 t, 2 + 5 t, 1 + 12 t and the polygon with points {2, 3, 4}, {1, 4, 5}, {3, 3, 3} in the same graph to see if the line goes through the polygon. I was able to get them to plot separately but I cannot get them to plot together.

This is what I typed in:

pic1 = ParametricPlot3D[{1 + 4 t, 2 + 5 t, 1 + 12 t}, {t, 0, 12}];
pic2 = p = Polygon[{{2, 3, 4}, {1, 4, 5}, {3, 3, 3}}]
{Graphics3D[{Pink, p}]}
Show[pic1, pic2, PlotRange -> Automatic]

But I get the error:

Coordinate {Skeleton[3]} should be a triple of numbers, or a Scaled form.

How do I fix this?

$\endgroup$
2
  • $\begingroup$ you probably just have a simple syntax error, is that what you want: pic1 = ParametricPlot3D[{1 + 4 t, 2 + 5 t, 1 + 12 t}, {t, 0, 1}]; p = Polygon[{{2, 3, 4}, {1, 4, 5}, {3, 3, 3}}] ; pic2 = {Graphics3D[{Pink, p}]}; Show[pic1, pic2, PlotRange -> Automatic] $\endgroup$ Sep 15, 2013 at 17:26
  • $\begingroup$ Thank you! This worked perfectly! $\endgroup$
    – guest
    Sep 15, 2013 at 20:57

1 Answer 1

1
$\begingroup$

Besides the syntax error, your main problem is with your plot range. The following will work.

pic1 = ParametricPlot3D[{1 + 4 t, 2 + 5 t, 1 + 12 t}, {t, 0, 12}];
pic2 = Graphics3D[{Pink, Polygon[{{2, 3, 4}, {1, 4, 5}, {3, 3, 3}}]}];
Show[pic1, pic2, 
  Lighting -> {{"Ambient", White}},
  PlotRange -> {{1, 5}, {2, 7}, {1, 13}}]

plot.png

I also set the plot's lighting so that your pink triangle would appear in its true color.

Edit

The OP requests that the points {1, 2, 1} and {5, 7, 12} appear in the plot. I have modified the plot range to include these points.

$\endgroup$
1
  • $\begingroup$ How would I make the points (1,2,1) and (5,7,13) also appear on the graph? They are part of the line. $\endgroup$
    – guest
    Sep 15, 2013 at 21:03

Your Answer

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

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