Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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] –  Pinguin Dirk Sep 15 '13 at 17:26
    
Thank you! This worked perfectly! –  guest Sep 15 '13 at 20:57

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
How would I make the points (1,2,1) and (5,7,13) also appear on the graph? They are part of the line. –  guest Sep 15 '13 at 21:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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