Message Boards Message Boards

[Solved] Combine dynamic scaling and rotation transforms

Posted 1 year ago

Hello

In the Manipulate code below I want for the inner tetrahedron to change its scale and its orientation.

OK for the first transform but not for the second one.

I put in comments the path I tried in order to modify the orientation but it is a dead-end, MMA gets stuck and difficult to abort.

I feel that the solution must lie in combining the two transformation function matrices but how to do it eludes me. Thanks

ClearAll["Global`*"]
Manipulate[tet = PolyhedronData["Tetrahedron", "GraphicsComplex"];
 sc = ScalingTransform[    
     (* Upper and Lower limits of scale reduction *)
   RootReduce[  
     coeff  PolyhedronData["Tetrahedron", "Inradius"] /  
       PolyhedronData["Tetrahedron", "Circumradius"]] {1, 1, 1}];

    gr = Graphics3D[{Green, 
    MapAt[sc, tet, 
     1]}]; (* \
gr1=Graphics3D[GeometricTransformation[{Opacity[0.4,Yellow], gr ??? \
},RotationTransform[teta,{x,y,z}]]]; *)
 Show[{Graphics3D[{Opacity[0.4, Yellow], tet}, Boxed -> False]}, 
  gr (*, gr1 ? *)], {{coeff, 1}, 1, 3, 0.1}, 
 Row[{Control[{x, {0, 1}, ControlType -> Checkbox}], Spacer[20], 
   Control[ {y, {1, 0}, ControlType -> Checkbox}], Spacer[20], 
   Control[{z, {0, 1}, ControlType -> Checkbox}]}], {{teta, 0}, 0, 
  Pi}]
POSTED BY: Jan Potocki
3 Replies
Posted 1 year ago

Yes indeed ! You had a sharper eye than mine for spotting the small mistake that blocked my code..A great thanks!

POSTED BY: Jan Potocki
ClearAll["Global`*"]
Manipulate[
tet = PolyhedronData["Tetrahedron", "GraphicsComplex"];
 sc = ScalingTransform[    
     (* Upper and Lower limits of scale reduction *)
   RootReduce[  
     coeff  PolyhedronData["Tetrahedron", "Inradius"] /  
       PolyhedronData["Tetrahedron", "Circumradius"]] {1, 1, 1}];
gr = Graphics3D[{Green, 
MapAt[sc, tet, 
 1]}];     

  (*Added [[1]] first element*) 

gr1=Graphics3D[GeometricTransformation[{Opacity[0.4,Yellow], gr[[1]] },RotationTransform[teta,{x,y,z}]]]; 
 Show[{Graphics3D[{Opacity[0.4, Yellow], tet}, Boxed -> False]}, 
  gr ,gr1], {{coeff, 1}, 1, 3, 0.1}, 
 Row[{Control[{x, {0, 1}, ControlType -> Checkbox}], Spacer[20], 
   Control[ {y, {1, 0}, ControlType -> Checkbox}], Spacer[20], 
   Control[{z, {0, 1}, ControlType -> Checkbox}]}], {{teta, 0}, 0, 
  Pi}
]
POSTED BY: Jalesh Dikshit

(* Scaling works for me removed comment and retyped*) https://www.wolframcloud.com/download/humanbirthtillendofearth/Published/test1.nb

POSTED BY: Jalesh Dikshit
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract