I am trying to graph a cylinder. Is there a way to draw a more elliptic top/bottom. This one seems some flattened at the top and bottom. I would like to hatch the mid elliptic that is collored grey now. Is there a way to do this. Thanks Jeroen \placefigure [here,force] [fig:tubing] {Tubular Linear Volumetric Capacity} {\startMPcode draw (0,0){up} ... (1.25cm, 2mm) ... (2.5cm,0){down} ... (1.25cm, -2mm) ... cycle; draw (0,0) -- (0,-5cm) dashed evenly; draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly; draw (0,-5cm){up} ... (1.25cm, -4.8cm) ... (2.5cm,-5cm){down} ... (1.25cm, -5.2cm) ... cycle dashed evenly; draw (-.2cm,0){up} ... (1.25cm, 3.5mm) ... (2.7cm,0){down} ... (1.25cm, -3.5mm) ... cycle; draw (-.2cm,0) -- (-.2cm,-5cm); draw (2.7cm,0) -- (2.7cm,-5cm); draw (-.2cm,-5cm){up} ... (1.25cm, -4.7cm) ... (2.7cm,-5cm){down} dashed evenly; draw (-.2cm,-5cm){down} ... (1.25cm, -5.3cm) ... (2.7cm,-5cm){up}; fill (0,-2.5cm){up} ... (1.25cm, -2.3cm) ... (2.5cm,-2.5cm){down} ... (1.25cm, -2.7cm) ... cycle withcolor (.6,.6,.6) dashed evenly; label.top("tubular",(1.26cm,-1.1cm)); label.top("inside area",(1.28cm,-1.6cm)); label.top("($in^2$)",(1.28cm,-2.2cm)); draw (3.25cm,-5cm) -- (3.25cm,0); drawarrow (3.25cm,-5) -- (3.25cm,0); drawarrow (3.25cm,0) -- (3.25cm,-5cm); label.top("tubular length ($in$)",(5.2cm,-2.75cm)); \stopMPcode}
Please change your mailing name and address.
In order to draw 3D perspective diagrams in MetaPost,
you will need to transform 3D paths to a 2D projection.
There are many methods to accomplish this, and there are several MP
modules that have been written to address this issue.
One fairly simple and elegant approach is available from Urs Oswald:
http://www.ursoswald.ch/metapost/tutorial.html
Alan
On Sun, 6 Dec 2015 21:54:38 +0100
Context NTG
I am trying to graph a cylinder. Is there a way to draw a more elliptic top/bottom. This one seems some flattened at the top and bottom. I would like to hatch the mid elliptic that is collored grey now. Is there a way to do this.
Thanks Jeroen
\placefigure
[here,force]
[fig:tubing]
{Tubular Linear Volumetric Capacity}
{\startMPcode
draw (0,0){up} ... (1.25cm, 2mm) ... (2.5cm,0){down} ... (1.25cm, -2mm) ... cycle;
draw (0,0) -- (0,-5cm) dashed evenly;
draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly;
draw (0,-5cm){up} ... (1.25cm, -4.8cm) ... (2.5cm,-5cm){down} ... (1.25cm, -5.2cm) ... cycle dashed evenly;
draw (-.2cm,0){up} ... (1.25cm, 3.5mm) ... (2.7cm,0){down} ... (1.25cm, -3.5mm) ... cycle;
draw (-.2cm,0) -- (-.2cm,-5cm);
draw (2.7cm,0) -- (2.7cm,-5cm);
draw (-.2cm,-5cm){up} ... (1.25cm, -4.7cm) ... (2.7cm,-5cm){down} dashed evenly;
draw (-.2cm,-5cm){down} ... (1.25cm, -5.3cm) ... (2.7cm,-5cm){up};
fill (0,-2.5cm){up} ... (1.25cm, -2.3cm) ... (2.5cm,-2.5cm){down} ... (1.25cm, -2.7cm) ... cycle withcolor (.6,.6,.6) dashed evenly;
label.top("tubular",(1.26cm,-1.1cm));
label.top("inside area",(1.28cm,-1.6cm));
label.top("($in^2$)",(1.28cm,-2.2cm));
draw (3.25cm,-5cm) -- (3.25cm,0);
drawarrow (3.25cm,-5) -- (3.25cm,0);
drawarrow (3.25cm,0) -- (3.25cm,-5cm);
label.top("tubular length ($in$)",(5.2cm,-2.75cm));
\stopMPcode}
-- Alan Braslau CEA DSM-IRAMIS-SPEC CNRS UMR 3680 Orme des Merisiers 91191 Gif-sur-Yvette cedex FRANCE tel: +33 1 69 08 73 15 fax: +33 1 69 08 87 86 mailto:alan.braslau@cea.fr
I guess the code I am looking for is the below to hatch the cut-out
section. How can I load the MetaPost hatching package in Context minimals
so it understands the hatchfill command?
Thanks
Jeroen
\startMPinclusions
input hatching;
\stopMPinclusions
\starttext
\placefigure[here,force][fig:tubing]{Tubular Linear Volumetric Capacity}
{\startMPcode
% inner circle
draw fullcircle xscaled 2.5cm yscaled 0.7cm shifted (1.25cm,0);
draw (0,0) -- (0,-5cm) dashed evenly;
draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly;
draw fullcircle xscaled 2.5cm yscaled 0.7cm shifted (1.25cm,-5cm) dashed
evenly;
%outer circle
draw fullcircle xscaled 2.9cm yscaled 1cm shifted (1.25cm,0);
draw (-.2cm,0) -- (-.2cm,-5cm);
draw (2.7cm,0) -- (2.7cm,-5cm);
draw halfcircle scaled 2.9cm yscaled 0.012cm shifted (1.25cm,-5cm) dashed
evenly;
draw halfcircle scaled 2.9cm yscaled 0.012cm rotated 180 shifted
(1.25cm,-5cm);
%cut-out section
hatchfill circle withcolor (45, 5mm, -.5bp);
fill fullcircle xscaled 2.5cm yscaled 0.7cm shifted (1.25cm,-2.7cm)
withcolor (.6,.6,.6);
label.top("tubular",(1.26cm,-1.3cm));
label.top("inside area",(1.28cm,-1.8cm));
label.top("($in^2$)",(1.28cm,-2.4cm));
%arrows and label ID
drawarrow (0,-4.1cm) -- (2.5cm,-4.1cm);
drawarrow (2.5cm,-4.1cm) -- (0,-4.1cm);
label.top("ID ($in$)",(1.26cm,-4.15cm));
%arrows and label tubular length
draw (3.25cm,-5cm) -- (3.25cm,0);
drawarrow (3.25cm,-5) -- (3.25cm,0);
drawarrow (3.25cm,0) -- (3.25cm,-5cm);
label.top("tubular length ($in$)",(5.2cm,-2.75cm));
\stopMPcode}
\stoptext
2015-12-06 21:54 GMT+01:00 Context NTG
I am trying to graph a cylinder. Is there a way to draw a more elliptic top/bottom. This one seems some flattened at the top and bottom. I would like to hatch the mid elliptic that is collored grey now. Is there a way to do this.
Thanks Jeroen
\placefigure
[here,force]
[fig:tubing]
{Tubular Linear Volumetric Capacity}
{\startMPcode
draw (0,0){up} ... (1.25cm, 2mm) ... (2.5cm,0){down} ... (1.25cm, -2mm) ... cycle;
draw (0,0) -- (0,-5cm) dashed evenly;
draw (2.5cm,0) -- (2.5cm,-5cm) dashed evenly;
draw (0,-5cm){up} ... (1.25cm, -4.8cm) ... (2.5cm,-5cm){down} ... (1.25cm, -5.2cm) ... cycle dashed evenly;
draw (-.2cm,0){up} ... (1.25cm, 3.5mm) ... (2.7cm,0){down} ... (1.25cm, -3.5mm) ... cycle;
draw (-.2cm,0) -- (-.2cm,-5cm);
draw (2.7cm,0) -- (2.7cm,-5cm);
draw (-.2cm,-5cm){up} ... (1.25cm, -4.7cm) ... (2.7cm,-5cm){down} dashed evenly;
draw (-.2cm,-5cm){down} ... (1.25cm, -5.3cm) ... (2.7cm,-5cm){up};
fill (0,-2.5cm){up} ... (1.25cm, -2.3cm) ... (2.5cm,-2.5cm){down} ... (1.25cm, -2.7cm) ... cycle withcolor (.6,.6,.6) dashed evenly;
label.top("tubular",(1.26cm,-1.1cm));
label.top("inside area",(1.28cm,-1.6cm));
label.top("($in^2$)",(1.28cm,-2.2cm));
draw (3.25cm,-5cm) -- (3.25cm,0);
drawarrow (3.25cm,-5) -- (3.25cm,0);
drawarrow (3.25cm,0) -- (3.25cm,-5cm);
label.top("tubular length ($in$)",(5.2cm,-2.75cm));
\stopMPcode}
participants (2)
-
Alan BRASLAU
-
Context NTG