2
$\begingroup$

I am trying to draw this picture

enter image description here

I tried

Graphics3D[{Cuboid[{0, 0, 0}, {6, 8, 4}] }, Boxed -> False]

enter image description here

$\endgroup$

3 Answers 3

6
$\begingroup$
cbd = {{0, 0, 0}, {6, 8, 4}};
roof = {{0, 0, 4}, {0, 8, 4}, {0, 4, 6.3}, {6, 0, 4}, {6, 8, 4}, {6, 
    4, 6.3}};
base = Graphics3D[{Line[{{6, 4, 4}, {6, 4, 6.3}}], 
   Line[{{6, 3.8, 4}, {6, 4, 4}, {6, 4, 4.2}, {6, 3.8, 4.2}, {6, 3.8, 
      4}}],
   Text[Rotate["2.3 m", -Pi/2], {6, 4, 5.15}, {-2, 0}],
   Text[Rotate["6 m", -Pi/2], {3, 0, 0}, {2.5, 0}],
   Text["8 m", {6, 4, 0}, {0, 2}],
   Text["4 m", {6, 8, 2}, {-2, 0}], Opacity[0]
   , Cuboid @@ cbd, Prism[roof]}, Boxed -> False]

enter image description here

$\endgroup$
6
$\begingroup$
Clear[polys, polyhedron];
polys = {Polygon[{{0, 0}, {8, 0}, {8, 4}, {0, 4}}], 
   Polygon[{{8, 4}, {4, 4 + 2.3}, {0, 4}}]};
polyhedron = RegionProduct[#, Line[{{0}, {6.}}]] & /@ polys;
DynamicModule[{point = 10 {Cos[1.9], .5, Sin[1.9]}, 
  vertical = {0, 1, 0}, angle = 8 Degree}, 
 Overlay[Graphics3D[#, Lighting -> {{"Ambient", White}}, 
     Boxed -> False, ViewPoint -> Dynamic@point, 
     ViewVertical -> Dynamic@vertical, 
     ViewAngle -> Dynamic@angle] & /@ {{EdgeForm[
      AbsoluteThickness[3]], 
     polyhedron}, {EdgeForm[
      Directive@{AbsoluteThickness[2], 
        AbsoluteDashing[{1, 6}, 0, "Round"]}], FaceForm[], polyhedron,
      Thick, Line[{{4, 4 + 2.3, 6}, {4, 4, 6}}], 
     Line[{{4, 4 + .3, 6}, {4 + .3, 4 + .3, 6}, {4 + .3, 4, 6}}]}}, 
  All, 1]]

enter image description here

$\endgroup$
1
  • $\begingroup$ +1 . Like RegionProduct and Overlay. Very nice. :) $\endgroup$
    – ubpdqn
    Commented Oct 6 at 7:25
5
$\begingroup$
p1 = Prism[{{0, 0, 4}, {0, 8, 4}, {0, 4, 4 + 2.3}, {6, 0, 4}, {6, 8, 
     4}, {6, 4, 4 + 2.3}}];
c1 = Cuboid[{0, 0, 0}, {6, 8, 4}];
Graphics3D[{Transparent, p1, c1}
 , Boxed -> False
 , Axes -> True
 , AxesEdge -> Automatic
 ]

hut outline

$\endgroup$
1
  • 2
    $\begingroup$ For more advanced sketching, see Graphics3DSketch function available at the Wolfram Function Repository. $\endgroup$
    – Syed
    Commented Oct 6 at 9:24

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.