|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hello,
i have this simple macro :
#macro lineEquation (x1,z1,x2,z2)
#local det = x1-x2;
#if(det=0)
#error "\n\n---\nWarning, the system has no unique
solution.\nProgram stop here\n\n"
#else
#local det_a = z1-z2;
#local det_b = (x1*z2)-(z1*x2);
<det_a/det, det_b/det, 0>
#end
#end
i call this with this syntax :
#declare sidesLines[0][0] =
lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
tangles[0][1].z); // with ';' at the end of the line.
arrays "rectangles" and "sidesLines" are defined in this way :
#declare nbRect=1;
#declare rectangles = array[nbRect][4];
#declare sidesLines = array[nbRect][4];
when i run my script, i get this error :
File Context (5 lines):
#else
#local det_a = z1-z2;
#local det_b = (x1*z2)-(z1*x2);
<det_a/det, det_b/det, 0>
#
Parse Error: All #declares of float, vector, and color require
semi-colon ';' at end if the language version is set to
3.5 or higher. Either add the semi-colon or set the language version to
3.1 or lower.
where is my mistake ?
--
klp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> hello,
>
> i have this simple macro :
>
> #macro lineEquation (x1,z1,x2,z2)
> #local det = x1-x2;
> #if(det=0)
> #error "\n\n---\nWarning, the system has no unique
> solution.\nProgram stop here\n\n"
> #else
> #local det_a = z1-z2;
> #local det_b = (x1*z2)-(z1*x2);
> <det_a/det, det_b/det, 0>
> #end
> #end
>
>
> i call this with this syntax :
>
> #declare sidesLines[0][0] =
> lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
> tangles[0][1].z); // with ';' at the end of the line.
>
>
> arrays "rectangles" and "sidesLines" are defined in this way :
>
> #declare nbRect=1;
> #declare rectangles = array[nbRect][4];
> #declare sidesLines = array[nbRect][4];
>
>
>
> when i run my script, i get this error :
>
> File Context (5 lines):
> #else
> #local det_a = z1-z2;
> #local det_b = (x1*z2)-(z1*x2);
> <det_a/det, det_b/det, 0>
> #
> Parse Error: All #declares of float, vector, and color require
> semi-colon ';' at end if the language version is set to
> 3.5 or higher. Either add the semi-colon or set the language version to
> 3.1 or lower.
>
>
>
> where is my mistake ?
>
Try this:
<det_a/det, det_b/det, 0>;
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <4dbef64e@news.povray.org>, Alain <aze### [at] qwertyorg> wrote:
> Try this:
> <det_a/det, det_b/det, 0>;
already tried...
error is now :
File Context (5 lines):
// --- z = ax + b
// --- line d0 : p0 to p1
#declare sidesLines[0][0] =
lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
tangles[0][1].z);
Parse Error: Expected 'object or directive', ; found instead
--
klp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> hello,
>
> i have this simple macro :
>
> #macro lineEquation (x1,z1,x2,z2) #local det = x1-x2; #if(det=0)
> #error "\n\n---\nWarning, the system has no unique solution.\nProgram
> stop here\n\n" #else #local det_a = z1-z2; #local det_b =
> (x1*z2)-(z1*x2); <det_a/det, det_b/det, 0> #end #end
>
I seem to recall something similar happening to me... I think it was
due to the return value being not declared and inside an "if". Try this:
#macro lineEquation (x1,z1,x2,z2)
#local det = x1-x2;
#if(det=0)
#error "\n\n---\nWarning, the system has no unique
solution.\nProgram stop here\n\n"
#else
#local det_a = z1-z2;
#local det_b = (x1*z2)-(z1*x2);
#local result=<det_a/det, det_b/det, 0>;
#end
result
#end
--
Jaime Vives Piqueres
La Persistencia de la Ignorancia
http://www.ignorancia.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
kurtz le pirate <kur### [at] yahoofr> wrote:
> In article <4dbef64e@news.povray.org>, Alain <aze### [at] qwertyorg> wrote:
>
> > Try this:
> > <det_a/det, det_b/det, 0>;
>
>
> already tried...
>
> error is now :
>
> File Context (5 lines):
> // --- z = ax + b
> // --- line d0 : p0 to p1
> #declare sidesLines[0][0] =
> lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
> tangles[0][1].z);
> Parse Error: Expected 'object or directive', ; found instead
>
>
>
>
> --
> klp
Remove the ';' from this declaration now:
#declare sidesLines[0][0] =
lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
tangles[0][1].z)
It does have something to do with the result being posted inside the #if loop.
The other alternative and what I would see as the cleaner, more correct
alternative, is to move the value outside the #if loop:
#macro lineEquation (x1,z1,x2,z2)
#local det = x1-x2;
#if(det=0)
#error "\n\n---\nWarning, the system has no unique solution.\nProgram stop
here\n\n"
#else
#local det_a = z1-z2;
#local det_b = (x1*z2)-(z1*x2);
#end
<det_a/det, det_b/det, 0>
#end
#declare sidesLines[0][0] = lineEquation(,,,);
-tgq
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 02.05.2011 16:05, schrieb kurtz le pirate:
> i have this simple macro :
>
> #macro lineEquation (x1,z1,x2,z2)
> #local det = x1-x2;
> #if(det=0)
> #error "\n\n---\nWarning, the system has no unique
> solution.\nProgram stop here\n\n"
> #else
> #local det_a = z1-z2;
> #local det_b = (x1*z2)-(z1*x2);
> <det_a/det, det_b/det, 0>
> #end
> #end
For some obscure reasons, POV-Ray has some problems with assigning
macro-generated expressions to variables. Try using:
#macro lineEquation (x1,z1,x2,z2)
#local det = x1-x2;
#if(det=0)
...
#else
#local det_a = z1-z2;
#local det_b = (x1*z2)-(z1*x2);
#local result = <det_a/det, det_b/det, 0>;
result
#end
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|