2
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 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]}] $\endgroup$ Commented Jan 21, 2014 at 13:42
  • $\begingroup$ Can you show me the whole code please? I dont know where I should implementate your code... $\endgroup$
    – Manu
    Commented Jan 21, 2014 at 18:11

1 Answer 1

3
$\begingroup$

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!

$\endgroup$
1
  • $\begingroup$ Ok, thank you :-) Now I have to convince my projectteam to place the matrix under the controls and not over the graphic ;-) $\endgroup$
    – Manu
    Commented Jan 21, 2014 at 23:54

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.