3
$\begingroup$

I'd like to draw a simple figure illustrating geometric perspective (so-called "central-point perspective") in which perspective lines on two cubes are extended "to infinity," where they meet.

Here is my first attempt:

Graphics3D[
 {
  Translate[Cuboid[], {-3/2, 0, 0}],
  Translate[Cuboid[], {1/2, 0, 0}],
  Red, Thickness[0.02],
  Line[{{-1/2, 0, 1}, {-1/2, 20, 1}}],
  Line[{{-1/2, 0, 0}, {-1/2, 20, 0}}],
  Line[{{1/2, 0, 1}, {1/2, 20, 1}}],
  Line[{{1/2, 0, 0}, {1/2, 20, 0}}]},
 Boxed -> False,
 ViewPoint -> {0, -.9, .05},
 PlotRegion -> {{0, 2}, {0, 50}, {0, 2}},
 ViewAngle -> 20 \[Degree]]

enter image description here

As you can see the red lines (by design) only extend a finite distance back. (I even had difficulty drawing them longer and re-setting the PlotRange.)

I'd like to draw HalfLine which, in theory, should extend to infinity, where all four red lines meet at the vanishing point.

Alas, I can't seem to make that work.

| improve this question | | | | |
$\endgroup$
4
$\begingroup$

I think you would like something like this:

Graphics3D[{Translate[Cuboid[],{-3/2,0,0}],Translate[Cuboid[],
{1/2,0,0}],Red,Thickness[0.02],
HalfLine[{{-1/2,0,1},{-1/2,20,1}}],
HalfLine[{{-1/2,0,0},{-1/2,20,0}}],
HalfLine[{{1/2,0,1},{1/2,20,1}}],
HalfLine[{{1/2,0,0},{1/2,20,0}}]},Boxed->False,ViewVector->{{0,-5,1+1/2},
{0,-1,0.5}},ViewAngle->40Degree,PlotRange->{{-150,150},{-150,150},{-150,150}}]

giving:

enter image description here

Note the use of ViewVector which is in coordinates of the plot, rather than using ViewPoint which is in non-dimensional units based on the dimensions of the plot. Furthermore, note that PlotRegion is changed to PlotRange.

| improve this answer | | | | |
$\endgroup$
  • 1
    $\begingroup$ Thanks so much. Precisely what I needed here, and will use in many other figures. ($\checkmark$) $\endgroup$ – David G. Stork Sep 30 '19 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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