Hi Bill
Thanks for sharing that code.  I've added it to the wiki here 
https://therion.speleo.sk/wiki/metapost#point_-_artificial_electric_light 
Can you supply a screen grab of the symbol (with a white background), that I 
can include in the wiki page?  (I should try it out myself, but I am taking a 
very minimal input approach here).

There is a partial explanation of u: here 
https://therion.speleo.sk/wiki/metapost#symbol_sizing but I will admit to not 
knowing if it relates directly to U:  Are u: and U: the same? I suspect not.
Feel free any metapost knowledgeables who knows better...

If you supply your symbols, either direct to me, or via the forum, I'll add 
them in due course.  The https://therion.speleo.sk/wiki/metapos page really 
needs some rational structure imposed on it and its table of contents, so I 
might work on that as well.  Posting direct to the forum will ensure people get 
the benefit of your work sooner!

Bruce


-----Original Message-----
From: Therion <[email protected]> On Behalf Of Bill Gee
Sent: Friday, 17 May 2019 06:51
To: [email protected]
Subject: Re: [Therion] Setting scale on custom symbol

Hi Bruce and Martin -

Thanks for the tips.  I have figured out how to make it work.  The new code 
looks like this:

# This code defines an artificial electric light.  Used in tourist sections of 
a cave.
    def p_u_electriclight (expr pos,theta,sc,al) =
      U:=(0.3u, 0.3u);
      % Reduce size of the symbol.  The default size is too big.
      interim defaultscale:=0.4sc;
      T:=identity aligned al rotated theta scaled defaultscale shifted pos;
      pickup PenC;
      
      thdraw fullcircle scaled 0.5u shifted (0.0u, 0.7u);
      thdraw (-0.5u, -0.6u) -- (-0.5u, 0.0u);
      thdraw (-0.5u, 0.0u) .. (-0.35u, 0.55u) .. (0.0u, 0.7u);
      thdraw (0.0u, 0.7u) .. (0.35u, 0.55u) .. (0.5u, 0.0u);
      thdraw (0.5u,0.0u) -- (0.5u, -0.6u);
      thdraw (-0.7u, -0.6u) -- (0.7u, -0.6u);
      
    enddef;


I fiddled with the constant 0.4 to find a value that produces symbols about the 
size I wanted.  A nice thing about this code is that it still respects the 
"-size xxx" parameters.  

What does the line "U:=(0.3u, 0.3u);" do?  As far as I can tell, it has no 
effect at all.

MetaPost is rather puzzling by having no explicit multiplication operator.  The 
expression "0.4sc" does multiplication, but without any visible operator.  The 
same happens for all the expressions involving "u".  Back when I was studying 
computer science, that would have produced much vituperation from the 
professors!

I think this code is now suitable for posting on the Wiki.  I have several 
other custom symbols that might be useful to others:

Pavement
Boardwalk
Tiled floor
  (all as area fills)

Display case
Boxwork
Bear bed
Pendant
Stromatolite
  (These are points)

Who should I send the code to for review and posting?

-- 
Bill Gee



_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion

Reply via email to