POV-Ray : Newsgroups : povray.newusers : User-defined vector functions Server Time
24 Nov 2024 10:31:19 EST (-0500)
  User-defined vector functions (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Mathuin
Subject: User-defined vector functions
Date: 5 Oct 2008 12:50:00
Message: <web.48e8ef33ae5e4190d8a103ef0@news.povray.org>
I used to think I knew more about POV-Ray than I apparently do.  Either that, or
this new project is introducing me to new corners of SDL and other interesting
things.

I find myself making sets of user-defined float functions because I can't figure
out how to make a user-defined vector function.  I end up with stuff like this:

#declare LocX = function(x) { x + 1 }
#declare LocY = function(y) { y * 2 }
#declare LocZ = function(z) { z / 3 }

I'd *much* rather have this:

#declare LocXYZ = function(x, y, z) { <x + 1, y * 2, z / 3> }

Any chance there's an easy way to do this?  Will I have to use a macro?


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: User-defined vector functions
Date: 5 Oct 2008 13:20:47
Message: <48e8f76f$1@news.povray.org>
Mathuin wrote:
> I used to think I knew more about POV-Ray than I apparently do.  Either that, or
> this new project is introducing me to new corners of SDL and other interesting
> things.
> 
> I find myself making sets of user-defined float functions because I can't figure
> out how to make a user-defined vector function.  I end up with stuff like this:
> 
> #declare LocX = function(x) { x + 1 }
> #declare LocY = function(y) { y * 2 }
> #declare LocZ = function(z) { z / 3 }
> 
> I'd *much* rather have this:
> 
> #declare LocXYZ = function(x, y, z) { <x + 1, y * 2, z / 3> }
> 
> Any chance there's an easy way to do this?  Will I have to use a macro?

Judging from your previous posts, you seem to have some serious 
misconceptions about the use(fulness) of functions. You may want to review 
the documentation to learn more about macros.

	Thorsten


Post a reply to this message

From: andrel
Subject: Re: User-defined vector functions
Date: 5 Oct 2008 14:28:22
Message: <48E90794.2050602@hotmail.com>
On 05-Oct-08 19:20, Thorsten Froehlich wrote:
> Mathuin wrote:
>> I used to think I knew more about POV-Ray than I apparently do.  
>> Either that, or
>> this new project is introducing me to new corners of SDL and other 
>> interesting
>> things.
>>
>> I find myself making sets of user-defined float functions because I 
>> can't figure
>> out how to make a user-defined vector function.  I end up with stuff 
>> like this:
>>
>> #declare LocX = function(x) { x + 1 }
>> #declare LocY = function(y) { y * 2 }
>> #declare LocZ = function(z) { z / 3 }
>>
>> I'd *much* rather have this:
>>
>> #declare LocXYZ = function(x, y, z) { <x + 1, y * 2, z / 3> }
>>
>> Any chance there's an easy way to do this?  Will I have to use a macro?
> 
> Judging from your previous posts, you seem to have some serious 
> misconceptions about the use(fulness) of functions. You may want to 
> review the documentation to learn more about macros.

So your answers are: no and yes in that order? If so, why don't you just 
tell him that and perhaps explain when to use and not to use macros and 
functions? This is povray.newusers you know.

Anyway, there is apparently a feeling on what would be a logical 
approach. There may be reasons why it is hard to implement now. Yet, 
this kind of information is very important when designing POV4. If you 
had though about it, you would have realized that povray.newusers is a 
goldmine to find out how to change SDL4 to be more in line of what 
'naive' people are expecting.

I know your style and I realise that you probably do not mean to sound 
so arrogant and hostile. Newusers on the other hand may be scared away 
from asking questions because of you. Even though most people here are 
actually very friendly and helpful.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: User-defined vector functions
Date: 5 Oct 2008 16:49:50
Message: <48e9286e$1@news.povray.org>
andrel wrote:
> If so, why don't you just
> tell him that and perhaps explain when to use and not to use macros and 
> functions? This is povray.newusers you know.

Yes, but this topic is huge and well covered in the docs, so starting there 
is a very good idea for any new user ;-)

	Thorsten


Post a reply to this message

From: Stephen
Subject: Re: User-defined vector functions
Date: 5 Oct 2008 17:30:34
Message: <1dcie4td34d95fg7nhr2oge4a46sn1iuld@4ax.com>
On Sun, 05 Oct 2008 22:49:54 +0200, Thorsten Froehlich <tho### [at] trfde> wrote:

>andrel wrote:
>> If so, why don't you just
>> tell him that and perhaps explain when to use and not to use macros and 
>> functions? This is povray.newusers you know.
>
>Yes, but this topic is huge and well covered in the docs, so starting there 
>is a very good idea for any new user ;-)
>

Even if it is well covered in the docs a few hints and examples from someone who
knows how to do it is worth a lot. It is said that "a picture is worth a
thousand words". Or in this case an example is worth a thousand words ;)
I would if I could but I can't so I don't. :)
And RTFM is so bad mannered, especially in povray.newusers. The manual is
information dense and it can be difficult to find what you need or to know that
you have found it when you do.
-- 

Regards
     Stephen


Post a reply to this message

From: andrel
Subject: Re: User-defined vector functions
Date: 5 Oct 2008 17:45:32
Message: <48E935CA.80902@hotmail.com>
On 05-Oct-08 22:49, Thorsten Froehlich wrote:
> andrel wrote:
>> If so, why don't you just
>> tell him that and perhaps explain when to use and not to use macros 
>> and functions? This is povray.newusers you know.
> 
> Yes, but this topic is huge and well covered in the docs, so starting 
> there is a very good idea for any new user ;-)
> 

I know, but docs are only good if you know what to look for. For an 
average person it may take weeks or months to get a feeling for what a 
program does and what you may have to look for in the documentation.
Small example from p.o-t: somebody referred to the ??( and ??) as 
alternatives for [ and ]. I tried to find that with google and failed. I 
am guessing because of not indexing punctuation. You need to know that 
these things are called trigraphs to find them. Second example: what 
does p.o-t stands for? If you know it is obvious, otherwise you won't 
find out until *someone* tells you. (newsgroup povray.off-topic is the 
answer in case anyone still wonders ;) ).

I haven't looked into the docs for macros and functions recently (and if 
I did I would not be able to judge anymore anyway), but if they behave 
like ordinary docs, you can not read them unless you know what is in 
there. Mathuin first posted in this group 3 days ago. In general people 
wait for at least one or two weeks before posting, so I guess he* 
discovered POV about 2-3 weeks ago. There will be a lot of trivial 
things he does not know yet, like reading the examples in the source 
directories and looking in p.t.s-f and p.t.t for inspiration. You can 
blame him for not knowing these things, you can blame him for not even 
trying, but that is simply not fair. Friendly point him in the right 
direction and he'll study the docs before asking the next question and 
he'll be back within two months with a stunning picture. Attack his lack 
of knowledge and he won't come back ever again because he'll get the 
impression that POV is too difficult for him. We don't want that, do we?

* or she


Post a reply to this message

From: Mathuin
Subject: Re: User-defined vector functions
Date: 6 Oct 2008 21:55:01
Message: <web.48eac00c17cb998cd8a103ef0@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> andrel wrote:
> > If so, why don't you just
> > tell him that and perhaps explain when to use and not to use macros and
> > functions? This is povray.newusers you know.
>
> Yes, but this topic is huge and well covered in the docs, so starting there
> is a very good idea for any new user ;-)
>
>  Thorsten

This isn't quite as bad as telling someone use the dictionary to find the
correct spelling of a word, but it was close.  I did look at macros (my
original message pointed out that I thought they might be the right solution)
but I wasn't sure and that's why I asked here.  I had previously used macros as
a way to replace repetitive bits of code and functions as a way to perform
repetitive calculations as that's how I've used them in other languages.  After
tinkering with macros I was able to solve this particular problem and now I
realize that I can do a lot with macros that I can't do with functions.

I have another problem/annoyance/what-have-you but that deserves its own thread
if I can't find the answer in the newuser archives.


Post a reply to this message

From: Reactor
Subject: Re: User-defined vector functions
Date: 7 Oct 2008 01:55:00
Message: <web.48eaf96a17cb998c3639c5980@news.povray.org>
"Mathuin" <mat### [at] gmailcom> wrote:
> I used to think I knew more about POV-Ray than I apparently do.  Either that, or
> this new project is introducing me to new corners of SDL and other interesting
> things.
>
> I find myself making sets of user-defined float functions because I can't figure
> out how to make a user-defined vector function.  I end up with stuff like this:
>
> #declare LocX = function(x) { x + 1 }
> #declare LocY = function(y) { y * 2 }
> #declare LocZ = function(z) { z / 3 }
>
> I'd *much* rather have this:
>
> #declare LocXYZ = function(x, y, z) { <x + 1, y * 2, z / 3> }
>
> Any chance there's an easy way to do this?  Will I have to use a macro?


I tend to use functions only for pigments, isosurfaces, and the like.  If you
are using a vector function, then I presume you are describing a position/path,
color, etc.  Both splines and macros are better suited for this in my opinion,
splines if you have a series of points to pass through, macros if you have a
set function (or functions).

Remember that a function of three variables as you have listed will generate a
surface/solid, whereas it seems that you are looking for a single vector at a
given value for the independent variable t (or whatever you use).

-Reactor


Post a reply to this message

From: Trevor G Quayle
Subject: Re: User-defined vector functions
Date: 7 Oct 2008 11:25:00
Message: <web.48eb7f1617cb998c81c811d20@news.povray.org>
"Mathuin" <mat### [at] gmailcom> wrote:
> I used to think I knew more about POV-Ray than I apparently do.  Either that, or
> this new project is introducing me to new corners of SDL and other interesting
> things.
>
> I find myself making sets of user-defined float functions because I can't figure
> out how to make a user-defined vector function.  I end up with stuff like this:
>
> #declare LocX = function(x) { x + 1 }
> #declare LocY = function(y) { y * 2 }
> #declare LocZ = function(z) { z / 3 }
>
> I'd *much* rather have this:
>
> #declare LocXYZ = function(x, y, z) { <x + 1, y * 2, z / 3> }
>
> Any chance there's an easy way to do this?  Will I have to use a macro?

A macro is best suited for this:

#macro LocXYZ (x0,y0,z0)
  #local x1=x0+1;
  #local y1=y0*2;
  #local z1=z0/3;
  <x1,y1,z1>
#end

evaluate using:

#declare A=LocXYZ(1,2,3);


-tgq


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: User-defined vector functions
Date: 8 Oct 2008 13:32:31
Message: <48eceeaf@news.povray.org>
Stephen wrote:
> And RTFM is so bad mannered, 

My post was no RTFM. But I guess you just want to flame me, so by all means, 
have your fun - assholes.

	Thorsten


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.