|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
I have some problems in understanding the function of SDL and want help.
The problems are illustrated by examples stated below.
Examples:
(1) It's a function that works properly to define a sphere with a given
radius .
#declare fun1 = function(x,y,z,r){
x*x + y*y + z*z - r*r
}
It gives me an understanding that:
<1> (x,y,z) are coordinates of a point in scene space
<2> x,y,z,r are all floats
Is that right???
(2) It's a function that use x as a float value in a conditional
statement, but it canna pass parsing
#declare fun2 = function(x,y,z,r){
#if (x>0)
x*x + y*y + z*z - r*r
#end
}
In this function, i want use x to do a conditional comparison, but pov
will give an error "Float expected but vector or color expression found". I
canna understand why x becomes into a vector here whilist x works like a
float value in fun1().
And if i modify "#if (x>0)" to "#if (x.x > 0)", the x.x will always be 1.
That means the x is the system-defined vector <1,0,0> but not a parameter.
I'm confused.
(3)
#declare fun3 = function(x,y,z,r){
#if (r>0)
x*x + y*y + z*z - r*r
#end
}
Running it, the pov will say error "Expected numeric expression.
undefined identifier 'r'".
Is there a way in SDL to pass parameters to a function like the common
programm language such as c++?
I know SDL is just a description language that canna have the power like
programming language. but in my scene, i need use coordinates of points in
scene space to do conditional comparison in the function of iso-surface,
like in fun2(). How should i do? Any help will be appreciated
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
you cannot use macro (#if is macro) inside function the way you want
to do it (different namespace: x in function space is not the same
as the x in macro/SDL space). See 2.2.1.6.2 in
http://www.povray.org/documentation/view/3.6.1/231/
If you want to limit to x>0, use the contained_by { box {
<0,-1,-1>,<1,1,1> } in the isosurface object.
--
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le Forgeron <jgr### [at] freefr> wrote:
> you cannot use macro (#if is macro) inside function the way you want
> to do it (different namespace: x in function space is not the same
> as the x in macro/SDL space). See 2.2.1.6.2 in
>
> http://www.povray.org/documentation/view/3.6.1/231/
>
> If you want to limit to x>0, use the contained_by { box {
> <0,-1,-1>,<1,1,1> } in the isosurface object.
>
>
> --
> The superior man understands what is right;
> the inferior man understands what will sell.
> -- Confucius
Forgeron,
Thanks for your advice. Now i got the difference of function space and SDL
space. But i still have problem in implementing function in SDL for my
isosurface.
In my scene, the isosurface is defined by implicit polynomials in terms of
b-spline basis. And the function evaluation needs the branches that depend
on coordinates of point in 3D scene space, e.g. the parameters passed to
the function. I've read many examples for definition of isosurface
functions in SDL, found that they all only the combination of basic
operations(e.g. +,-,*,/,power etc) but without the logic operations(Aand,
Or..).
So can i implement logic operations in function that will take affect in
rendering time but not parsing time? If can do it in function space, how
should i do?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
wwyang wrote:
> Hi,
> I have some problems in understanding the function of SDL and want help.
> The problems are illustrated by examples stated below.
This is the wrong group for this question. This group is for discussion of
the POV-Ray source code, not general questions of using POV-Ray. Questions
about using POV-Ray should be asked/made in either povray.general or
povray.newusers.
Thorsten, POV-Team
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
This is the wrong group for this question. This question seems to fit into
the povray.advanced-users group rather well. Cross-posting and follow-up
set to povray.advanced-users .
Thorsten, POV-Team
wwyang wrote:
> > Le Forgeron <jgr### [at] freefr> wrote:
>> >> you cannot use macro (#if is macro) inside function the way you want
>> >> to do it (different namespace: x in function space is not the same
>> >> as the x in macro/SDL space). See 2.2.1.6.2 in
>> >>
>> >> http://www.povray.org/documentation/view/3.6.1/231/
>> >>
>> >> If you want to limit to x>0, use the contained_by { box {
>> >> <0,-1,-1>,<1,1,1> } in the isosurface object.
>> >>
>> >>
>> >> --
>> >> The superior man understands what is right;
>> >> the inferior man understands what will sell.
>> >> -- Confucius
> >
> >
> >
> > Forgeron,
> > Thanks for your advice. Now i got the difference of function space and SDL
> > space. But i still have problem in implementing function in SDL for my
> > isosurface.
> >
> > In my scene, the isosurface is defined by implicit polynomials in terms of
> > b-spline basis. And the function evaluation needs the branches that depend
> > on coordinates of point in 3D scene space, e.g. the parameters passed to
> > the function. I've read many examples for definition of isosurface
> > functions in SDL, found that they all only the combination of basic
> > operations(e.g. +,-,*,/,power etc) but without the logic operations(Aand,
> > Or..).
> >
> > So can i implement logic operations in function that will take affect in
> > rendering time but not parsing time? If can do it in function space, how
> > should i do?
> >
> >
> >
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|