[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[help-3dldf] Re: focus (fwd)

From: Laurence Finston
Subject: [help-3dldf] Re: focus (fwd)
Date: Thu, 10 Feb 2005 13:13:28 +0100 (MET)

---------- Forwarded message ----------
Date: Thu, 10 Feb 2005 13:11:32 +0100 (MET)
From: Laurence Finston <address@hidden>
To: Martijn van Manen
Subject: Re: focus

> [...]

It's not a problem.  If no one asks questions, I can't give
answers.  In particular, there won't be any "Frequently Asked"

> How do I set the focus? Of the current picture?
> I try stuff like:
>  focus f;
>  f:=(3,1,2,-1,-1,-1,10,180);
>  endfig;
> But it won't work.

No, it won't.  You need to use a `set' command:

set_command: SET focus_variable WITH_POSITION
             point_expression WITH_DIRECTION point_expression
             WITH_DISTANCE numeric_expression with_angle_optional


focus f;

set f with_position (0, 3, -10) with_direction (0, 3, 10)
   with_distance 20;

You can find examples of most constructions in `sample0.ldf'.
You might want to try working backwards through the examples
until you get the hang of the 3DLDF language.  Since you know and (presumably) MF and/or MP, this shouldn't take
you long.  I didn't start using `sample0.ldf' until I was fairly
far along, so it doesn't start with the easiest constructions.

> How is also the
> endfig with_focus .... ;
> construct?

endfig with_focus f;

The syntax rules are all in `parser.output'.  Capitalized items on the
right-hand side of rules are "primitives", also known as "tokens",
"terminal symbols", or "terminals".  In your input, these items should
be replaced by the symbol they name, e.g., `LEFT_PARENTHESIS'
by `(', or by the same text, but in lowercase, e.g., `WITH_FOCUS' by
`with_focus'.  The correspondences between single symbols and
terminal symbols are currently hardwired into the 3DLDF language, but
I think it will be easy to "un-hardwire" them.  The correspondences
between words and terminal symbols are not hardwired, i.e., the current
meanings of symbolic tokens are looked up in a table.

For example, these are the rules for `beginfig':

    341 command: beginfig_command

    486 beginfig_command: BEGINFIG LEFT_PARENTHESIS
        numeric_expression RIGHT_PARENTHESIS

Unfortunately, `parser.output' is currently generated in German.
I'll see if I can get the system administrator to change this
back.  It shouldn't be a problem for you, though.

The rules for `endfig' follow.  They are more complicated.
The rules for `output_command' are similar.

Don't be afraid to look at the code and even fiddle with it.
If you break something, all you have to do is revert the files.
Of course, some mistakes will damage the fabric of space and time,
destroying the universe.

The parser rules are in the files with names of the pattern `p*.w*,
e.g., the rules for `numeric_expressions' are in `pnumexpr.w',
the rules for `point_expressions' in `ppntexpr.w', etc.  If you have
any questions regarding a point of the 3DLDF language, I suggest
looking in these files.

I realize that understanding my code might be a bit difficult for the
unpracticed, so I am, of course, happy to answer questions.

If you've got a copy of _The METAFONTbook_, I suggest taking a look
at the syntax rules.  I admit that I always used to skip over them
before I started working on the parser for 3DLDF.  The 3DLDF
language is based on the Metafont language, so if you understand
how the latter works, learning the former should be a snap.



  342 command: endfig_command

  487 endfig_command: ENDFIG with_clause_output_list

  489 with_clause_output_list: /* leer */
  490                        | with_clause_output_list with_clause_output

  491 with_clause_output: CLEAR
  492                   | WITH_FOCUS focus_expression
  493                   | WITH_PROJECTION projection_type
  494                   | WITH_FACTOR numeric_expression
  495                   | sort_option

  496 sort_option: MAX_Z_SORT
  497            | MIN_Z_SORT
  498            | MEAN_Z_SORT
  499            | NO_SORT

  500 with_clause_output: projection_limits_option

  501 projection_limits_option: MIN_X_PROJ EQUATE numeric_expression
  502                         | MAX_X_PROJ EQUATE numeric_expression
  503                         | MIN_Y_PROJ EQUATE numeric_expression
  504                         | MAX_Y_PROJ EQUATE numeric_expression
  505                         | MIN_Z_PROJ EQUATE numeric_expression
  506                         | MAX_Z_PROJ EQUATE numeric_expression

  507 projection_type: PERSPECTIVE
  508                | PARALLEL_X_Y
  509                | PARALLEL_X_Z
  510                | PARALLEL_Z_Y
  511                | AXONOMETRIC
  512                | ISOMETRIC
  513                | SUPPRESS

reply via email to

[Prev in Thread] Current Thread [Next in Thread]