Zoom problem

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
Tegiri_Nenashi
Posts: 9
Joined: Wed May 14, 2008 12:52 pm

Zoom problem

Post by Tegiri_Nenashi »

startshape AXIS

rule AXIS {
LINE {}
LINE { rotate -90 }
//PARABOLA {}
}

// terminus
rule LINE 1 {
TRIANGLE { size 5 10 }
}

rule LINE 1000 {
CIRCLE { }
LINE { y 0.1 }
}

The x and y axis have different length; any reason why?

BTW, as you might notice from the commented line I'm trying to plot parabola graph. Is it possible in CFDG?

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

Your LINE rules draw a line of random length. Why do you expect any two instances to be the same length?

I think that Context Free can only do exponential and logarithmic graphs. Maybe someone who is better at math can figure out how to have the x and y parts of the graph be exponential in such a way that all of the terms above quadratic cancel out. Maybe like this? It has been too long since I used Taylor series

Code: Select all

rule PARABOLA {
  CIRCLE{}
  PARABOLA{s 0.99 sqrt(0.99) x 0.5 y 0.5}
}
You can always use the new bezier curve feature in v2.2.

Tegiri_Nenashi
Posts: 9
Joined: Wed May 14, 2008 12:52 pm

Post by Tegiri_Nenashi »

MtnViewJohn wrote:Your LINE rules draw a line of random length. Why do you expect any two instances to be the same length?

I think that Context Free can only do exponential and logarithmic graphs. ...
You have a variable, and one naturally expects variables with the same name evaluated to the same value. I understand that you have completely different execution model so that each time a variable is reference it should be reevaluated? Then, I just wonder would some features be lost if adopting the first alternative...

Well, if you have exp() and log(), then square(x) = exp(2*log(x))...

User avatar
mtnviewmark
Site Admin
Posts: 81
Joined: Wed May 04, 2005 12:46 pm
Location: Mountain View, CA
Contact:

Post by mtnviewmark »

I think your mistake is thinking of these things as variables. They are not. In this case LINE is a non-terminal. And each time that non-terminal is mentioned it is expanded again, anew, without any knowledge or reference to any other expansion. This is a direct consequence of the context-free nature of the grammars.

In your example, the non-terminal AXIS has one expansion, which replaces it with two LINE non-terminals. When these two non-terminals are expanded, they are done so independently, and since they have a non-deterministic expansion, will result in different images.
I'm the "m" in "mtree.cfdg"

Tegiri_Nenashi
Posts: 9
Joined: Wed May 14, 2008 12:52 pm

Post by Tegiri_Nenashi »

MtnViewMark wrote:I think your mistake is thinking of these things as variables. They are not.
Hmm, I made this mistake before (in some exersize from Ullman book)! Each variable in the grammar is evaluated to a set of words, but it is more convenient for human to perceive it as being instantiated with a single word at every rule occurrence.
MtnViewMark wrote:This is a direct consequence of the context-free nature of the grammars.
This issue is unrelated to what level of Chomsky's hierarchy we are. The "grammar" part is important.

Anyway, perhaps it is much more straightforward in my example to apply just one affine transform by stretching a square horizontally and shrinking it vertically, than to rely on intricacies of recursion cutoff implemetation...

Post Reply