POV-Ray : Newsgroups : povray.programming : POV-Ray v.4 proposal Server Time
29 Jul 2024 02:21:51 EDT (-0400)
  POV-Ray v.4 proposal (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Ron Parker
Subject: Re: POV-Ray v.4 proposal
Date: 17 May 1999 11:38:18
Message: <374029da.0@news.povray.org>
On Mon, 17 May 1999 15:05:20 +0200, Mikael Carneholm wrote:
>It sure does. But you can't union{} a bunch of declarations and affect the
>locations of the declared vectors by putting them inside a union and then
>translate/rotate the whole union.

Um... even if there were a "point" object, it would be a huge change to
have POV modify the #declared version (the prototype) when an instantiation 
of it is transformed.  If you did do that, the next thing you'd have is 
people doing this:

  #declare MySphere=sphere {0 1}
  union { MySphere sphere {x,1} translate 2*x pigment{color red 1}}
  object {MySphere translate y pigment {color green 1}}

and then wondering why the green sphere is at <0,1,0> instead of
<2,1,0>.


Post a reply to this message

From: J  Grimbert
Subject: Re: POV-Ray v.4 proposal
Date: 17 May 1999 12:12:55
Message: <374031EC.1028B8A1@atos-group.com>
Mikael Carneholm wrote:
> 
> "J. Grimbert" wrote:
> 
> > You will still have to duplicate the transformation (once for the
> > objects,
> > and once for the array), but that would be better than now.
> >
> 
> Nope - just one transformation for the whole union:
> union{
>   SpaceShip
>   lots of points
>   rotate some
>   translate some
> }
As I stated earlier, you would be misusing (abusing ?) the Union.
BTW, why not a Merge ? or any other CSG ?
IMHO, union is only a CSG, using it for something else is not good.

Moreover, Ron Parker wrote:
=>
=> Um... even if there were a "point" object, it would be a huge change
to
=> have POV modify the #declared version (the prototype) when an
instantiation 
=> of it is transformed.  If you did do that, the next thing you'd have
is 
=>people doing this:

=>  #declare MySphere=sphere {0 1}
=>  union { MySphere sphere {x,1} translate 2*x pigment{color red 1}}
=>  object {MySphere translate y pigment {color green 1}}

=> and then wondering why the green sphere is at <0,1,0> instead of
=> <2,1,0>.




> 
> Note: I'm sure there are other situations where this objects(primitive?) could be
> useful. Just waiting for other users to reply and say they want it too :)
> 

I would keep with my idea of array functions. It would be easily done
(as soon as I can get a working source of 3.1e installed, I will 
have a look at the parser to add the three functions... 
and dig a little in the array thing...
yet another floating patch... How can it be officially integrated ?)

BTW, have somebody any better idea for the name than
arotate/ascale/atranslate ?
(better ask now than do it and have to change it later ...)


Post a reply to this message

From: Mike
Subject: Re: POV-Ray v.4 proposal
Date: 17 May 1999 14:43:04
Message: <37405399.7C412E33@aol.com>
Come to think of it, trim curves might be nice for bicubic patches or for
NURBS if they are ever implemented.

-Mike

> I guess you would then ask for a line (straight)
> and then some more complicated lines (bezier in a plane, total free in
> 3d space)


Post a reply to this message

From: Chris Huff
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 08:50:18
Message: <374154C1.7C720B98@compuserve.com>
How about a "points" attribute for objects?

sphere {  <1,5,7>, 6
    texture stuff
    interior stuff
    points {
        #declare pointA = < 1,1,8>;
        ...
    }
}
The vectors declared in the points {...} attribute would be accessible
like any other vectors, I'm sure there would be some way of having them
be accessed through the object itself, but that would require that each
object be named.
You could use any object, with this, and avoid invisible primitives.


Post a reply to this message

From: Margus Ramst
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 12:02:30
Message: <37418106.0@news.povray.org>
This would be trivial to implement with macros. Especially when (if) the
Superpatch's #ifdef(Array[Elem]) function makes it into the official
version. Until then the size of the array would need to be specified.
For example, array rotate:

#macro ARot(Array,ArraySize,RotVect)
    #local C=0;
    #local NewArray=array[ArraySize]
    #while(C<ArraySize)
        #local NewArray[C]=vrotate(Array[C],RotVect);
        #local C=C+1;
   #end
   NewArray
#end

#declare Array1=array[N]{...}
#declare Array2=ARot(Array1,N,<XRot,YRot,ZRot>)

Margus

J. Grimbert wrote in message <3740210A.4E1BDC0E@atos-group.com>...
>
>What is needed is probably more something like array operator.
>After all, pov have :
> rotate and translate for objects
> vrotate and + for vectors
>
>We may probably get a nice enhancement with something like
> arotate and atranslate for array of vector
>
>#declare new_array = arotate(old_array, B );
>
>and
>#declare new_array = atranslate(old_array, B);
>
>BTW, we could also need some scaling:
>#declare new_array = ascale(old_array, B);
>


Post a reply to this message

From: Ron Parker
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 13:23:46
Message: <37419412.0@news.povray.org>
On Tue, 18 May 1999 17:59:48 +0300, Margus Ramst wrote:
>This would be trivial to implement with macros. Especially when (if) the
>Superpatch's #ifdef(Array[Elem]) function makes it into the official
>version. Until then the size of the array would need to be specified.

No need for the #ifdef patch.  In fact, it will fail if you try to
access past the end of the array anyway.  What you need is this, 
from the official POV 3.1:

  dimension_size( ARRAY_IDENTIFIER, FLOAT ) Returns the size of a given 
  dimension of a previously declared array identifier. Dimensions are 
  numbered left-to-right starting with 1. For example if you do 
  #declare MyArray=array[6][10] then dimension_size(MyArray,2) returns 
  the value 10. 

and your macro becomes:

#macro ARot(Array,RotVect)
    #local C=dimension_size(Array,1);
    #local NewArray=array[C]
    #while(C>0)
        #local C=C-1;
        #local NewArray[C]=vrotate(Array[C],RotVect);
   #end
   NewArray
#end

or, to transform an array "in place":

#macro AInPlaceRot(Array,RotVect)
    #local C=dimension_size(Array,1);
    #while(C>0)
        #local C=C-1;
        #declare Array[C]=vrotate(Array[C],RotVect);
   #end
#end


Post a reply to this message

From: Mikael Carneholm
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 14:28:06
Message: <3741A280.8BF5059D@ida.utb.hb.se>
Ron Parker wrote:

> No need for the #ifdef patch.

What if you do this:

#declare MyArray=array[3]
#declare MyArray[0]="A"
#declare MyArray[2]="C"

How do you check if MyArray[1] is declared...?

- Mikael.

-----------------------------------------------------------------
Mikael Carneholm
Dep. of Computer Science


http://www.studenter.hb.se/~arch
E-mail: sa9### [at] idautbhbse


Post a reply to this message

From: Ron Parker
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 14:39:10
Message: <3741a5be.0@news.povray.org>
On Tue, 18 May 1999 19:25:20 +0200, Mikael Carneholm wrote:
>Ron Parker wrote:
>
>> No need for the #ifdef patch.
>
>What if you do this:
>
>#declare MyArray=array[3]
>#declare MyArray[0]="A"
>#declare MyArray[2]="C"
>
>How do you check if MyArray[1] is declared...?

More importantly, how do you check if MyArray[0] is a vector?
I'm not saying it wouldn't help, but you don't need it just
to get the array size, as you seemed to imply.


Post a reply to this message

From: Margus Ramst
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 19:45:54
Message: <3741eda2.0@news.povray.org>
Hell and damnation!!!! I could swear I read all about float functions and
arrays, and never did I see these functions. Now they're there. To think how
much trouble this would've saved me in the past...
Oh well, thank you for pointing it out.

Margus

Ron Parker wrote in message <37419412.0@news.povray.org>...
>
>No need for the #ifdef patch.  In fact, it will fail if you try to
>access past the end of the array anyway.  What you need is this,
>from the official POV 3.1:
>
>  dimension_size( ARRAY_IDENTIFIER, FLOAT ) Returns the size of a given
>  dimension of a previously declared array identifier. Dimensions are
>  numbered left-to-right starting with 1. For example if you do
>  #declare MyArray=array[6][10] then dimension_size(MyArray,2) returns
>  the value 10.
>


Post a reply to this message

From: Margus Ramst
Subject: Re: POV-Ray v.4 proposal
Date: 18 May 1999 19:57:13
Message: <3741f049.0@news.povray.org>
To put things straight, #ifdef was my suggestion. I now see that it really
isn't necessary.
It should be up to the user to know that the manipulated array contains
vectors. Or values could be forced to vectors in the macro (value+<0,0,0> or
something similar).
Right now I can't think of a common situation where an intermittent array
element would be missing (it has never happened in the procedures I use with
arrays). But #ifdef could be used as a check here.

Margus

Ron Parker wrote in message <3741a5be.0@news.povray.org>...
>On Tue, 18 May 1999 19:25:20 +0200, Mikael Carneholm wrote:
>>Ron Parker wrote:
>>
>>> No need for the #ifdef patch.
>>
>>What if you do this:
>>
>>#declare MyArray=array[3]
>>#declare MyArray[0]="A"
>>#declare MyArray[2]="C"
>>
>>How do you check if MyArray[1] is declared...?
>
>More importantly, how do you check if MyArray[0] is a vector?
>I'm not saying it wouldn't help, but you don't need it just
>to get the array size, as you seemed to imply.


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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