1
$\begingroup$

I'm trying to demonstrate an interesting problem in geometry: Rotate the red triangle -Pi/3 but when it hits the x-axis, the red line segment disappears apparently behind the black color of the axis. I was wondering if someone could help me demonstrate this so that the red leg of the triangle remains even when it's superimposed over the black axis?

Thanks for reading, Dominic

thef[x_] := 1/2 (Sqrt[3] - 2 Sqrt[1 - 2 x])
p1 = Plot[thef[x], {x, 0, 1}];
point1 = Graphics[{Red, Point[{0.3, thef[0.3]}]}];
Clear[myTransform, myRotatedPoint]
triangle2 = 
  Graphics[{EdgeForm[Red], FaceForm[], 
    Triangle[{{0, 0}, {0.3, thef[0.3]}, {1/2, Sqrt[3]/2}}]}];
r = RotationTransform[theta]
r[{0, 1/2}] /. theta -> -Pi/4
myRotatedPoint[myVal_] := r[{0.3, thef[0.3]}] /. theta -> myVal;

myRotatedPointGraphics[myVal_] := 
  Graphics[{Red, Point@myRotatedPoint[myVal]}];
myRotatedLineGraphics[myVal_] := 
  Graphics[Line[{{0.3, thef[0.3]}, myRotatedPoint[myVal]}]];
thirdLine = Graphics[Line[{{0.3, thef[0.3]}, {1, 0}}]];

myTransform[myT_] := 
  Graphics[GeometricTransformation[{EdgeForm[Red], FaceForm[], 
     Triangle[{{0, 0}, {0.3, thef[0.3]}, {1/2, Sqrt[3]/2}}]}, 
    RotationMatrix[myT]]];
Manipulate[
 Show[{Graphics[{EdgeForm[Black], FaceForm[], 
     Triangle[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}]}], triangle2, 
   myTransform[myT], p1, point1, myRotatedPointGraphics[myT], 
   myRotatedLineGraphics[myT], thirdLine}, Axes -> True, 
  PlotRange -> 1], {myT, 0, -Pi/3}]

enter image description here

$\endgroup$
  • $\begingroup$ what is thef? $\endgroup$ – kglr Aug 28 at 9:56
  • 1
    $\begingroup$ try EdgeForm[{Thick, Red}] instead of EdgeForm[Red] when you define triangle2 ? $\endgroup$ – kglr Aug 28 at 10:05
  • $\begingroup$ Sorry, forgot def of thef: thef[x_] := 1/2 (Sqrt[3] - 2 Sqrt[1 - 2 x]) and added to above code. $\endgroup$ – Dominic Aug 28 at 10:14
  • $\begingroup$ Ok, thanks, the {Thick,Red} did it. $\endgroup$ – Dominic Aug 28 at 10:16
1
$\begingroup$

Replace EdgeForm[Red] with EdgeForm[{Thick,Red}] in the definition of myTransform.

enter image description here

$\endgroup$
  • $\begingroup$ @Dominic, thank you for the accept. May I suggest you revisit your older questions to see if any answers are worth accepting? $\endgroup$ – kglr Aug 28 at 10:46
  • $\begingroup$ Ok of course. Done. Hadn't been doing that. Will do in future. $\endgroup$ – Dominic Aug 28 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.