POV-Ray : Newsgroups : povray.general : moving CSG objects along a curve without gaps Server Time
29 Jul 2024 04:17:55 EDT (-0400)
  moving CSG objects along a curve without gaps (Message 1 to 3 of 3)  
From: rodv92
Subject: moving CSG objects along a curve without gaps
Date: 21 Oct 2013 17:30:00
Message: <web.52659b9f5db988d0a98a44ff0@news.povray.org>
Hello group, i need your help. i am trying to move CSG objects along a curve.
That's easy, but the problem here is i dont want any gaps between the objects.

So, it will involve some trigonometric operations.
imagine you have a box and you see it from above.
rotation are about the y axis

first you have to rotate it at origin multiplied by the while control variable
(magsec in my example).
Next i will translate it so as the right down side of the box will just touch
the previous box edge.

the left side will merge with the previous box some more, so there will be no
gap.

the object is 55.88 wide and 44 depth.

the uncorrected translate after the rotate will be 44*magsec. then you have to
back it a bit along the z axis to remove the gap.

I figured that it will be a z translate of tan(angle)*55.88/2

Next you will have to move along the x axis to make the whole path curved

I figured that it will be a x translate of sin(angle)*44

But these vectors will be affected by the rotation along the curve so I thought
that i will need to vrotate them, and add the cumulatively.

So here is the SDL :


#declare tx = <0,0,0>;
#declare tz = <0,0,0>;

       #declare txb = <44*sin(2*pi*1.665/360),0,0>;  // x correction to create
the curve path
       #declare tzb = <0,0,(55.88/2)*tan(2*pi*1.665/360)>; // z correction to
remove gap

#declare magsec = 0;
#while(magsec < 80)

       #declare vrx = vrotate(txb,<0,-1.665*(magsec),0>); // take into account
the rotational effect on the vectors
       #declare vrz = vrotate(tzb,<0,-1.665*(magsec+1),0>); // take into account
the rotational effect on the vectors

       #declare txtmp = tx;
       #declare tztmp = tz;

       #declare tx = txtmp + vrx; // cumulative addition of vectors
       #declare tz = tztmp + vrz; // cumulative addition of vectors

#declare leftmag3 = object{maglev_track_section
       no_shadow
       double_illuminate
       rotate magsec*1.665*y // rotate at origin
       translate 44*z*magsec // translate without corrections
       translate -tx // create curve
       translate -tz // remove gap
      }

object { leftmag3 }

#declare magsec = magsec + 1;
#end


Please help me find the problem, or if you know a better algorithm.

Thank you.


Post a reply to this message

From: Le Forgeron
Subject: Re: moving CSG objects along a curve without gaps
Date: 22 Oct 2013 06:01:36
Message: <52664d00$1@news.povray.org>
Le 21/10/2013 23:24, rodv92 a écrit :
> Hello group, i need your help. i am trying to move CSG objects along a curve.
> That's easy, but the problem here is i dont want any gaps between the objects.
> 
> So, it will involve some trigonometric operations.
> imagine you have a box and you see it from above.
> rotation are about the y axis
> 
> first you have to rotate it at origin multiplied by the while control variable
> (magsec in my example).
> Next i will translate it so as the right down side of the box will just touch
> the previous box edge.
> 
> the left side will merge with the previous box some more, so there will be no
> gap.
> 
> the object is 55.88 wide and 44 depth.
> 
> the uncorrected translate after the rotate will be 44*magsec. then you have to
> back it a bit along the z axis to remove the gap.
> 
> I figured that it will be a z translate of tan(angle)*55.88/2
> 
> Next you will have to move along the x axis to make the whole path curved
> 
> I figured that it will be a x translate of sin(angle)*44
> 
> But these vectors will be affected by the rotation along the curve so I thought
> that i will need to vrotate them, and add the cumulatively.
> 
> So here is the SDL :

> Please help me find the problem, or if you know a better algorithm.
> 
> Thank you.
> 
> 
Assuming it is something similar to wagons of a train on a railway, I
would model the railway as a spline, use the magsec as the time index of
the position of the head of the first wagon (so evaluating the spline at
magsec provide the position of the head of the first wagon),
then use a bisecting algorithm to compute magsec2 so that the distance
between the position of magsec2 and magsec match your constraint.

And so on for all other wagons.


-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

From: rodv92
Subject: Re: moving CSG objects along a curve without gaps
Date: 22 Oct 2013 07:35:01
Message: <web.526661d952cfc2bb5d50475e0@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:
> Le 21/10/2013 23:24, rodv92 a écrit :
> > Hello group, i need your help. i am trying to move CSG objects along a curve.
> > That's easy, but the problem here is i dont want any gaps between the objects.
> >
> > So, it will involve some trigonometric operations.
> > imagine you have a box and you see it from above.
> > rotation are about the y axis
> >
> > first you have to rotate it at origin multiplied by the while control variable
> > (magsec in my example).
> > Next i will translate it so as the right down side of the box will just touch
> > the previous box edge.
> >
> > the left side will merge with the previous box some more, so there will be no
> > gap.
> >
> > the object is 55.88 wide and 44 depth.
> >
> > the uncorrected translate after the rotate will be 44*magsec. then you have to
> > back it a bit along the z axis to remove the gap.
> >
> > I figured that it will be a z translate of tan(angle)*55.88/2
> >
> > Next you will have to move along the x axis to make the whole path curved
> >
> > I figured that it will be a x translate of sin(angle)*44
> >
> > But these vectors will be affected by the rotation along the curve so I thought
> > that i will need to vrotate them, and add the cumulatively.
> >
> > So here is the SDL :
>
> > Please help me find the problem, or if you know a better algorithm.
> >
> > Thank you.
> >
> >
> Assuming it is something similar to wagons of a train on a railway, I
> would model the railway as a spline, use the magsec as the time index of
> the position of the head of the first wagon (so evaluating the spline at
> magsec provide the position of the head of the first wagon),
> then use a bisecting algorithm to compute magsec2 so that the distance
> between the position of magsec2 and magsec match your constraint.
>
> And so on for all other wagons.
>
>
> --
> Just because nobody complains does not mean all parachutes are perfect.


thank you, but in fact it is not modelling of a train but rather a static maglev
train track. so there is no time involved, and it should be easy.

I will stick for the moment to my algorithm and model it on drafting paper with
my schooldays tools. this way I should find what's going on.


Post a reply to this message

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