Note

This Mathematica notebook is from the WWW project A Visual Dictionary of Special Plane Curves. Copyright © 1995-2000 by Xah Lee. (http://xahlee.org/)

Packages and Initializations

Needs["RuledSurfacePlot`"]
(*MathSource Item:0207-975*)

Needs["ExtendGraphics`Geometry3D`"]
(* MathSource Item#:/Enhancements/Graphics/3D/0205-041 *)

Needs["Graphics`Shapes`"]	(* 0200-608 *)

Clear[ Slice3DGraphics]

Slice3DGraphics::usage = "
	Slice3DGraphics[ graphics3DPrimitives,  sliceAxis, {p1, p2,...,pn} ]
	will return a list of Graphics3D primitives that is parts of the
	given graphics3DPrimitives sliced along planes passing through
	a list of nPoints {p1, p2,...,pn} and normal to sliceAxis vector.
	Graphics that lies outside the first and last cutting plane will
	be clipped.	The number of Graphics3D objects returned depends on
	positions of nPoints.
	The nPoints that define the slicing plane must be
	in order; towards the direction of sliceAxis vector.
	sliceAxis is a vector of the form {x,y,z}.
	Slice3DGraphics calls functions in the package ExtendGraphics`Geometry3D.";

Slice3DGraphics[ gp_List, axis_List, throughPoints_List ]:=
Module[{pieces, remain},
	remain = gp;
	pieces = Table[Null, {Length@ throughPoints-1} ];
	Do[
		remain = Clip3D[ remain, Plane[ throughPoints[[i]], axis] ];
		pieces[[i]] = Clip3D[ remain, Plane[ throughPoints[[i+1]], -axis] ],
		{i, Length@ pieces}
	];
	pieces
]

SetOptions[Graphics3D,
	LightSources :>RandomLightSource[]
];

RandomLightSource::usage ="RandomLightSource[] returns a list that is
appropriate for the option LightSource. For example, one can do
Show[..., LightSource->RandomLightSource[] ]";

RandomLightSource[] := 
Table[
	{	{Random[],Random[],Random[]},
		Hue[Random[],Random[Real,{.5,1}], Random[Real,{.5,1}]]
	},
	{3}
];

Cross sections of a cylinder are ellipses

The intersection of a right circular cylinder and a plane are ellipses.
One can see this by tilting a cup or a cone shaped paper cup filled with liquid.

Let r be the radius of the base circle of the cylinder, cuttingAngle be the angle formed by the cutting plane and the plane of the base circle of the right circular cylinder. The intersection will be the ellipse {r/Cos[cuttingAngle] Cos[t],r Sin[t]}.

Clear[cuttingAngle, wireFramedCylinderGP, intersectionGP]

cuttingAngle = Pi/6;

slicedCylinderGP = 
Slice3DGraphics[ Cylinder[1,2,50], {1,0,Abs@ Tan[cuttingAngle+Pi/2]},
	{{0,0,-10},{0,0,0}}];

Show[
	Graphics3D[{ EdgeForm[],slicedCylinderGP
	}]
];

wireFramedCylinderGP = First@ RuledSurfacePlot[
	{ {Cos[t],Sin[t],1} , {Cos[t],Sin[t],-1} },
	{t,0, 2 Pi},
	PlotPoints->{20,5},
	CheckerBoardPattern->False,
	HiddenSurface->False,
	DisplayFunction->Identity
] /. {Hue[0]->GrayLevel[0], Hue[.7]->GrayLevel[0]};

wireFramedCylinderGP =
	Slice3DGraphics[ wireFramedCylinderGP,
	{1,0,Abs@ Tan[cuttingAngle+Pi/2]}, {{0,0,0},{0,0,10}}];

intersectionGP = First@ ParametricPlot[
	{1/Cos[cuttingAngle] Cos[t], Sin[t]},
	{t, 0, 2 Pi},
	AspectRatio->Automatic,
	DisplayFunction->Identity
] /. {x_?AtomQ, y_?AtomQ }->{x,y,0};

intersectionGP = RotateShape[intersectionGP, -Pi/2, cuttingAngle, Pi/2];

Show[ Graphics3D[{
	EdgeForm[],slicedCylinderGP,
	wireFramedCylinderGP,
	intersectionGP
	}],
	Boxed->False,
	DisplayFunction->$DisplayFunction,
	PlotRange->{{-1,1},{-1,1},{-2,1}}
];