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 want to know how I can place a matrix under my sliders. Here is my code:

Manipulate[
  Column[{
    Style[{{a, 0, 0}, {0, b, 0}, {0, 0, c}} // MatrixForm, 
      FontSize -> 18, FontColor -> Black, TextAlignment -> Left],
    Graphics3D[{GraphicsComplex[streckung[a, b, c], Polygon[i]]}, 
      Axes -> True, Boxed -> True, 
      PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}, 
      ImageSize -> {{400, 400}}]}, Dividers -> {False, 2 -> Gray}],
  {{a, 1, "x-Richtung"}, -3, 3},
  {{b, 1, "y-Richtung"}, -3, 3},
  {{c, 1, "z-Richtung"}, -3, 3},
  ControlPlacement -> Left,
  Initialization :> (
    k := PolyhedronData["Cube", "VertexCoordinates"];
    Short[i = PolyhedronData["Cube", "FaceIndices"]];
    streckung[a_, b_, c_] := k.{{a, 0, 0}, {0, b, 0}, {0, 0, c}};
  ;)]

And here is a photo how it should look like:

enter image description here

share|improve this question
    
not sure if I understand: if you use the following in place of your controls, is that what you want? Column[{Control@{{a, 1, "x-Richtung"}, -3, 3}, Control@{{b, 1, "y-Richtung"}, -3, 3}, Control@{{c, 1, "z-Richtung"}, -3, 3}, Dynamic@Style[{{a, 0, 0}, {0, b, 0}, {0, 0, c}} // MatrixForm, FontSize -> 18, FontColor -> Black, TextAlignment -> Left]}] –  Pinguin Dirk Jan 21 at 13:42
    
Can you show me the whole code please? I dont know where I should implementate your code... –  Manu Jan 21 at 18:11
add comment

1 Answer

As hinted in the comment, you might try it this way:

Manipulate[
  Column[{Style[{{a, 0, 0}, {0, b, 0}, {0, 0, c}} // MatrixForm, 
  FontSize -> 18, FontColor -> Black, TextAlignment -> Left], 
  Graphics3D[{GraphicsComplex[streckung[a, b, c], Polygon[i]]}, 
  Axes -> True, Boxed -> True, 
  PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}, 
  ImageSize -> {{400, 400}}]}, Dividers -> {False, 2 -> Gray}], 
  Column[{
     Control@{{a, 1, "x-Richtung"}, -3, 3}, 
     Control@{{b, 1, "y-Richtung"}, -3, 3}, 
     Control@{{c, 1, "z-Richtung"}, -3, 3}, 
     Dynamic@Style[{{a, 0, 0}, {0, b, 0}, {0, 0, c}} // MatrixForm, 
         FontSize -> 18, FontColor -> Black, TextAlignment -> Left]}], 
  ControlPlacement -> Left, 
  Initialization :> (k := PolyhedronData["Cube", "VertexCoordinates"];
  Short[i = PolyhedronData["Cube", "FaceIndices"]];
  streckung[a_, b_, c_] := k.{{a, 0, 0}, {0, b, 0}, {0, 0, c}};)]

and you get:

enter image description here

Viel Erfolg!

share|improve this answer
    
Ok, thank you :-) Now I have to convince my projectteam to place the matrix under the controls and not over the graphic ;-) –  Manu Jan 21 at 23:54
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.