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 this graph:

http://i.stack.imgur.com/nag9x.png

But it doesn't have a function so I can't just plugin in a function into wolfram or mathematica to plot it. I have these coordinates to make it however:

(1, 0, 1)  (2, 0, 1)  (1, 0, 2)  (2, 0, 2)  (1, Pi/6, 1)  (2, Pi/6, 1)  (1, Pi/6, 2)  (2, Pi/6, 2)

How would I enter this in wolfram or mathematica to plot it? I am trying to download the STL file for it to print it in 3D.

share|improve this question
    
By "wolfram", do you mean "Wolfram | Alpha"? –  m_goldberg Nov 23 '13 at 23:40
    
Plus, pi is not a recognized symbol; use Pi instead –  Sektor Nov 23 '13 at 23:42
    
Yes I mean wolfram alpha or mathematica, I know wolfram alpha has a plot function where you can download 3D STL's and 3Ds files if you have a pro account. –  Ratman2050 Nov 23 '13 at 23:42
add comment

3 Answers

up vote 5 down vote accepted

Just to get you started

RegionPlot3D[
   0 < z < 1 && 1 < Norm[{x, y}] < 2 && 1/2 < ArcTan[y, x] < 1.1, 
   {x, 0, 3}, {y, 0, 3}, {z, -1, 2}, PlotPoints -> 100, Mesh -> False, 
   PlotStyle -> Directive[Opacity[.3], Yellow]]

enter image description here

share|improve this answer
    
Can you explain this 0 < z < 1 && 1 < Norm[{x, y}] < 2 && 1/2 < ArcTan[y, x] < 1.1, I understand the rest of that code, thanks. –  Ratman2050 Nov 24 '13 at 0:34
    
@Ratman2050 Take a look at the help page for RegionPlot3D. There are lot of example in there –  belisarius Nov 24 '13 at 0:36
add comment

As belisarius has shown(and I have voted for his answer) RegionPlot3D allows you to plot your region. FYI:

  1. Your lists of coordinates (as with all lists in Mathematica):

     coord = {{1, 0, 1}, {2, 0, 1}, {1, 0, 2}, {2, 0, 2}, {1, Pi/6, 1}, {2,
     Pi/6, 1}, {1, Pi/6, 2}, {2, Pi/6, 2}};
    
  2. You can transform these cylindrical coordinates to cartesian coordinates:

     pts = CoordinateTransform["Cylindrical" -> "Cartesian", coord]
    
  3. You need to define your region using inequalities, as per belisarius, and you can overlay your vertices to check:

    Show[RegionPlot3D[1 <= z <= 2 && 1 <= Norm[{x, y}] <= 2 && 
    0 < Arg[Complex[x, y]] < Pi/6, {x, 0, 3}, {y, 0, 3}, {z, 0, 3}, 
    Mesh -> False, PlotStyle -> Opacity[0.4], PlotPoints -> 100], 
    Graphics3D[{Red, PointSize[0.02], Point[pts]}]]
    

enter image description here

share|improve this answer
    
For those who are viewing this question, I would have chosen this answer as it is more complete, but I think belisarius deserved some credit since he had the first answer. But thank you ubpdqn, this outputted the STL file very nicely. –  Ratman2050 Nov 24 '13 at 23:30
add comment

Here's something I use in class to demonstrate cylindrical coordinates (sorry for the length, but it's what I have :):

Manipulate[
 With[{$θColor = Red, $rColor = Darker[Blue], $zColor = Brown},

  figure[P0_, 0., 0., 0.] := {
    Thick, $rColor, Line[{{0, 0, 0}, {P0[[1]], P0[[2]], 0}}], $zColor,
     Line[{{P0[[1]], P0[[2]], 0}, P0}]
    };
  figure[P0_, 0., Δθ_, 0.] := {
    First @ ParametricPlot3D[{r Cos[t], r Sin[t], z}, {t, θ, θ + Δθ}, 
      PlotStyle -> Directive[Thick, $θColor]]
        };
      figure[P0_, 0., 0., Δz_] := {
        First @ ParametricPlot3D[{r Cos[θ], r Sin[θ], s}, {s, z, z + Δz},
          PlotStyle -> Directive[Thick, $zColor]]
        };
      figure[P0_, Δr_, 0., 0.] := {
        First @ ParametricPlot3D[{u Cos[θ], u Sin[θ], z}, {u, r, r + Δr},
          PlotStyle -> Directive[Thick, $rColor]]
        };
      figure[P0_, 0., Δθ_, Δz_] := {
        First @ ParametricPlot3D[{r Cos[t], r Sin[t], s}, {s, z, z + Δz}, {t, θ, θ + Δθ},
          Mesh -> None, PlotStyle -> Directive[Lighter[$rColor]]]
        };
      figure[P0_, Δr_, 0., Δz_] := {
        First @ ParametricPlot3D[{u Cos[θ], u Sin[θ], s}, {s, z, z + Δz}, {u, r, r + Δr}, 
          Mesh -> None, PlotStyle -> Lighter[$θColor]]
        };
      figure[P0_, Δr_, Δθ_, 0.] := {
        First @ ParametricPlot3D[{u Cos[t], u Sin[t], z}, {u, r, r + Δr}, {t, θ, θ + Δθ},
          Mesh -> None, PlotStyle -> Lighter[$zColor]]
        };
      figure[P0_, Δr_, Δθ_, Δz_] := {
        First @ ParametricPlot3D[{r Cos[t], r Sin[t], s}, {s, z, z + Δz}, {t, θ, θ + Δθ},
          Mesh -> None, 
          PlotStyle -> Dynamic@Directive[Lighter[$rColor], Opacity[opacity]]], 
        First @ ParametricPlot3D[{u Cos[θ], u Sin[θ], s}, {s, z, z + Δz}, {u, r, r + Δr}, 
          Mesh -> None, 
          PlotStyle -> 
           Dynamic@Directive[Lighter[$θColor], Opacity[opacity]]], 
        First @ ParametricPlot3D[{u Cos[t], u Sin[t], z}, {u, r, r + Δr}, {t, θ, θ + Δθ},
          Mesh -> None, 
          PlotStyle -> Dynamic@Directive[Lighter[$zColor], Opacity[opacity]]], 
        First@ParametricPlot3D[ {(r + Δr) Cos[t], (r + Δr) Sin[t], s},
          {s, z, z + Δz}, {t, θ, θ + Δθ},
          Mesh -> None, 
          PlotStyle -> Dynamic@Directive[Lighter[$rColor], Opacity[opacity]]], 
        First @ ParametricPlot3D[{u Cos[θ + Δθ], u Sin[θ + Δθ], s},
          {s, z, z + Δz}, {u, r, r + Δr}, 
          Mesh -> None, 
          PlotStyle -> Dynamic@Directive[Lighter[$θColor], Opacity[opacity]]], 
        First @ ParametricPlot3D[{u Cos[t], u Sin[t], z + Δz}, {u, r, r + Δr}, {t, θ, θ + Δθ},
          Mesh -> None, 
          PlotStyle -> Dynamic@Directive[Lighter[$zColor], Opacity[opacity]]]
    };

  Dynamic @ With[{P0 = {r Cos[θ], r Sin[θ], z}},
    Graphics3D[{
      {PointSize[Medium], Point[P0], 
       Line[{{0, 0, 0}, #} & /@ (3 IdentityMatrix[3])], Opacity[0.3], 
       Line[{{0, 0, 0}, #} & /@ (-3 IdentityMatrix[3])]}, {
       {Opacity[0.3], 
        EdgeForm[Directive[Thickness[Medium], Opacity[0.3]]], 
        Polygon[{{0, 0, 0}, {0, 0, P0[[3]]}, 
          P0, {P0[[1]], P0[[2]], 0}}],
        $θColor, 
            EdgeForm[
             Directive[Thickness[Medium], 
              If[Δr == 0 && Δz == 0 && Δθ == 0, Opacity[1], 
               Opacity[0.3]], $θColor]], 
        Polygon[Append[
          Table[0.3 {Cos[t], Sin[t], 0}, {t, Append[Range[0, θ, 0.05], θ]}],
          {0, 0, 0}]]},
       Line[{{P0, {0, 0, P0[[3]]}}, {{P0[[1]], P0[[2]], 0}, {P0[[1]], 0, 0}},
         {{P0[[1]], P0[[2]], 0}, {0, P0[[2]], 0}}}], 
       Point[DiagonalMatrix[P0]]
       },
      figure[P0, Δr, Δθ, Δz]
      },
     SphericalRegion -> True, PlotRange -> 2, Lighting -> "Neutral"
     ]]],
 Row[{Control[{{r, 1}, 0., 2, ImageSize -> Small}], 
   Control[{Δr, 0., 1., ImageSize -> Small}]}, 
  Spacer[1]],
 Row[{Control[{z, 0., π, ImageSize -> Small}], 
   Control[{Δz, 0., π, ImageSize -> Small}]}, 
  Spacer[1]],
 Row[{Control[{θ, 0., 2 π, ImageSize -> Small}], 
   Control[{Δθ, 0., 2 π, 
     ImageSize -> Small}]}, Spacer[1]],
 {{opacity, 1}, 0., 1}, {{figure, figure}, None},
 ControlPlacement -> Left,
 TrackedSymbols :> {}
 ]

Manipulate output

share|improve this answer
add comment

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.