Drawing Cylindrical Segment with Graphics3D
Use ShearingTransform
:
Graphics3D[{Polygon[{{-1.5, -1.5, 0}, {1.5, -1.5, 0}, {1.5, 1.5,
0}, {-1.5, 1.5, 0}}],
Polygon[{{-1.5, 0, -1.5}, {1.5, 0, -1.5}, {1.5, 0, 1.5}, {-1.5, 0,
1.5}}], Opacity[0.5],
GeometricTransformation[Cylinder[{{-1, 1, 0}, {0.0, 0, 0}}, 0.2],
ShearingTransform[ -Pi/4, {-1, 1, 0}, {1, 1, 0}]],
GeometricTransformation[Cylinder[{{0, 0, 0}, {1, 1, 0}}, 0.2],
ShearingTransform[ -Pi/4, {1, 1, 0}, {-1, 1, 0}]],
Scale[
GeometricTransformation[
Cylinder[{{0, 0, 0}, {0.5, -1, 0}}, 0.25],
ShearingTransform[ -ArcTan[1/2.], {.5, -1, 0}, {-1, -.5, 0}]], {1,
1, 0.8}]}]
The shearing angles are calculated by hand from the specific incident and refracted angles you used. It could of course be automated, too.
To shear the caps of the cylinders without deforming the cylinder cross section, the first argument of ShearingTransform
has to be a vector along the cylinder axis, and the second argument points perpendicular to the ray (in the plane of incidence).
Since your are simulating Light, why not use Tube
tube1IncidentAndReflection={{-1,1,0},{0,0,0},{1,1,0}};
tube2IncidentAndRefraction={{-1,1,0},{0,0,0},{.6,-1,0}};
Graphics3D[{Polygon[{{-1.5,-1.5,0},{1.5,-1.5,0},{1.5,1.5,0},{-1.5,1.5,0}}],Polygon[{{-1.5,0,-1.5},{1.5,0,-1.5},{1.5,0,1.5},{-1.5,0,1.5}}],Opacity[0.5],Tube[tube1IncidentAndReflection],Tube[tube2IncidentAndRefraction]}]
And you can set the JoinForm
, amr's remind of CapForm
.
So still some problem described as Jens' comment