POV-Ray : Newsgroups : povray.unofficial.patches : Something fresh - symetry operator patch Server Time
20 Jul 2024 18:53:18 EDT (-0400)
  Something fresh - symetry operator patch (Message 1 to 10 of 19)  
Goto Latest 10 Messages Next 9 Messages >>>
From: Wlodzimierz ABX Skiba
Subject: Something fresh - symetry operator patch
Date: 10 May 2001 12:53:49
Message: <3afac79d@news.povray.org>
I've created simple addition to expressions - vector symmetry operator "@".

Syntax
  Vector @ SymmetryRefference
  SymmetryRefference : Vector | ox | oy | oz | xy | xz | yz

Instead of explanation just examples of usage and old equivalents

#local A=<7,3,4>;
#local B=A@xy; /* B=<A.x,A.y,-A.z> */
#local B=A@xz; /* B=<A.x,-A.y,A.z> */
#local B=A@yz; /* B=<-A.x,A.y,A.z> */
#local B=A@ox; /* B=<A.x,-A.y,-A.z> */
#local B=A@oy; /* B=<-A.x,A.y,-A.z> */
#local B=A@oz; /* B=<-A.x,-A.y,A.z> */
#local B=A@0; /* B=<-A.x,-A.y,-A.z> */
#local B=A@A; /* B=A */
#local B=A@(A-1) /* B=A-2 */

if there is any person interested in source to this patch I can upload it on
this news server.

--
#macro Sig(A,B,X)_(A,B)_(B,X)_(X,A)#end#macro _(A,B)cylinder{<A.x,A.y,3>,<B.u,
B.v,3>.1,9}#end global_settings{max_trace_level 9}light_source{0 1}camera{up y
*4right-3*x}blob{_(<3,1>,<1,-5>)_(<2,-2>,<4,-2>)Sig(x,<-1,1.5>,<1,3>)_(z-1,z-4
)pigment{rgb 1}}box{-3 3pigment{rgb 0}finish{reflection 1}hollow} // POV-Ray31


Post a reply to this message

From: Ron Parker
Subject: Re: Something fresh - symetry operator patch
Date: 10 May 2001 13:07:12
Message: <slrn9flim2.khs.ron.parker@fwi.com>
On Thu, 10 May 2001 18:52:57 +0200, Wlodzimierz ABX Skiba wrote:
>I've created simple addition to expressions - vector symmetry operator "@".
>
>Syntax
>  Vector @ SymmetryRefference
>  SymmetryRefference : Vector | ox | oy | oz | xy | xz | yz
>
>Instead of explanation just examples of usage and old equivalents

Why a patch and not a macro?  

#macro VecSym(Vec, Sym)
  (vlength(Sym)?(2*vdot(Vec,Sym)/vlength(Sym)*Sym-Vec):(-Vec))
#end

Then you give it x instead of ox, y instead of oy, etc. and 
x+y instead of xy etc. 

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 03:05:48
Message: <3afb8f4c$1@news.povray.org>
Ron Parker wrote in message ...
> On Thu, 10 May 2001 18:52:57 +0200, Wlodzimierz ABX Skiba wrote:
> >I've created simple addition to expressions - vector symmetry operator "@".
> >
> >Syntax
> >  Vector @ SymmetryRefference
> >  SymmetryRefference : Vector | ox | oy | oz | xy | xz | yz
>
> Why a patch and not a macro?
>
> #macro VecSym(Vec, Sym)
>  (vlength(Sym)?(2*vdot(Vec,Sym)/vlength(Sym)*Sym-Vec):(-Vec))
> #end
>
> Then you give it x instead of ox, y instead of oy, etc. and
> x+y instead of xy etc.


x and x+y has meaning of vectors in POV (center of symetry)
ox is not <1,0,0> but axis x
xy is not <1,1,0> but plane contained axes x and y
and patch becouse now I'm adding support for plane{}
#local B=A@plane{y 1 rotate C translate z}
than perhaps I remove xy, xz and yz planes

of course all these things are posible with current syntax and macros but it was
inspired by my current work and short sigs it was just too much for me to type
<-A.x,A.y,A.z> to change sign only for one coordinate

perhaps AT_TOKEN is wrong but it is only one free I found
and I wanted avoid ambiguity

--
#macro Sig(A,B,X)_(A,B)_(B,X)_(X,A)#end#macro _(A,B)cylinder{<A.x,A.y,3>,<B.u,
B.v,3>.1,9}#end global_settings{max_trace_level 9}light_source{0 1}camera{up y
*4right-3*x}blob{_(<3,1>,<1,-5>)_(<2,-2>,<4,-2>)Sig(x,<-1,1.5>,<1,3>)_(z-1,z-4
)pigment{rgb 1}}box{-3 3pigment{rgb 0}finish{reflection 1}hollow} // POV-Ray31


Post a reply to this message

From: Chris Huff
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 06:43:21
Message: <3afbc248@news.povray.org>
Wlodzimierz ABX Skiba <abx### [at] abxartpl> wrote:

> of course all these things are posible with current syntax and
> macros but it was inspired by my current work and short sigs it was
> just too much for me to type <-A.x,A.y,A.z> to change sign only for
> one coordinate

Why not A*<-1,1,1>? Or A-2*x*A?


-- 
Christopher James Huff - chr### [at] maccom
Home Page: http://homepage.mac.com/chrishuff/
POV-Ray TAG e-mail: chr### [at] povrayorg
POV-Ray TAG web site: http://tag.povray.org/


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 07:32:59
Message: <3afbcdeb@news.povray.org>
Chris Huff wrote in message <3afbc248@news.povray.org>...
>Wlodzimierz ABX Skiba <abx### [at] abxartpl> wrote:
> > of course all these things are posible with current syntax and
> > macros but it was inspired by my current work and short sigs it was
> > just too much for me to type <-A.x,A.y,A.z> to change sign only for
> > one coordinate
>
> Why not A*<-1,1,1>? Or A-2*x*A?


becouse it is longer than A@yz ;)

as I said I know all kind of symmetry are possible somehow
I just tried (succesfully) collect them to one way

A@0
A@B
A@xy
A@ox
A@plane{y 2 rotate z*30 translate 10}

I don't want pressure to use it. I just offered sharing if anybody find it
usefull.

If any person is also interested I've also added such extension

#local MyArray=array[4][4]{tranform{rotate 10*x translate z}}

which assigns matrix of transformation to array

--
#macro Sig(A,B,X)_(A,B)_(B,X)_(X,A)#end#macro _(A,B)cylinder{<A.x,A.y,3>,<B.u,
B.v,3>.1,9}#end global_settings{max_trace_level 9}light_source{0 1}camera{up y
*4right-3*x}blob{_(<3,1>,<1,-5>)_(<2,-2>,<4,-2>)Sig(x,<-1,1.5>,<1,3>)_(z-1,z-4
)pigment{rgb 1}}box{-3 3pigment{rgb 0}finish{reflection 1}hollow} // POV-Ray31


Post a reply to this message

From: Warp
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 07:48:01
Message: <3afbd171@news.povray.org>
Modifying the POV-Ray source code and thus making a patch can be cool
(I have made that, I know what I'm talking about :) ), but it's important
to be aware of one thing:

  If the exact same functionality can be made with an include file (usually
implemented as a #macro) without noticeable resource penalty (time, memory,
etc) nor compromise in easy-to-use, then the #macro is definitely the
right choice.

  Why?
  If this kind of thing is made by modifying the source code, it will only
cause more trouble than it's worth. It will also limit the functionality of
the new idea a lot.
  Adding new patches to a patch collection (such as MegaPov) or even the
official povray is usually a maintenance nightmare and a lot of work.
  Also the functionality of a patch is extremely fixed, ie. unmodifiable
(at least without having to modify the source code itself).

  A #macro, however, is much more versatile. You not only can use it, but
you can look how it is done, learn from it, modify it for your specific
needs, make your own version of it and so on. A #macro is much easier to
take (just download the include file from a website to your include
directory); you don't have to wait for someone to include it in MegaPov or
whatever. A #macro is also much less likely to have bugs than a patch.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 08:06:51
Message: <3afbd5db@news.povray.org>
Warp wrote in message <3afbd171@news.povray.org>...
> [cut]

I know all adventages of using macros becouse I always carefully read your
posts. Althought I prepared this for myself not for community and just offered
sharing if anybody has the same problem (less typing) like me. I'm not uploaded
this without ask becouse I didn't want "bring noise" to community. Also I coded
this with respect to rules of adding patch learned from MegaPOV source and my
patch could be off by commenting of one #define. Anyway thanks for lesson.

--
#macro Sig(A,B,X)_(A,B)_(B,X)_(X,A)#end#macro _(A,B)cylinder{<A.x,A.y,3>,<B.u,
B.v,3>.1,9}#end global_settings{max_trace_level 9}light_source{0 1}camera{up y
*4right-3*x}blob{_(<3,1>,<1,-5>)_(<2,-2>,<4,-2>)Sig(x,<-1,1.5>,<1,3>)_(z-1,z-4
)pigment{rgb 1}}box{-3 3pigment{rgb 0}finish{reflection 1}hollow} // POV-Ray31


Post a reply to this message

From: Ron Parker
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 08:46:47
Message: <slrn9fnnps.m36.ron.parker@fwi.com>
On Fri, 11 May 2001 09:04:59 +0200, Wlodzimierz ABX Skiba wrote:
>x and x+y has meaning of vectors in POV (center of symetry)
>ox is not <1,0,0> but axis x

But there's no difference.

>xy is not <1,1,0> but plane contained axes x and y

Okay, this part is different.  That would need another macro

>and patch becouse now I'm adding support for plane{}
>#local B=A@plane{y 1 rotate C translate z}

And that macro would happily do this part as well.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: Ron Parker
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 08:48:14
Message: <slrn9fnnsj.m36.ron.parker@fwi.com>
On Fri, 11 May 2001 09:04:59 +0200, Wlodzimierz ABX Skiba wrote:
>inspired by my current work and short sigs it was just too much for me to type
><-A.x,A.y,A.z> to change sign only for one coordinate

Yeah, I thought about making patches to make it easier to make a really short 
sig too, but where's the fun in that?  That's like giving in to the dark side
and using the $ operator.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: Something fresh - symetry operator patch
Date: 11 May 2001 09:00:29
Message: <3afbe26d@news.povray.org>
Ron Parker wrote in message ...
> On Fri, 11 May 2001 09:04:59 +0200, Wlodzimierz ABX Skiba wrote:
> > x and x+y has meaning of vectors in POV (center of symetry)
> > ox is not <1,0,0> but axis x
>
> But there's no difference.

for geometry symmetry it is difference
I wanted translate symmetry from math to syntax
A=<3,2,3> symetry by x (<1,0,0>) -> A'=<-2,-2,-3>
A=<4,2,3> symetry by axis ox -> A'=<4,-2,-3>

> > and patch becouse now I'm adding support for plane{}
> > #local B=A@plane{y 1 rotate C translate z}
>
> And that macro would happily do this part as well.


and it is as easy to understand and code ?

ABX
--
#macro Sig(A,B,X)_(A,B)_(B,X)_(X,A)#end#macro _(A,B)cylinder{<A.x,A.y,3>,<B.u,
B.v,3>.1,9}#end global_settings{max_trace_level 9}light_source{0 1}camera{up y
*4right-3*x}blob{_(<3,1>,<1,-5>)_(<2,-2>,<4,-2>)Sig(x,<-1,1.5>,<1,3>)_(z-1,z-4
)pigment{rgb 1}}box{-3 3pigment{rgb 0}finish{reflection 1}hollow} // POV-Ray31


Post a reply to this message

Goto Latest 10 Messages Next 9 Messages >>>

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