(*by Nasser M. Abbasi. Vesion: Nov 10, 2013 *) Manipulate[ Module[{z}, z = \[Theta]*Pi/180; If[plotType == "stress section" || plotType == "Mohr circle/stress section" || plotType == "Mohr circle", If[angleSelection == "specific plane", z = getAngleAtSpecificPlane[ specificPlaneAngle, \[Sigma]x, \[Sigma]y, \[Tau]xy]; \[Theta] = z*180./Pi ] ]; Text@makeDiagrams[N@\[Sigma]x, N@\[Sigma]y, N@\[Tau]xy, z, annotate, onPositiveSideOnly, plotType, limit, gridLines] ], Grid[{ { Grid[{ {Style[Row[{"stresses at 0", Degree}], 12], SpanFromLeft}, {"\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)", Control[{{\[Sigma]x, 14, ""}, -20, 20, 0.1, ImageSize -> Tiny}], Style[Dynamic@padIt1[\[Sigma]x, {3, 1}], 11], Spacer[13]}, {"\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", Control[{{\[Sigma]y, 4, ""}, -20, 20, 0.1, ImageSize -> Tiny}], Style[Dynamic@padIt1[\[Sigma]y, {3, 1}], 11]}, {"\!\(\*SubscriptBox[\(\[Tau]\), \(xy\)]\)", Control[{{\[Tau]xy, 10, ""}, -20, 20, 0.1, ImageSize -> Tiny}], Style[Dynamic@padIt1[\[Tau]xy, {3, 1}], 11]}, {Style[Dynamic@Row[{matrix, " = ", TraditionalForm[{ {padIt1[N[\[Sigma]x], {3, 1}], padIt1[N[\[Tau]xy], {3, 1}]}, {padIt1[N[\[Tau]xy], {3, 1}], padIt1[N[\[Sigma]y], {3, 1}]} }] }], 11], SpanFromLeft} }, Spacings -> {.5, .5}, Alignment -> Center, Frame -> True, FrameStyle -> Directive[Thickness[.005], Gray]] }, { Grid[{ {Style["select plot type", 12], SpanFromLeft}, { PopupMenu[Dynamic[plotType], { "stress section" -> Style["stress section", 11], "Mohr circle" -> Style[ "Mohr circle", 11], "Mohr circle/stress section" -> Style[ "Mohr circle/stress section", 11], "normal stress trajectory" -> Style[ "normal stress trajectory", 11], "shear stress trajectory" -> Style["shear stress trajectory", 11], "normal/shear trajectory" -> Style["normal/shear trajectory", 11] }, ImageSize -> All, ContinuousAction -> False], SpanFromLeft }, {Row[{Style["annotate", 12], Spacer[1], Checkbox[Dynamic[annotate], Enabled -> Dynamic[ plotType == "stress section" || plotType == "Mohr circle/stress section"]]}], Row[{Style[ Column[{"display stresses on", "positive sides only"}, Alignment -> Left], 11], Spacer[1], Checkbox[Dynamic[onPositiveSideOnly], Enabled -> Dynamic[ plotType == "stress section" || plotType == "Mohr circle/stress section"]]}], SpanFromLeft } }, Spacings -> {.2, .5}, Alignment -> Center, Frame -> True, FrameStyle -> Directive[Thickness[.005], Gray]], SpanFromLeft }, { Grid[{ {Grid[{ {Row[{Style["rotate to new angle" , 12]}], SpanFromLeft}, {RadioButtonBar[ Dynamic[angleSelection], {"slider" -> "", "specific plane" -> ""}, Appearance -> "Vertical", Enabled -> Dynamic[ plotType == "stress section" || plotType == "Mohr circle/stress section" || plotType == "Mohr circle"]], Grid[{ {Row[{Control[{{\[Theta], 45, ""}, -90, 90, 1, ImageSize -> Tiny, Enabled -> Dynamic[(plotType == "stress section" || plotType == "Mohr circle/stress section" || plotType == "Mohr circle") && angleSelection == "slider"]}], Spacer[4], Style[Row[{Dynamic@padIt2s[\[Theta], 3], Degree}], 11]}]}, {Row[{ PopupMenu[ Dynamic[ specificPlaneAngle , {specificPlaneAngle = #; \ \[Theta] = getAngleAtSpecificPlane[ specificPlaneAngle, \[Sigma]x, \[Sigma]y, \ \[Tau]xy]} &], { "first principal plane" -> Style["first principal plane", 11], "second principal plane" -> Style["second principal plane", 11], "first maximum shear plane" -> Style[ "first shear plane", 11], "second maximum shear plane" -> Style[ "second shear plane", 11] }, ImageSize -> All, Enabled -> Dynamic[(plotType == "stress section" || plotType == "Mohr circle/stress section") && angleSelection == "specific plane"] ] }] } } ] } }, Spacings -> {.5, .5}, Alignment -> Center, Frame -> None] , Spacer[7] } , {Style[Dynamic@Row[{matrix2, " = ", TraditionalForm[{ {padIt1[ N[1/2 (\[Sigma]x + \[Sigma]y) + 1/2 (\[Sigma]x - \[Sigma]y) Cos[ 2 (\[Theta] *Pi/180)] + \[Tau]xy Sin[ 2 (\[Theta] *Pi/180)]], {3, 1}], padIt1[N[-(1/2) (\[Sigma]x - \[Sigma]y) Sin[ 2 (\[Theta] *Pi/180)] + \[Tau]xy Cos[ 2 (\[Theta] *Pi/180)]], {3, 1}] }, {padIt1[ N[-(1/2) (\[Sigma]x - \[Sigma]y) Sin[ 2 (\[Theta] *Pi/180)] + \[Tau]xy Cos[ 2 (\[Theta] *Pi/180)]], {3, 1}], padIt1[N[ 1/2 (\[Sigma]x + \[Sigma]y) - 1/2 (\[Sigma]x - \[Sigma]y) Cos[ 2 (\[Theta] *Pi/180)] - \[Tau]xy Sin[ 2 (\[Theta] *Pi/180)]], {3, 1}] } } ]}], 11] }}, Spacings -> {.5, .5}, Alignment -> Center, Frame -> True, FrameStyle -> Directive[Thickness[.005], Gray]] }, { Grid[{ {Grid[{ {Style["zoom", 12], Spacer[13], Control[{{limit, 30, ""}, 5, 50, 0.1, ImageSize -> Small}], Spacer[12]}, {"", Style[Row[{"in", Spacer[75], "out"}], 11], SpanFromLeft} }, Spacings -> {.1, .1}, Alignment -> Center, Frame -> True, FrameStyle -> Directive[Thickness[.005], Gray]] }, {Grid[{ {Style["gridlines", 12], Control[{{gridLines, 0.5, ""}, 0, 1, 0.1, ImageSize -> Small}] Spacer[8]}, {"", Style[Row[{"less", Spacer[70], "more"}], 11]} }, Spacings -> {.1, .1}, Alignment -> Center, Frame -> True, FrameStyle -> Directive[Thickness[.005], Gray]] } }, Spacings -> {.1, .5}, Alignment -> Left, Frame -> None ], SpanFromLeft } }, Spacings -> {.2, .5}, Alignment -> Left], {{annotate, True}, None}, {{plotType, "Mohr circle"}, None}, {{matrix, TraditionalForm[{{Subscript[\[Sigma], x], Subscript[\[Tau], x\[InvisibleComma]y]}, {Subscript[\[Tau], x\[InvisibleComma]y], Subscript[\[Sigma], y]}}]}, None}, {{matrix2, TraditionalForm[{{Subscript[(\[Sigma]'), x], Subscript[\[Tau]', x\[InvisibleComma]y]}, {Subscript[\[Tau]', x\[InvisibleComma]y], Subscript[(\[Sigma]'), y]}}]}, None}, {{onPositiveSideOnly, True}, None}, {{principalPlaneAngle, False}, None}, {{maxShearPlane, False}, None}, {{specificPlaneAngle, "first principal plane"}, None}, {{angleSelection, "slider"}, None}, ControlPlacement -> Left, SynchronousUpdating -> False, SynchronousInitialization -> False, ContinuousAction -> True, Alignment -> Center, ImageMargins -> 0, FrameMargins -> 0, Paneled -> True, Frame -> False, AutorunSequencing -> {1}, Initialization :> { (*--- constant parameters size and width of display ---*) contentSizeW = 425; contentSizeH = 425; (*--------------------------------------------*) (* helper function for formatting *) (*--------------------------------------------*) padIt2[v_?numeric, f_List] := AccountingForm[Chop[v] , f, NumberSigns -> {"", ""}, NumberPadding -> {"0", "0"}, SignPadding -> True]; padIt2[v_?numeric, f_Integer] := AccountingForm[Chop[v] , f, NumberSigns -> {"", ""}, NumberPadding -> {"0", "0"}, SignPadding -> True]; padIt2s[v_?numeric, f_Integer] := AccountingForm[Chop[v] , f, NumberSigns -> {"-", "+"}, NumberPadding -> {"0", "0"}, SignPadding -> True]; padIt1[v_?numeric, f_List] := AccountingForm[Chop[v] , f, NumberSigns -> {"-", "+"}, NumberPadding -> {"0", "0"}, SignPadding -> True]; (*definitions used for parameter checking*) integerStrictPositive = (IntegerQ[#] && # > 0 &); integerPositive = (IntegerQ[#] && # >= 0 &); numericStrictPositive = (Element[#, Reals] && # > 0 &); numericPositive = (Element[#, Reals] && # >= 0 &); numericStrictNegative = (Element[#, Reals] && # < 0 &); numericNegative = (Element[#, Reals] && # <= 0 &); bool = (Element[#, Booleans] &); numeric = (Element[#, Reals] &); integer = (Element[#, Integers] &); (*-------------------------------------------------------------*) makeDiagrams[\[Sigma]x_?numeric, \[Sigma]y_?numeric, \[Tau]xy_? numeric, \[Theta]_?numeric, annotate_?bool, onPositiveSideOnly_?bool, plotType_String, limit_?numericStrictPositive, gridLines_?numericPositive] := Module[{}, Which[ plotType == "stress section", make2DStressDiagram[\[Sigma]x, \[Sigma]y, \[Tau]xy, \[Theta], annotate, onPositiveSideOnly, limit, gridLines, {contentSizeW, contentSizeH}], plotType == "Mohr circle", makeMohrCircle[\[Theta], \[Sigma]x, \[Sigma]y, \[Tau]xy, limit, gridLines, {contentSizeW, contentSizeH}, makeMohrCircleTitle[\[Sigma]x, \[Sigma]y, \[Tau]xy]], plotType == "Mohr circle/stress section", Grid[{ {makeMohrCircleTitle[\[Sigma]x, \[Sigma]y, \[Tau]xy], SpanFromLeft}, {make2DStressDiagram[\[Sigma]x, \[Sigma]y, \[Tau]xy, \[Theta], annotate, onPositiveSideOnly, limit, gridLines, {0.5 contentSizeW, 0.87 contentSizeH}], makeMohrCircle[\[Theta], \[Sigma]x, \[Sigma]y, \[Tau]xy, limit, gridLines, {0.499 contentSizeW, .87 contentSizeH}, {}] } }, Spacings -> {0, 0} ], plotType == "normal stress trajectory", makeNormalStressPolarPlot[\[Sigma]x, \[Sigma]y, \[Tau]xy, limit, gridLines], plotType == "shear stress trajectory", makeShearStressPolarPlot[\[Sigma]x, \[Sigma]y, \[Tau]xy, limit, gridLines], plotType == "normal/shear trajectory", makeShearAndNormalStressPolarPlot[\[Sigma]x, \[Sigma]y, \ \[Tau]xy, limit, gridLines] ] ]; (*-------------------------------------------------------------*) getAngleAtSpecificPlane[ specificPlaneAngle_, \[Sigma]x_, \[Sigma]y_, \[Tau]xy_] := N@Which[specificPlaneAngle == "first principal plane", principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy][[1, 2]], specificPlaneAngle == "second principal plane", principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy][[2, 2]], specificPlaneAngle == "first maximum shear plane", principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy][[1, 2]] + Pi/4, specificPlaneAngle == "second maximum shear plane", principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy][[1, 2]] + 3/4 Pi ]; (*-------------------------------------------------------------*) (*finds the 2 Principal stresses in plane stress 2D setting*) principalStresses[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric] := Module[{\[Theta]p, \[Sigma], \[Sigma]1, \[Sigma]2, \[Sigma]1max, r, c, tmp, \[Theta]1, \[Theta]2}, r = Sqrt[((\[Sigma]x - \[Sigma]y)/2)^2 + \[Tau]xy^2]; c = (\[Sigma]x + \[Sigma]y)/2; {\[Sigma]1, \[Sigma]2} = {c + r, c - r}; (*\[Sigma]1 is the largest stress regadless of sign*) If[Abs[\[Sigma]2] > Abs[\[Sigma]1], tmp = \[Sigma]1; \[Sigma]1 = \[Sigma]2; \[Sigma]2 = tmp ]; If[Abs[\[Sigma]x - \[Sigma]y] <= $MachineEpsilon, \[Theta]p = Pi/4, \[Theta]p = ArcTan[(2 Abs[\[Tau]xy])/Abs[\[Sigma]x - \[Sigma]y]]/2]; If[\[Sigma]1 > \[Sigma]2, If[\[Tau]xy > 0,(*below*) If[\[Sigma]x > c, {\[Theta]1, \[Theta]2} = {\[Theta]p, -(Pi/ 2 - \[Theta]p)}, {\[Theta]1, \[Theta]2} = {Pi/ 2 - \[Theta]p, -\[Theta]p}] , If[\[Sigma]x > c, {\[Theta]1, \[Theta]2} = {-\[Theta]p, (Pi/ 2 - \[Theta]p)}, {\[Theta]1, \[Theta]2} = {-(Pi/ 2 - \[Theta]p), \[Theta]p}] ] , If[\[Tau]xy > 0, If[\[Sigma]x > c, {\[Theta]1, \[Theta]2} = {-(Pi/ 2 - \[Theta]p), \[Theta]p}, {\[Theta]1, \[Theta]2} = {-\ \[Theta]p, Pi/2 - \[Theta]p}] , If[\[Sigma]x > c, {\[Theta]1, \[Theta]2} = {(Pi/ 2 - \[Theta]p), -\[Theta]p}, {\[Theta]1, \[Theta]2} = {\ \[Theta]p, -(Pi/2 - \[Theta]p)}] ] ]; {{\[Sigma]1, \[Theta]1}, {\[Sigma]2, \[Theta]2}} ]; (*-------------------------------------------------------------*) (*finds the maximum and minumum shear stresses in plane stress 2D \ setting*) maxAndMinShearStress[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric] := Module[{r}, r = Sqrt[((\[Sigma]x - \[Sigma]y)/2)^2 + \[Tau]xy^2]; {r, -r} ]; (*-------------------------------------------------------------*) (*find normal and shear stress for plane at angle theta from \ normal. plain stress*) (*use standard stress angle transformation for 2D*) rotationStress[\[Sigma]x_, \[Sigma]y_, \[Tau]xy_, \[Theta]_] := Module[{\[Sigma]xx, \[Sigma]yy, \[Tau]}, \[Sigma]xx = 1/2 (\[Sigma]x + \[Sigma]y) + 1/2 (\[Sigma]x - \[Sigma]y) Cos[2 \[Theta]] + \[Tau]xy Sin[ 2 \[Theta]]; \[Tau] = -(1/2) (\[Sigma]x - \[Sigma]y) Sin[ 2 \[Theta]] + \[Tau]xy Cos[2 \[Theta]]; \[Sigma]yy = 1/2 (\[Sigma]x + \[Sigma]y) - 1/2 (\[Sigma]x - \[Sigma]y) Cos[2 \[Theta]] - \[Tau]xy Sin[ 2 \[Theta]]; {\[Sigma]xx, \[Sigma]yy, \[Tau]} ]; (*-------------------------------------------------------------*) plot[data_List, limit_?numericStrictPositive, gridLines_?numericPositive, color_] := ListPolarPlot[data, Joined -> True, AxesOrigin -> {0, 0}, ImageSize -> {contentSizeW, contentSizeH}, ImagePadding -> {{20, 10}, {20, 5}}, ImageMargins -> 0, AspectRatio -> 1, Frame -> True, If[gridLines == 0, GridLines -> None, {GridLines -> {Range[-limit, limit, (2*limit)/(gridLines*20)], Range[-limit, limit, (2*limit)/(gridLines*20)]}, GridLinesStyle -> Directive[Thickness[.001], LightGray] }], PlotRange -> {{-limit, limit}, {-limit, limit}}, PlotStyle -> color ]; (*-------------------------------------------------------------*) makeArrowForAngle[r_, center_, {{\[Sigma]1_, \[Theta]1_}, {\[Sigma]2_, \[Theta]2_}}, \ \[Tau]xy_?numeric] := Module[{phi, tbl, align}, If[\[Sigma]1 > \[Sigma]2, If[\[Tau]xy > 0, tbl = Table[{center[[1]] + r/3*Cos[phi], r/3*Sin[phi]}, {phi, -2*\[Theta]1, 0, Pi/100}]; align = {-1, 1} , tbl = Table[{center[[1]] + r/3*Cos[phi], r/3*Sin[phi]}, {phi, -2*\[Theta]1, 0, -Pi/100}]; align = {-1, -1} ] , If[\[Tau]xy > 0, tbl = Table[{center[[1]] + r/3*Cos[phi], r/3*Sin[phi]}, {phi, -(Pi + 2*\[Theta]1), -Pi, -Pi/100}]; align = {1, 1} , tbl = Table[{center[[1]] + r/3*Cos[phi], r/3*Sin[phi]}, {phi, (Pi - 2*\[Theta]1), Pi, Pi/100}]; align = {1, -1} ] ]; {Text["2\!\(\*SubscriptBox[\(\[Theta]\), \(1\)]\)", If[Length[tbl] > 1, tbl[[ Round[ Length[tbl]/2 ] ]], First@tbl] , align ], tbl} ]; (*-------------------------------------------------------------*) makeMohrCircleTitle[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric] := Module[{\[Sigma]1, \[Sigma]2, \[Theta]1, \[Theta]2, r, center, ptA}, {{\[Sigma]1, \[Theta]1}, {\[Sigma]2, \[Theta]2}} = principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy]; center = {(\[Sigma]1 + \[Sigma]2)/2, 0}; ptA = {\[Sigma]x, -\[Tau]xy}; r = EuclideanDistance[center, ptA]; Grid[{ TraditionalForm[ Style[#]] & /@ {"\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \(x\[InvisibleComma]y\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(2\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(2\)]\)"}, {padIt1[\[Sigma]x, {4, 1}], padIt1[\[Sigma]y, {4, 1}], padIt1[\[Tau]xy, {4, 1}], padIt1[\[Sigma]1, {4, 1}], padIt1[\[Sigma]2, {4, 1}], \[PlusMinus]padIt2[r, {4, 1}], Row[{padIt1[\[Theta]1*180/Pi, {4, 1}], Degree}], Row[{padIt1[\[Theta]2*180/Pi, {4, 1}], Degree}] } }, Spacings -> {.5, 1}, Frame -> All, FrameStyle -> Directive[Thin]] ]; (*-------------------------------------------------------------*) getRadiusOfCircle[\[Theta]_?numeric, \[Sigma]x_? numeric, \[Sigma]y_?numeric, \[Tau]xy_?numeric] := Sqrt[((\[Sigma]x - \[Sigma]y)/2)^2 + \[Tau]xy^2]; (*-------------------------------------------------------------*) getCurrentStressOnInclinded[\[Theta]_?numeric, \[Sigma]x_? numeric, \[Sigma]y_?numeric, \[Tau]xy_?numeric] := Module[{\[Sigma]x1, \[Tau]xy1, \[Sigma]y1}, \[Sigma]x1 = (\[Sigma]x + \[Sigma]y)/ 2 + ((\[Sigma]x - \[Sigma]y)/ 2 Cos[2 \[Theta]] + \[Tau]xy Sin[2 \[Theta]]); \[Tau]xy1 = (-((\[Sigma]x - \[Sigma]y)/2) Sin[ 2 \[Theta]] + \[Tau]xy Cos[2 \[Theta]]); \[Sigma]y1 = (\[Sigma]x + \[Sigma]y)/ 2 - ((\[Sigma]x - \[Sigma]y)/ 2 Cos[2 \[Theta]] + \[Tau]xy Sin[2 \[Theta]]); {\[Sigma]x1, \[Sigma]y1, \[Tau]xy1} ]; (*-------------------------------------------------------------*) makeMohrCircle[\[Theta]_?numeric, \[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric, limit_?numericStrictPositive, gridLines_?numericPositive, {contentSizeW_?numericStrictPositive, contentSizeH_?numericStrictPositive}, plotTitle_] := Module[{ptA, ptB, center, \[Sigma]1, \[Sigma]2, \[Theta]1, \[Theta]2, r, z, lst, txt, ptD1, ptD2, \[Sigma]x1, \[Tau]xy1, \[Sigma]y1}, {{\[Sigma]1, \[Theta]1}, {\[Sigma]2, \[Theta]2}} = principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy]; center = {(\[Sigma]1 + \[Sigma]2)/2, 0}; ptA = {\[Sigma]x, -\[Tau]xy}; r = getRadiusOfCircle[\[Theta], \[Sigma]x, \[Sigma]y, \[Tau]xy]; {\[Sigma]x1, \[Sigma]y1, \[Tau]xy1} = getCurrentStressOnInclinded[\[Theta], \[Sigma]x, \[Sigma]y, \ \[Tau]xy]; (*Print["in makeMohrCircle, \[Theta]=",\[Theta], " \[Sigma]x=",\[Sigma]x," \[Sigma]y=",\[Sigma]y," r=",r, " cosBeta=",cosBeta, " sinBeta=",sinBeta," currentStress=", currentStress," currentShear=",currentShear];*) z = \[Sigma]x - First@center; ptB = {ptA[[1]] - 2 z, -ptA[[2]]}; ptD1 = {\[Sigma]x1, -\[Tau]xy1}; ptD2 = {\[Sigma]y1, \[Tau]xy1}; Graphics[{ Circle[center, r], (*{Text[TraditionalForm[Style["(Subscript[\[Sigma], x],-Subscript[\[Tau], x\[InvisibleComma]y])",12]],ptA, If[\[Sigma]x>center[[1]],{-1,1},{1,1}]]},*) {Black, PointSize[.02], Point[ptA]}, {Black, PointSize[.02], Point[center]}, (*{Text[TraditionalForm[Style["(Subscript[\[Sigma], y],Subscript[\[Tau], x\[InvisibleComma]y])",12]],ptB, If[\[Sigma]y>center[[1]],{-1,-1},{1,-1}]]},*) {Black, PointSize[.02], Point[ptB]}, {Dashed, Line[{ptA, ptB}]}, Circle[ptD1, .8], {Red, Dashed, Line[{ptD1, ptD2}]}, Circle[ptD2, .8], Text[ Row[{"(", padIt1[\[Sigma]x1, {4, 1}], ",", padIt1[\[Tau]xy1, {4, 1}], ")"}], ptD1, If[\[Sigma]x1 > center[[1]], {-1, -1}, {1, -1}]], Text[ Row[{"(", padIt1[\[Sigma]y1, {4, 1}], ",", padIt1[\[Tau]xy1, {4, 1}], ")"}], ptD2, If[\[Sigma]y1 > center[[1]], {-1, -1}, {1, -1}]], {Red, PointSize[.02], Point[{\[Sigma]1, 0}]}, {Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(1\)]\)", 12]], {\[Sigma]1, 0}, {-1.5, 1.5}]}, {Red, PointSize[.02], Point[{\[Sigma]2, 0}]}, {Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(2\)]\)", 12]], {\[Sigma]2, 0}, {1.2, 1.3}]}, {Blue, PointSize[.02], Point[{center[[1]], r}]}, {Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)", 12]], {center[[1]], r}, {0, -1.5}]}, {Blue, PointSize[.02], Point[{center[[1]], -r}]}, {Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)", 12]], {center[[1]], -r}, {0, 1.5}]}, {Text[Style["tension", 11], {limit, 0}, {1, 3}]}, {Text[Style["compression", 11], {-limit, 0}, {-1, 3}]} }, If[gridLines == 0, GridLines -> None, {GridLines -> {Range[-limit, limit, (2*limit)/(gridLines*20)], Range[-limit, limit, (2*limit)/(gridLines*20)]}, GridLinesStyle -> Directive[Thickness[.001], LightGray] }], PlotRange -> {{-limit, limit}, {-limit, limit}}, Axes -> True, AxesOrigin -> {0, 0}, TicksStyle -> 8, PlotLabel -> If[plotTitle === {}, "", plotTitle], ImageSize -> {contentSizeW, contentSizeH}, ImagePadding -> {{20, 10}, {20, 5}} ] ]; (*-------------------------------------------------------------*) makeShearAndNormalStressPolarPlot[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric, limit_?numericStrictPositive, gridLines_?numericPositive] := Module[{pts, \[Theta], \[Sigma]1, \[Sigma]2, \[Sigma]1Abs, \ \[Sigma]2Abs, \[Theta]p1, \[Theta]p2, p1, p2, p3, p4, plotTitle, coord1, coord2, \[Tau]1, \[Tau]2}, pts = Table[{rotationStress[\[Sigma]x, \[Sigma]y, \[Tau]xy, \ \[Theta]], \[Theta]}, {\[Theta], 0, 2 Pi, Pi/40}]; {{\[Sigma]1, \[Theta]p1}, {\[Sigma]2, \[Theta]p2}} = principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy]; p1 = plot[Transpose[{pts[[All, 2]], pts[[All, 1, 1]]}], limit, gridLines, Red]; coord1 = {Abs[\[Sigma]1] Cos[\[Theta]p1], Abs[\[Sigma]1] Sin[\[Theta]p1]}; coord2 = {Abs[\[Sigma]2] Cos[\[Theta]p2], Abs[\[Sigma]2] Sin[\[Theta]p2]}; p2 = Graphics[{ {PointSize[0.015], Point[{\[Sigma]x, 0}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)", 12]], {\[Sigma]x, 0}, {0, 1.2}], {PointSize[0.015], Point[{0, \[Sigma]y}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", 12]], {0, \[Sigma]y}, {1.2, 0}], {PointSize[0.015], Point[coord1]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(1\)]\)", 12]], coord1, {-1.4, 0}], {PointSize[0.015], Point[coord2]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(2\)]\)", 12]], coord2, {-1.4, 0}], {Dashed, Thin, Line[{coord1, {-coord1[[1]], -coord1[[2]]}}]}, {Dashed, Thin, Line[{coord2, {-coord2[[1]], -coord2[[2]]}}]} } ]; {\[Tau]1, \[Tau]2} = maxAndMinShearStress[\[Sigma]x, \[Sigma]y, \[Tau]xy]; p3 = plot[Transpose[{pts[[All, 2]], pts[[All, 1, 3]]}], limit, gridLines, Blue]; coord1 = {Abs[\[Tau]1] Cos[\[Theta]p1 + Pi/4], Abs[\[Tau]1] Sin[\[Theta]p1 + Pi/4]}; coord2 = {Abs[\[Tau]1] Cos[\[Theta]p2 + Pi/4], Abs[\[Tau]1] Sin[\[Theta]p2 + Pi/4]}; p4 = Graphics[{ {PointSize[0.015], Point[{\[Tau]xy, 0}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(x\[InvisibleComma]y\ \)]\)", 12]], {\[Tau]xy, 0}, {0, 1.2}], {PointSize[0.015], Point[{0, \[Tau]xy}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(y\[InvisibleComma]x\ \)]\)", 12]], {0, \[Tau]xy}, {1.2, 0}], {PointSize[0.015], Point[coord1]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)", 12]], coord1, {-1.4, 0}], {Dashed, Thin, Line[{coord1, {-coord1[[1]], -coord1[[2]]}}]}, {Dashed, Thin, Line[{coord2, {-coord2[[1]], -coord2[[2]]}}]} } ]; plotTitle = Style[Grid[{ {"normal (red) and shear (blue) polar (stress vs. angle) \ trajectory", SpanFromLeft}, TraditionalForm[ Style[#]] & /@ {"\!\(\*SubscriptBox[\(\[Sigma]\), \ \(x\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \ \(x\[InvisibleComma]y\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(2\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(2\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)"}, {padIt1[\[Sigma]x, {4, 1}], padIt1[\[Sigma]y, {4, 1}], padIt1[\[Tau]xy, {4, 1}], padIt1[\[Sigma]1, {4, 1}], Row[{padIt1[\[Theta]p1*180/Pi, {4, 1}], Degree}], padIt1[\[Sigma]2, {4, 1}], Row[{padIt1[\[Theta]p2*180/Pi, {4, 1}], Degree}], \[PlusMinus]padIt2[\[Tau]1, {4, 1}] } }, Spacings -> {0.4, 1.1}, Frame -> All, FrameStyle -> Directive[Thin]], 12]; Show[p1, p2, p3, p4, PlotLabel -> plotTitle] ]; (*-------------------------------------------------------------*) makeNormalStressPolarPlot[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric, limit_?numericStrictPositive, gridLines_?numericPositive] := Module[{pts, \[Theta], \[Sigma]1, \[Sigma]2, \[Sigma]1Abs, \ \[Sigma]2Abs, \[Theta]p1, \[Theta]p2, p1, p2, plotTitle, coord1, coord2}, pts = Table[{rotationStress[\[Sigma]x, \[Sigma]y, \[Tau]xy, \ \[Theta]], \[Theta]}, {\[Theta], 0, 2 Pi, Pi/40}]; {{\[Sigma]1, \[Theta]p1}, {\[Sigma]2, \[Theta]p2}} = principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy]; p1 = plot[Transpose[{pts[[All, 2]], pts[[All, 1, 1]]}], limit, gridLines, Red]; coord1 = {Abs[\[Sigma]1] Cos[\[Theta]p1], Abs[\[Sigma]1] Sin[\[Theta]p1]}; coord2 = {Abs[\[Sigma]2] Cos[\[Theta]p2], Abs[\[Sigma]2] Sin[\[Theta]p2]}; p2 = Graphics[{ {PointSize[0.015], Point[{\[Sigma]x, 0}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)", 12]], {\[Sigma]x, 0}, {0, 1.2}], {PointSize[0.015], Point[{0, \[Sigma]y}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", 12]], {0, \[Sigma]y}, {1.2, 0}], {PointSize[0.015], Point[coord1]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(1\)]\)", 12]], coord1, {-1.4, 0}], {PointSize[0.015], Point[coord2]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(2\)]\)", 12]], coord2, {-1.4, 0}], {Dashed, Thin, Line[{coord1, {-coord1[[1]], -coord1[[2]]}}]}, {Dashed, Thin, Line[{coord2, {-coord2[[1]], -coord2[[2]]}}]} } ]; plotTitle = Grid[{ {"normal stress polar (stress vs. angle) trajectory", SpanFromLeft}, TraditionalForm[ Style[#]] & /@ {"\!\(\*SubscriptBox[\(\[Sigma]\), \ \(x\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \(x\[InvisibleComma]y\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(2\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(2\)]\)"}, {padIt1[\[Sigma]x, {4, 1}], padIt1[\[Sigma]y, {4, 1}], padIt1[\[Tau]xy, {4, 1}], padIt1[\[Sigma]1, {4, 1}], Row[{padIt1[\[Theta]p1*180/Pi, {4, 1}], Degree}], padIt1[\[Sigma]2, {4, 1}], Row[{padIt1[\[Theta]p2*180/Pi, {4, 1}], Degree}] } }, Spacings -> {0.8, 1}, Frame -> All, FrameStyle -> Directive[Thin]]; Show[p1, p2, PlotLabel -> plotTitle] ]; (*-------------------------------------------------------------*) makeShearStressPolarPlot[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric, limit_?numericStrictPositive, gridLines_?numericPositive] := Module[{pts, \[Theta], \[Sigma]1, \[Tau]1, \[Tau]2, \[Sigma]2, \ \[Sigma]1Abs, \[Sigma]2Abs, \[Theta]p1, \[Theta]p2, p1, p2, plotTitle, coord1, coord2}, pts = Table[{rotationStress[\[Sigma]x, \[Sigma]y, \[Tau]xy, \ \[Theta]], \[Theta]}, {\[Theta], 0, 2 Pi, Pi/40}]; {{\[Sigma]1, \[Theta]p1}, {\[Sigma]2, \[Theta]p2}} = principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy]; {\[Tau]1, \[Tau]2} = maxAndMinShearStress[\[Sigma]x, \[Sigma]y, \[Tau]xy]; p1 = plot[Transpose[{pts[[All, 2]], pts[[All, 1, 3]]}], limit, gridLines, Blue]; coord1 = {Abs[\[Tau]1] Cos[\[Theta]p1 + Pi/4], Abs[\[Tau]1] Sin[\[Theta]p1 + Pi/4]}; coord2 = {Abs[\[Tau]1] Cos[\[Theta]p2 + Pi/4], Abs[\[Tau]1] Sin[\[Theta]p2 + Pi/4]}; p2 = Graphics[{ {PointSize[0.015], Point[{\[Tau]xy, 0}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(x\[InvisibleComma]y\ \)]\)", 12]], {\[Tau]xy, 0}, {0, 1.2}], {PointSize[0.015], Point[{0, \[Tau]xy}]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(y\[InvisibleComma]x\ \)]\)", 12]], {0, \[Tau]xy}, {1.2, 0}], {PointSize[0.015], Point[coord1]}, Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)", 12]], coord1, {-1.4, 0}], {Dashed, Thin, Line[{coord1, {-coord1[[1]], -coord1[[2]]}}]}, {Dashed, Thin, Line[{coord2, {-coord2[[1]], -coord2[[2]]}}]} } ]; plotTitle = Grid[{ {"shear stress polar (stress vs. angle) trajectory", SpanFromLeft}, Flatten@{TraditionalForm[ Style[#]] & /@ {"\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\ \)", "\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \ \(x\[InvisibleComma]y\)]\)", "\!\(\*SubscriptBox[\(\[Tau]\), \(max\)]\)", "\!\(\*SubscriptBox[\(\[Theta]\), \(max\)]\)"}, SpanFromLeft}, {padIt1[\[Sigma]x, {4, 1}], padIt1[\[Sigma]y, {4, 1}], \[PlusMinus]padIt2[\[Tau]xy, {4, 1}], padIt1[\[Tau]1, {4, 1}], Row[{padIt1[(\[Theta]p1 + Pi/4)*180/Pi, {4, 1}], Degree, ",", padIt1[(\[Theta]p1 + 3/4 Pi)*180/Pi, {4, 1}], Degree}], SpanFromLeft} }, Spacings -> {1, 1}, Frame -> All, FrameStyle -> Directive[Thin]]; Show[p1, p2, PlotLabel -> plotTitle] ]; (*-------------------------------------------------------------*) make2DStressDiagram[\[Sigma]x_?numeric, \[Sigma]y_? numeric, \[Tau]xy_?numeric, \[Theta]_?numeric, annotate_?bool, onPositiveSideOnly_?bool, limit_?numericStrictPositive, gridLines_?numericPositive, {contentSizeW_?numericStrictPositive, contentSizeH_?numericStrictPositive}] := Module[{\[Sigma]1, \[Sigma]2, \[Sigma]xx, \[Sigma]yy, \[Tau]xyxy, r, \[Sigma]xxRightArrow, \[Sigma]xxLeftArrow, \ \[Sigma]yyTopArrow, \[Sigma]yyBottomArrow, \[Tau]RightArrow, \ \[Tau]LeftArrow, \[Tau]TopArrow, \[Tau]BottomArrow, \[Tau]1, \[Tau]2, color, textSize = 11, colorShear, \[Sigma]xxRightArrowText, \[Sigma]xxLeftArrowText, \ \[Sigma]yyTopArrowText, \[Sigma]yyBottomArrowText, \ \[Tau]RightArrowText, \[Tau]LeftArrowText, \[Tau]TopArrowText, \ \[Tau]BottomArrowText, rotationMatrix, coordinates, from, to, rotatedAxisXText, rotatedAxisYText, maxAbsoluteprincipalShearStress, thickness = Thick, eps = 10^-9, \[Theta]p1, \[Theta]p2}, rotationMatrix = RotationMatrix[-\[Theta]]; rotatedAxisXText = Text[Style["x", Italic, textSize], {0.3, 0}.rotationMatrix]; rotatedAxisYText = Text[Style["y", Italic, textSize], {0, 0.3}.rotationMatrix]; {{\[Sigma]1, \[Theta]p1}, {\[Sigma]2, \[Theta]p2}} = principalStresses[\[Sigma]x, \[Sigma]y, \[Tau]xy]; {\[Tau]1, \[Tau]2} = maxAndMinShearStress[\[Sigma]x, \[Sigma]y, \[Tau]xy]; maxAbsoluteprincipalShearStress = Max[Abs[{\[Tau]1, \[Tau]2}]]; {\[Sigma]xx, \[Sigma]yy, \[Tau]xyxy} = rotationStress[\[Sigma]x, \[Sigma]y, \[Tau]xy, \[Theta]]; If[Abs[\[Sigma]1] > 0, {\[Sigma]xx, \[Sigma]yy} = {\[Sigma]xx, \[Sigma]yy}/ Abs[\[Sigma]1](*scale*) ]; If[maxAbsoluteprincipalShearStress > 0, \[Tau]xyxy = \[Tau]xyxy/ maxAbsoluteprincipalShearStress(*scale*) ]; color = Red; colorShear = Blue; r = {White, EdgeForm[{Thin, Gray}], Rectangle[{-0.5, -0.5}, {0.5, 0.5}]}; (*--------*) If[\[Sigma]xx >= 0, from = {0.6, 0}; to = {0.6 + \[Sigma]xx, 0}; coordinates = {If[annotate, 0.78, 0.68] + \[Sigma]xx, 0}.rotationMatrix , from = {0.6 + Abs@\[Sigma]xx, 0}; to = {0.6, 0}; coordinates = {If[annotate, 0.78, 0.68] + Abs@\[Sigma]xx, 0}.rotationMatrix ]; \[Sigma]xxRightArrowText = If[annotate, Text[ Style[Column[{TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)"]], padIt1[\[Sigma]xx*Abs[\[Sigma]1], {3, 1}]}, Alignment -> Center], textSize], coordinates, {0, 0}], Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)", textSize]], coordinates, {0, 0}] ]; \[Sigma]xxRightArrow = {thickness, Arrowheads[Medium], color, Arrow[{from, to}, 0]}; (*--------*) If[\[Sigma]xx >= 0, from = {-0.6, 0}; to = {-0.6 - \[Sigma]xx, 0}; coordinates = {If[annotate, -0.78, -0.68] - \[Sigma]xx, 0}.rotationMatrix , from = {-0.6 - Abs@\[Sigma]xx, 0}; to = {-0.6, 0}; coordinates = {If[annotate, -0.78, -0.68] - Abs@\[Sigma]xx, 0}.rotationMatrix ]; \[Sigma]xxLeftArrowText = If[annotate, Text[ Style[Column[{TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)"]], padIt1[\[Sigma]xx*Abs[\[Sigma]1], {3, 1}]}, Alignment -> Center], textSize], coordinates], Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(x\)]\)", textSize]], coordinates] ]; \[Sigma]xxLeftArrow = {thickness, Arrowheads[Medium], color, Arrow[{from, to}, 0]}; (*--------*) If[\[Sigma]yy >= 0, from = {0, 0.6}; to = {0, 0.6 + \[Sigma]yy}; coordinates = {0, If[annotate, 0.75, 0.68] + \[Sigma]yy}.rotationMatrix , from = {0, 0.6 + Abs@\[Sigma]yy}; to = {0, 0.6}; coordinates = {0, If[annotate, 0.75, 0.68] + Abs@\[Sigma]yy}.rotationMatrix ]; \[Sigma]yyTopArrowText = If[annotate, Text[ Style[Column[{TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)"]], padIt1[\[Sigma]yy*Abs[\[Sigma]1], {3, 1}]}, Alignment -> Center], textSize], coordinates], Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", textSize]], coordinates] ]; \[Sigma]yyTopArrow = {thickness, Arrowheads[Medium], color, Arrow[{from, to}, 0]}; (*--------*) If[\[Sigma]yy >= 0, from = {0, -0.6}; to = {0, -0.6 - \[Sigma]yy}; coordinates = {0, -0.75 - \[Sigma]yy}.rotationMatrix , from = {0, -0.6 - Abs@\[Sigma]yy}; to = {0, -0.6}; coordinates = {0, -0.75 - Abs@\[Sigma]yy}.rotationMatrix ]; \[Sigma]yyBottomArrowText = If[annotate, Text[ Style[Column[{TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)"]], padIt1[\[Sigma]yy*Abs[\[Sigma]1], {3, 1}]}, Alignment -> Center], textSize], coordinates], Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Sigma]\), \(y\)]\)", textSize]], coordinates] ]; \[Sigma]yyBottomArrow = {thickness, Arrowheads[Medium], color, Arrow[{from, to}, 0]}; (*--------*) If[\[Tau]xyxy >= 0, from = {0.6, 0.5 - \[Tau]xyxy}; to = {0.6, 0.5}; coordinates = {If[annotate, 0.8, 0.7], 0.45}.rotationMatrix , from = {0.6, 0.5}; to = {0.6, 0.5 - Abs@\[Tau]xyxy}; coordinates = {If[annotate, 0.8, 0.7], 0.45}.rotationMatrix ]; \[Tau]RightArrowText = If[annotate, Text[ Style[Column[{TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \ \(x\[InvisibleComma]y\)]\)"]], padIt1[\[Tau]xyxy*maxAbsoluteprincipalShearStress, {3, 1}]}, Alignment -> Center], textSize], coordinates] , Text[ TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \ \(x\[InvisibleComma]y\)]\)", textSize]], coordinates] ]; \[Tau]RightArrow = {thickness, Arrowheads[Medium], colorShear, Arrow[{from, to}, 0]}; (*--------*) If[\[Tau]xyxy >= 0, from = {0.5 - \[Tau]xyxy, 0.6}; to = {0.5, 0.6}; coordinates = {0.5, 0.75}.rotationMatrix , from = {0.5, 0.6}; to = {0.5 - Abs@\[Tau]xyxy, 0.6}; coordinates = {0.5, 0.75}.rotationMatrix ]; \[Tau]TopArrowText = Text[TraditionalForm[ Style["\!\(\*SubscriptBox[\(\[Tau]\), \ \(y\[InvisibleComma]x\)]\)", textSize]], coordinates]; \[Tau]TopArrow = {thickness, Arrowheads[Medium], colorShear, Arrow[{from, to}, 0]}; \[Tau]LeftArrow = {Arrowheads[Medium], If[\[Tau]xyxy >= 0, { thickness, colorShear, Arrow[{{-0.6, -0.5 + \[Tau]xyxy}, {-0.6, -0.5}}, 0] } , { thickness, colorShear, Arrow[{{-0.6, -0.5}, {-0.6, -0.5 + Abs@\[Tau]xyxy}}, 0] } ]}; \[Tau]BottomArrow = {thickness, colorShear, Arrowheads[Medium], If[\[Tau]xyxy >= 0, Arrow[{{-0.5 + \[Tau]xyxy, -0.6}, {-0.5, -0.6}}, 0] , Arrow[{{-0.5, -0.6}, {-0.5 + Abs@\[Tau]xyxy, -0.6}}, 0] ] }; from = -(limit/40)*1.9; to = -from; Graphics[ {Rotate[r, \[Theta], {0, 0}], If[Abs@\[Sigma]xx > eps, { Rotate[\[Sigma]xxRightArrow, \[Theta], {0, 0}], \[Sigma]xxRightArrowText, If[onPositiveSideOnly, Sequence @@ {}, Rotate[\[Sigma]xxLeftArrow, \[Theta], {0, 0}]] }, Sequence @@ {} ] , If[Abs@\[Sigma]yy > eps, { Rotate[\[Sigma]yyTopArrow, \[Theta], {0, 0}], \[Sigma]yyTopArrowText, If[onPositiveSideOnly, Sequence @@ {}, Rotate[\[Sigma]yyBottomArrow, \[Theta], {0, 0}]] }, Sequence @@ {} ] , If[Abs@\[Tau]xyxy > eps, { Rotate[\[Tau]RightArrow, \[Theta], {0, 0}], \[Tau]RightArrowText, Rotate[\[Tau]TopArrow, \[Theta], {0, 0}], If[onPositiveSideOnly, Sequence @@ {}, { Rotate[\[Tau]LeftArrow, \[Theta], {0, 0}], Rotate[\[Tau]BottomArrow, \[Theta], {0, 0}] } ] }, Sequence @@ {} ] , {Gray, Thin, Dashed, Rotate[{Arrowheads[Small], Arrow[{{-0.25, 0}, {0.25, 0}}]}, \[Theta], {0, 0}]}, {Gray, Thin, Dashed, Rotate[{Arrowheads[Small], Arrow[{{0, -0.25}, {0, 0.25}}]}, \[Theta], {0, 0}]}, rotatedAxisXText, rotatedAxisYText, {PointSize[0.01], Point[{0, 0}]} } , Axes -> False, PlotRange -> {{from, to}, {from , to}}, ImageSize -> {contentSizeW, contentSizeH}, ImagePadding -> {{10, 10}, {10, 10}}, ImageMargins -> 0, AspectRatio -> Automatic, If[gridLines == 0, GridLines -> None, { GridLines -> {Range[from, to, (to - from)/(gridLines*20)], Range[from, to, (to - from)/(gridLines*20)]}, GridLinesStyle -> Directive[Thickness[.001], LightGray] } ], Frame -> False ] ] } ]