POV-Ray : Newsgroups : povray.general : Place and orient objects along spline Server Time
21 May 2024 10:16:56 EDT (-0400)
  Place and orient objects along spline (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Andrew Cocker
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 06:59:28
Message: <3d773910@news.povray.org>
Many thanks.

Andy

"ABX" <abx### [at] abxartpl> wrote in message
news:pcdenusb2i02trqkr5k2afkdo7d92jbcf9@4ax.com...
> On Thu, 5 Sep 2002 11:40:31 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
> wrote:
> > Any help greatly appreciated. i don't want to have to abandon this idea and use
sphere_sweeps
> > for the cables.
>
> http://news.povray.org/qr7aeugkvt07m6obnchs3hben663jbnkit%404ax.com
>
> ABX


Post a reply to this message

From: Andrew Cocker
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 09:23:43
Message: <3d775adf@news.povray.org>
Hi ABX,

Ok, I've just spent an hour or two trying to get these macros to work, but the problem
is that
I just don't understand how to use them. I had hoped to find a pre-written macro that
would
allow me to declare my spline, declare my object, declare the number of objects, and
the macro
does the rest, orienting the objects to the spline, and placing them at equal
distances along
it.

The thing is, I'm annoyed at myself for not being able to understand your macros. I've
been
POV-ing for years, and yet still come unstuck regularly. I would really appreciate it
if you
could provide any help here, and show me how to use the macros.

I'll need some way of orienting the objects to the spline, so I'll need another macro
to do
that?

The temporary code below uses Rune's Spline_Trans macro.

#declare MySpline =
spline {
   cubic_spline
 -1,<-1,1,0>,
 0,<0,1,0>,
 0.3, <2,0.7,-2>,
 0.6,<3,-0.8,-3>,
 0.85,<0,-0.8,-3.5>,
 1,<-1,-0.8,-3.72>,
 1.1,<-2,-0.8,-3.75>
}

#declare MyObject =
cone {<0,0,0>,0.2,<0,0,.2>,0.15}

#declare Count=0;
#while (Count<=0.95)
object { MyObject pigment { rgb <1,.3,.7>}
        Spline_Trans(MySpline, Count, y, 0.1, 0.1)
        //MySpline(Count)
        }
#declare Count=Count+.025;
#end

Thanks.

Andy Cocker


"ABX" <abx### [at] abxartpl> wrote in message
news:pcdenusb2i02trqkr5k2afkdo7d92jbcf9@4ax.com...
> On Thu, 5 Sep 2002 11:40:31 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
> wrote:
> > Any help greatly appreciated. i don't want to have to abandon this idea and use
sphere_sweeps
> > for the cables.
>
> http://news.povray.org/qr7aeugkvt07m6obnchs3hben663jbnkit%404ax.com
>
> ABX


Post a reply to this message

From: ABX
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 10:04:02
Message: <ttoenucoq6fcgkun57la24s9ia4ij5o573@4ax.com>
On Thu, 5 Sep 2002 14:24:01 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
wrote:
> Hi ABX,

Hi again :-)

> Ok, I've just spent an hour or two trying to get these macros to work

Yes, there was two mistakes I somehow left and there was actually one (already
know) 3.5 bug influence. Try below complete scene:

#include "transforms.inc"
#include "shapes.inc"
#include "strings.inc"

#macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
  #local Conversion=function{spline{
    #local Last=Spline(Min);
    #local Length=0;
    #local C=Min;
    #while (C<=Max)
      #local C=min(C,Max);
      #local Point=Spline(C);
      #local Length=Length+vlength(Point-Last);
      #local Last=Point;
      C , <1,0,0>*Length
      #local C=C+Accuracy;
    #end
  }};
  function(T){Conversion(T).x}
#end

#macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
  spline{
    #local Last=Spline(Min);
    #local Length=0;
    #local C=Min;
    #while (C<=Max)
      #local C=min(C,Max);
      #local Point=Spline(C);
      #local Length=Length+vlength(Point-Last);
      #local Last=Point;
      Length , Point+<0,0,0>
      #local C=C+Accuracy;
    #end
  }
#end

#declare MySpline = spline {
   cubic_spline
   -1,<-1,1,0>,
   0,<0,1,0>,
   0.3, <2,0.7,-2>,
   0.6,<3,-0.8,-3>,
   0.85,<0,-0.8,-3.5>,
   1,<-1,-0.8,-3.72>,
   1.1,<-2,-0.8,-3.75>
  }

#declare MySplineLinear = Spline_With_Linear_Movement(MySpline,0,1,0.001);
#declare f_MySplineLength = Time_To_Length_Converter(MySpline,0,1,0.001);
#declare MySplineLength = f_MySplineLength(1);

#declare MyObject = cone {0 .2 <0,0,.2> 0.15 pigment{rgb 1}};

#declare Step=MySplineLength/20;

#declare All=union{
  #declare Count=0;
  #while (Count<=MySplineLength-Step)
    object {
      MyObject
      pigment { rgb <1,.3,.7>}
      Spline_Trans(MySplineLinear, Count, y, 0.1, 0.1)
    }
    #declare Count=Count+Step;
  #end
  rotate x*90
}

object{
  Center_Object(All,1)
  translate z*5
}

background{1}
light_source{y*100 1}


ABX


Post a reply to this message

From: Andrew Cocker
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 10:10:00
Message: <3d7765b8$1@news.povray.org>
Hi once more :-)

Thankyou. I shall try this and hopefully I'll manage ok.

...but I 'may' be back.. ;-)

All the best,

Andy Cocker

"ABX" <abx### [at] abxartpl> wrote in message
news:ttoenucoq6fcgkun57la24s9ia4ij5o573@4ax.com...
> On Thu, 5 Sep 2002 14:24:01 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
> wrote:
> > Hi ABX,
>
> Hi again :-)
>
> > Ok, I've just spent an hour or two trying to get these macros to work
>
> Yes, there was two mistakes I somehow left and there was actually one (already
> know) 3.5 bug influence. Try below complete scene:
>
> #include "transforms.inc"
> #include "shapes.inc"
> #include "strings.inc"
>
> #macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
>   #local Conversion=function{spline{
>     #local Last=Spline(Min);
>     #local Length=0;
>     #local C=Min;
>     #while (C<=Max)
>       #local C=min(C,Max);
>       #local Point=Spline(C);
>       #local Length=Length+vlength(Point-Last);
>       #local Last=Point;
>       C , <1,0,0>*Length
>       #local C=C+Accuracy;
>     #end
>   }};
>   function(T){Conversion(T).x}
> #end
>
> #macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
>   spline{
>     #local Last=Spline(Min);
>     #local Length=0;
>     #local C=Min;
>     #while (C<=Max)
>       #local C=min(C,Max);
>       #local Point=Spline(C);
>       #local Length=Length+vlength(Point-Last);
>       #local Last=Point;
>       Length , Point+<0,0,0>
>       #local C=C+Accuracy;
>     #end
>   }
> #end
>
> #declare MySpline = spline {
>    cubic_spline
>    -1,<-1,1,0>,
>    0,<0,1,0>,
>    0.3, <2,0.7,-2>,
>    0.6,<3,-0.8,-3>,
>    0.85,<0,-0.8,-3.5>,
>    1,<-1,-0.8,-3.72>,
>    1.1,<-2,-0.8,-3.75>
>   }
>
> #declare MySplineLinear = Spline_With_Linear_Movement(MySpline,0,1,0.001);
> #declare f_MySplineLength = Time_To_Length_Converter(MySpline,0,1,0.001);
> #declare MySplineLength = f_MySplineLength(1);
>
> #declare MyObject = cone {0 .2 <0,0,.2> 0.15 pigment{rgb 1}};
>
> #declare Step=MySplineLength/20;
>
> #declare All=union{
>   #declare Count=0;
>   #while (Count<=MySplineLength-Step)
>     object {
>       MyObject
>       pigment { rgb <1,.3,.7>}
>       Spline_Trans(MySplineLinear, Count, y, 0.1, 0.1)
>     }
>     #declare Count=Count+Step;
>   #end
>   rotate x*90
> }
>
> object{
>   Center_Object(All,1)
>   translate z*5
> }
>
> background{1}
> light_source{y*100 1}
>
>
> ABX


Post a reply to this message

From: Andrew Cocker
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 11:45:02
Message: <3d777bfe@news.povray.org>
Thankyou so much.. it works perfectly.

All the best,

Andy Cocker


Post a reply to this message

From: ABX
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 11:51:35
Message: <d1venucb9u3r431pj99pritqpbddo2fbcb@4ax.com>
On Thu, 5 Sep 2002 11:40:31 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
wrote:
> i don't want to have to abandon this idea and use sphere_sweeps
> for the cables.

BTW, I'm currently working on completly rewrite of sphere_sweep module. I hope
in my implementation they will be much better. I use bounding hierarchy for
segments, optimized and correct bounding boxes, component texturing, shared
memory for copies etc, etc.

ABX


Post a reply to this message

From: Alan Holding
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 12:46:54
Message: <3d778a7e$1@news.povray.org>
Already sent this to Andy, but thought I should post it here.

To get Chris Colefax's Spline Macro working with 3.5, all you need to do is
a global find an replace and change Chris macro vstr (now a reserved keyword
in 3.5), to something else, such as vvstr.

Bingo!

--
http://www.manhog.freeuk.com/
ICQ 114025688
Long live Politzania


Post a reply to this message

From: Charles Fusner
Subject: Re: Place and orient objects along spline
Date: 5 Sep 2002 19:49:23
Message: <3D77EDC6.7000802@enter.net>
ABX wrote:
> On Thu, 5 Sep 2002 11:40:31 +0100, "Andrew Cocker" <mai### [at] andrewcockercouk>
> wrote:
> 
>>i don't want to have to abandon this idea and use sphere_sweeps
>>for the cables.
> 
> 
> BTW, I'm currently working on completly rewrite of sphere_sweep module. I hope
> in my implementation they will be much better. I use bounding hierarchy for
> segments, optimized and correct bounding boxes, component texturing, shared
> memory for copies etc, etc.
> 
> ABX

Hear hear! This is very welcome news!

I played with sphere_sweeps recently and it was my initial experience
that manual bounding was pretty much required if you wanted to stay
sane. They are such a promising new primitive it is good to hear that
better auto-bounding is being worked on.

-- 
@C[$F];
The Silver Tome ::  http://www.silvertome.com
"You may sing to my cat if you like..."


Post a reply to this message

From: Jochen Lippert
Subject: Sphere sweep enhancements (Was: Place and orient objects along spline)
Date: 10 Sep 2002 15:01:13
Message: <1fibbae.1sfjesy1t4dqo1N%jlippert@ubcom.de>
ABX <abx### [at] abxartpl> wrote:

> BTW, I'm currently working on completly rewrite of sphere_sweep module. I hope
> in my implementation they will be much better. I use bounding hierarchy for
> segments, optimized and correct bounding boxes, component texturing, shared
> memory for copies etc, etc.

Fine, nice to see someone else has ideas similar to mine (and more), and
is willing to invest the work and time to actually implement them. :)

If things work out OK, are you going to submit this into the official
POV-Ray source?

Jochen Lippert

-- 
No smilies were harmed in the making of this message ;)


Post a reply to this message

From: ABX
Subject: Re: Sphere sweep enhancements (Was: Place and orient objects along spline)
Date: 11 Sep 2002 04:46:02
Message: <gb0unu42rcbak7gb767sj5qhm59difcaq7@4ax.com>
On Tue, 10 Sep 2002 21:01:11 +0200, jli### [at] ubcomde (Jochen Lippert) wrote:
> Fine, nice to see someone else has ideas similar to mine (and more), and
> is willing to invest the work and time to actually implement them. :)

You can read some partial description in povray.unnofficial.patches group.

> If things work out OK, are you going to submit this into the official
> POV-Ray source?

That's not mine decision. I will publish patch when it will be ready and will
finish all tests. I'm making parser compatible backward with current
sphere_sweep syntax so it can be replaced.

ABX


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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