Subject:
|
LDS ver 0.27 - Great News!
|
Newsgroups:
|
lugnet.cad, lugnet.cad.dev
|
Date:
|
Thu, 17 Feb 2000 16:24:43 GMT
|
Viewed:
|
584 times
|
| |
| |
http://home2.swipnet.se/~w-20413/lds/lds.htm
The new version of LDraw Script Compiler has a couple of (IMHO) useful new features:
* 3-D Points can be added, subtracted, and multiplied with each other. (At last, Steve!)
Syntax:
P1 [=] P2 [+ | - | *] P3
Examples:
P1 = P2 + P3
is equal to:
X1=X2+X3
Y1=Y2+Y3
Z1=Z2+Z3
P33 P33 0 -4 0
subtracts 4 from Y33, leaving X33 and Z33 as they are.
P22 Z12 Y12 X12 * 1 1 -1
is equal to:
X22=Z12
Y22=Y12
Z22=X12*-1
* Indirect addresses
Example:
I=5
PRINT X(I+5)
outputs the value of X10
* Parenthesis in math. functions.
This feature came accidently, as a bonus while I made the indirect addresses!
As you may have noticed, LDS cannot handle the hierarchy of maths functions.
A=5*2+1 will be interpreted as A=5*(2+1) = 15 (See the pseudo-code below).
Now, with parentheseis, is is easier to predict the order of the calculations:
A=(5*2)+1 will set A=11
Some pseudo-code to illustrate the reason why LDS interprets without hierarchy considerations.
float interpret(char *inw)
{
float ret;
in func;
if(func) // i e if an operand is encountered
{
(pseudo) extract inw into first_expression - func - the_rest
// where func is a number representing an operand
switch(func)
{
case PLUS:
ret=interpret(first_expression) + interpret(the_rest);
break;
case MINUS:
ret=interpret(first_expression) - interpret(the_rest);
break;
... and so on
}
else // not a function
{
if(!strcmpi(w,"BLACK")) return(0);
if(!strcmpi(w,"BLUE")) return(1);
...
}
return (ret);
}
* And don't forget to download Anders Isaksson's LDS Shell program.
http://user.tninet.se/~hbh828t/dat/ldsshell.zip
Download LDS v0.27 from: http://home2.swipnet.se/~w-20413/lds/lds.htm
If you have any questions, feel free to ask me.
/Tore
|
|
Message has 1 Reply:
9 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|