help-bison
[Top][All Lists]
Advanced

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

Re: 3DLDF


From: Laurence Finston
Subject: Re: 3DLDF
Date: Fri, 13 Aug 2004 00:25:27 +0200
User-agent: IMHO/0.98.3+G (Webmail for Roxen)

-------------------
Hans Aberg wrote:
> I had a look at your 3DLDF manual:
> 
> On chapter 2: I am not sure how you avoid a polymorphic system when
> developing a Bison parser. Given from what you write there, an obvious way
> would be to derive all your geometric object classes from a root class
> object_root, with a polymorphic calls object. The parser semantic value
> then contains a
>     object object_;
> as I described earlier.
> 

I'm not trying to avoid a polymorphic system.  I think a program uses
polymorphism when it accesses an object of a derived type through a variable
of a base type and performs actions on it specific to the derived type.  I
don't believe that polymorphism implies that the specific type of the object
in question can only be known at run-time.  Therefore I believe that 3DLDF
1.1.5.1, which is non-interactive, uses polymorphism.  However, I haven't had
a chance to look up what Stroustrup says about it, so maybe I'm wrong.

I'm not really very object-oriented.  C++ supplies a lot of useful features
and I use them.

The geometric object classes are all derived from `class Shape', which is an
abstract class.

> The Bison grammar then will contain things like:
>   point:
>     "(" coordinate "," coordinate "," coordinate ")" {
>       $$ = new Point($1, $2, $3);
>     }
>   ;
> if the syntax of a point in your program is (x_1, x_2, x_3). It is then
> easy to add the different operations and types you have to your system.

It's not that simple.  You can check the parser code in the CVS archive at
Savannah if you want to see the syntax of `point expressions': 

http://savannah.gnu.org/cgi-bin/viewcvs/3dldf/3dldf/Group/CWEB/

The parser code is in files with names of the pattern `p*.w', e.g.,
`parser.w', `pldfdcl.w', etc.  `point_expressions' are in 
`ppntexpr.w'.

> (But I am not sure how your C++ code produces an output.)
> 

Keep reading the manual and all will be revealed---well, almost all.  For the
full story, you'd have to look at _3DLDF: The Program_.

> >From what I have seen of what your program can do, you might decide to
> invent your own syntax which the best expresses the things your program can
> do.

That's what I'm doing, while trying to stay as close to the Metafont language
as possible.

> 
> For n-D modelling (in n dimensions), I think one can use the higher
> dimensional equivalent of Bezier (spline curves): maps
>     f: sigma^n -> R^n
> where sigma is the n-dimensional simplex, and where the coordinate
> projection coordinates of f are degree 3 polynomials. These simplicies must
> then be glued together at the lower dimensional subsimplicies, which then
> also are parametrized by degree 3 polynomials.
> 

At the moment, I'm only concerned with 3D modelling.  I plan to implement
NURBS, because the simpler spline curves aren't projectively affine.
Later, I would like to implement 4-dimensional and n-dimensional modelling so
that I can make projections of Klein bottles, hypercubes, and other
n-dimensional objects.  I'd also like to use 3DLDF to animations of a sphere
inversion and similar things.

> (In section 1.4: You speak about real values, but probably mean floats
> (floating point values). 

In 3DLDF, `real' is a synonym for `float' or `double' defined using `typedef'.

Whether it's one or the other is determined in conditionally compiled code. 
In my development sources, the value of the preprocessor macro used in the
`#if' statement can be set by an option to `configure'. 

> And you have a sentence (second below):
>   In the following, it may be a little unclear why I sometimes refer to
> Metafont
>   and sometimes to MetaPost. The reason is that Metafont inherited much of
its
>   functionality from Metafont.

There are many typos in the manual.  Thank you for pointing this one out.  

> Also, why has MetaPost an inner uppercase letter, when Metafont does not?)
> 

Because John Hobby, the author of MetaPost and a major contributor to
Metafont, wants it that way.  Knuth actually writes `METAFONT' using a special
font.  But as Ralph Waldo Emerson said, "A ruthless consistency is the
hobgoblin of small minds."

Thank you for taking an interest in 3DLDF.

Laurence




reply via email to

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