Message Boards Message Boards

A Graphics3D is being rendered differently in Wolfram Player and notebook?

Posted 1 year ago

I am projecting 2d triangles into a 3d space (aligning short side with z axis). both the notebook version and the cdf preview work fine but the player gives a different rendering. enter image description here

This is the module for the transformation:

TRIV[Long_, Short_, Mid_] := 
 Module[{mastu = Long, mast0 = Short, mastb = Mid},
  T = SSSTriangle[mastu, mast0, mastb];
  Tang = PolygonAngle[T][[1]];
  rT = RotationTransform[(Pi/2) - Tang, {0, 0`}];
  Triangle[PolygonCoordinates[rT[T]] /. {x1_, x2_} -> {x1, 0, x2}]]

Then the manipulate environment:

Manipulate[
 fore = TRIV[tr, short, br];
 Graphics3D[{fore,
   Purple, Line[{{0, 0, -1.2}, {0, 0, z}}], 
   Text[Style["z", Italic, 16], {.2, .2, z + .2}],
   }],
 Grid[{{Control@{{tr, 1.695}, InputField, ImageSize -> Small}, 
    Control@{{short, .5}, InputField, 
      ImageSize -> Small}}, {Control@{{br, 1.32}, InputField, 
      ImageSize -> Small}, 
    Control@{{z, 2}, InputField, ImageSize -> Small}},
   {Control@{{y, 1.5}, InputField, ImageSize -> Small},
    Control@{{x, 2}, InputField, ImageSize -> Small}}}],
 SaveDefinitions -> True, Initialization :> TRIV[1.695, .5, 1.32]]

I can't work out what I'm getting wrong?

POSTED BY: Andrew W
3 Replies
Posted 1 year ago

Found where the change was done. PolygonAngle, with a single argument, returns angles in a different order after v12.0. The fix is easy. Specify origin as a second argument, instead of extracting the first angle:

TRIV[Long_, Short_, Mid_] := Module[
  {mastu = Long, mast0 = Short, mastb = Mid},
  T = SSSTriangle[mastu, mast0, mastb];
  Tang = PolygonAngle[T, {0, 0}];
  rT = RotationTransform[\[Pi]/2 - Tang, {0, 0}];
  Triangle[PolygonCoordinates[rT[T]] /. {x1_, x2_} -> {x1, 0, x2}]
]
POSTED BY: Hans Milton
Posted 1 year ago

Hans, thanks for responding. I downloaded the 12.0 player but the notebook won't run at all in that. The output is simply frozen, graphic cant's be rotated nor values entered? I am running v.12.0 Mathematica but it is on an M1 pro Mac, maybe that is the problem? Does this mean that older cdf's are likely to fail as a general rule?

POSTED BY: Andrew W
Posted 1 year ago

Andrew, it seems your code is affected by some change that occurred between versions 12.0 and 12.1.

I guess that you are using Mathematica 12.0 but a Wolfram Player that is 12.1 or higher.
WP 12.0 is still available for download. Try that, it gives the expected triangle orientation.

POSTED BY: Hans Milton
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