 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I'm trying to make random rotation of random placed box.... the random
fonction works with" translate" but rotate doesn't seem to work... why ?
The code :
// Essai sur les macros...
#declare kub = box {<-0.1, -0.1, -0.1><0.1, 0.1, 0.1>
texture {
pigment {color rgb <0.5, 0.0, 0.5>}
finish {ambient 0.3
diffuse 0.5
reflection {0.0, 1 fresnel on}}
}
}
light_source {
<10, 5, -10>
color rgb 1
}
// 360° random rotating
#declare R1 = seed(360);
// 1 unit random moving
#declare R3 = seed(1);
#declare i = 0;
#while (i < 2001)
object {kub translate <rand(R3), rand(R3), rand(R3)> rotate <rand(R1),
rand(R1), rand(R1)>}
#declare i = i + 1;
#end
camera {
location <3, 0, 0>
look_at <0, 0, 0>
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
_Light_Beam_ wrote:
>
> I'm trying to make random rotation of random placed box.... the random
> fonction works with" translate" but rotate doesn't seem to work... why ?
What exactly do you mean by "does not work"?
Remember, rotations always occur around <0,0,0>
Markus
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 6 Mar 2002 13:21:41 +0100, "_Light_Beam_" <fac### [at] aol com> wrote:
> // 360� random rotating
> #declare R1 = seed(360);
Parameter of seed has nothing to do with angle.
360 should be placed here:
> rotate <rand(R1),>rand(R1), rand(R1)>}
rotate 360*<rand(R1),rand(R1), rand(R1)>
ABX
--
disc{z,-z 5#macro O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
e=e-1;#end#local e=26;pigment{#local g=function(_){ceil(_)-_}function#local//X
k=function{pattern{object{sphere_sweep{linear_spline 13#while(e>0)<O(),O()//AB
>.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi,
seed is just an initialisation of the random-number-generator.
to create a random number use following structure:
#local R1 = seed(45345);
// the number has no further meaning. you may use anything
// note that different randoms generated from the same seed value, produce
synchronously the same numbers
#local random = rand(R1);
// this is the actual random number
// to rotate something you may use:
// rotate <rand(R1), rand(R1), rand(R1)>
regards
SY
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
rand produces numbers between 0 and 1 so you are basically rotating between
0 and 1 degree.
Try this:
rotate<rand(R1)*360, rand(R1)*360, rand(R1)*360>
"_Light_Beam_" <fac### [at] aol com> wrote in message
news:3c860998@news.povray.org...
> I'm trying to make random rotation of random placed box.... the random
> fonction works with" translate" but rotate doesn't seem to work... why ?
> The code :
>
> // Essai sur les macros...
>
> #declare kub = box {<-0.1, -0.1, -0.1><0.1, 0.1, 0.1>
> texture {
> pigment {color rgb <0.5, 0.0, 0.5>}
> finish {ambient 0.3
> diffuse 0.5
> reflection {0.0, 1 fresnel on}}
> }
> }
>
> light_source {
> <10, 5, -10>
> color rgb 1
> }
>
> // 360° random rotating
> #declare R1 = seed(360);
> // 1 unit random moving
> #declare R3 = seed(1);
>
> #declare i = 0;
> #while (i < 2001)
> object {kub translate <rand(R3), rand(R3), rand(R3)> rotate <rand(R1),
> rand(R1), rand(R1)>}
> #declare i = i + 1;
> #end
>
> camera {
> location <3, 0, 0>
> look_at <0, 0, 0>
> }
>
>
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi again,
> // to rotate something you may use:
> // rotate <rand(R1), rand(R1), rand(R1)>
Errr.. I forgot: rand returns a float in range of 0..1, so you should rather
use
> // rotate <360*rand(R1), 360*rand(R1), 360*rand(R1)>
Sorry.
regards
SY
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3c870d96$1@news.povray.org>,
"Jürgen Scharfy" <sch### [at] surfeu at> wrote:
> > // to rotate something you may use:
> > // rotate <rand(R1), rand(R1), rand(R1)>
>
> Errr.. I forgot: rand returns a float in range of 0..1, so you should rather
> use
>
> > // rotate <360*rand(R1), 360*rand(R1), 360*rand(R1)>
Or even better:
rotate 360*< rand(R1), rand(R1), rand(R1)>
--
Christopher James Huff <chr### [at] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Christopher James Huff <chr### [at] mac com> wrote:
>> > // rotate <360*rand(R1), 360*rand(R1), 360*rand(R1)>
> Or even better:
> rotate 360*< rand(R1), rand(R1), rand(R1)>
Note that this does not achieve *any* possible orientation the object can
have. For example, I think that it can never reach an orientation like
caused by
rotate y*30 rotate x*30
In order to really achieve almost any possible orientation, that random
rotation should be applied several times. Perhaps even a random number of
times. For example:
#declare RotTimes = 5+5*rand(R1); // from 5 to 10 times.
#declare Ind = 0;
#while(Ind < RotTimes)
rotate 360*<rand(R1),rand(R1),rand(R1)>
#declare Ind = Ind+1;
#end
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3c879ab8@news.povray.org>, Warp <war### [at] tag povray org>
wrote:
> In order to really achieve almost any possible orientation, that random
> rotation should be applied several times. Perhaps even a random number of
> times. For example:
I think a better way would just be to generate a random point on the
surface of a sphere (using VRandOnSphere()) and use the PointAtTrans()
macro. Probably should rotate by a random amount around the y axis first.
--
Christopher James Huff <chr### [at] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Note that this does not achieve *any* possible orientation the object
can
> have. For example, I think that it can never reach an orientation like
> caused by
> rotate y*30 rotate x*30
>
> In order to really achieve almost any possible orientation, that random
> rotation should be applied several times. Perhaps even a random number of
> times.
I believe all orientations are covered by just
rotate 360*<rand(R1),rand(R2),rand(R3)>
I'm pretty sure that takes care of all orientations. Whether or not they're
all equally likely is another question.
(Here's why I think that covers everything. Just the point <1,0,0> around
the y axis and then around the z axis randomly gives it the possibility of
pointing in any possible direction. If you're working with an object, and
you rotate it around the x axis, you sort of spin it in any possible
orientation. Then rotating it around the y and z axis like you did with the
point makes it point in a random direction.)
- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Slime <noo### [at] hotmail com> wrote:
> I believe all orientations are covered by just
> rotate 360*<rand(R1),rand(R2),rand(R3)>
So give me a "rotate <A,B,C>" command which, when replacing the two rotates
with it in the scene below, will give the exact same image:
camera { location <1,2,-3> look_at y*.5 angle 35 }
light_source { <100,250,-50>, 1 }
plane { y,0 pigment { checker rgb 1, rgb .5 } }
#declare Object =
intersection
{ cone { 0,.5, y,.2 }
box { <-.5,-.01,0><.5,1.01,.5> }
pigment { rgb x+y }
}
object
{ Object
rotate y*45 rotate x*45
}
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
>
> So give me a "rotate <A,B,C>" command which, when replacing the two rotates
> with it in the scene below, will give the exact same image:
>
> rotate y*45 rotate x*45
I believe this is close enough. Don't have time to calculate
the exact transform.
rotate<53,30,35>
_____________
Kari Kivisalo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kari Kivisalo <ray### [at] engineer com> wrote:
> rotate<53,30,35>
I didn't think of it that way.
Is any combination of free rotates achievable with a rotate <A,B,C>?
Somehow it's very hard to grasp.
Some kind of intuitive, graphical or mathematical proof could help.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
>
> Is any combination of free rotates achievable with a rotate <A,B,C>?
I think it was Euler who proved that any orientation in space could be
represented by a single rotation about an arbitrary axis, and that this
rotation is equivalent to three successive rotations about the x, y and
z axes.
_____________
Kari Kivisalo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kari Kivisalo <ray### [at] engineer com> wrote:
> I think it was Euler who proved that any orientation in space could be
> represented by a single rotation about an arbitrary axis
That's even more radical!
But thinking hard about it, it starts to be intuitive...
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
let me summarize this please, to understand this ...
We proved Warp, to be wrong ?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Jan Walzer <jan### [at] lzer net> wrote:
> We proved Warp, to be wrong ?
So?
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Jan Walzer wrote:
>
> We proved Warp, to be wrong ?
But it was educational. It was the 1st time I tried in practice
an abstract piece of information learned long time ago. If Warp
hadn't asked the question I wouldn't have learned that arbitrary
orientation can be also defined as x y x rotation. When building
a robot this might be good to know :)
_____________
Kari Kivisalo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |