J
jpmendes
Thu, Mar 31, 2016 6:29 PM
I need some help on viewport animation.
I'm currently making the animation of a CNC machine and all is going well
except concerning the viewport animation. Lets see...
At first I wrongly thought that I could pass parameters from modules to
$vpr, $vpt and $vpd using $globals. As this is impossible, I tried using
functions at top level to do the same.
for instance if I do:
$vpt=[100+300MT(1),0,0];
$vpr=[0,0,200MT(1)];
$vpd=1500;
where MT(i) function is the relative time within animation sequence "i" and
depends on $t, the viewport animates.
However if I do:
function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1,
20,92,2, 200,200,1] :
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2,
200,200,1] : 0 ;
Where CS is my current sequence and Cam() contains the parameters for the
viewport animation.
And then if I do:
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
Where my function S(a,b,c,d), that is systematically used in my animation
without problems, also depends on $t.
And then do:
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
I see that VPX(CS) and VPRZ(CS) change with time as expected, but $vpt and
$vpr stay with the first calculated values until the end of the sequence.
What am I doing wrong?
Thanks.
jpmendes
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I need some help on viewport animation.
I'm currently making the animation of a CNC machine and all is going well
except concerning the viewport animation. Lets see...
At first I wrongly thought that I could pass parameters from modules to
$vpr, $vpt and $vpd using $globals. As this is impossible, I tried using
functions at top level to do the same.
for instance if I do:
$vpt=[100+300*MT(1),0,0];
$vpr=[0,0,200*MT(1)];
$vpd=1500;
where MT(i) function is the relative time within animation sequence "i" and
depends on $t, the viewport animates.
However if I do:
function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1,
20,92,2, 200,200,1] :
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2,
200,200,1] : 0 ;
Where CS is my current sequence and Cam() contains the parameters for the
viewport animation.
And then if I do:
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
Where my function S(a,b,c,d), that is systematically used in my animation
without problems, also depends on $t.
And then do:
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
I see that VPX(CS) and VPRZ(CS) change with time as expected, but $vpt and
$vpr stay with the first calculated values until the end of the sequence.
What am I doing wrong?
Thanks.
jpmendes
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Thu, Mar 31, 2016 6:43 PM
Don't know what's wrong, but if you can rotate the objects (instead of
changing viewport), this might be useful:
Animating gif with 3D rotation
http://forum.openscad.org/Animating-gif-with-3D-rotation-td14011.html
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), matrix( 1 , 2 ),sweep( 1 , 2 ), var( 1 , 2 ), lerp , animation ( gif , prodVid ), precision( 1 , 2 ), xl-control , type , rounded polygon , chfont
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16860.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Don't know what's wrong, but if you can rotate the objects (instead of
changing viewport), this might be useful:
Animating gif with 3D rotation
<http://forum.openscad.org/Animating-gif-with-3D-rotation-td14011.html>
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), matrix( 1 , 2 ),sweep( 1 , 2 ), var( 1 , 2 ), lerp , animation ( gif , prodVid ), precision( 1 , 2 ), xl-control , type , rounded polygon , chfont
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16860.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Thu, Mar 31, 2016 6:48 PM
Should CS be a parameter of Cam() perhaps?
On 31 March 2016 at 19:29, jpmendes jpmendes54@gmail.com wrote:
I need some help on viewport animation.
I'm currently making the animation of a CNC machine and all is going well
except concerning the viewport animation. Lets see...
At first I wrongly thought that I could pass parameters from modules to
$vpr, $vpt and $vpd using $globals. As this is impossible, I tried using
functions at top level to do the same.
for instance if I do:
$vpt=[100+300MT(1),0,0];
$vpr=[0,0,200MT(1)];
$vpd=1500;
where MT(i) function is the relative time within animation sequence "i" and
depends on $t, the viewport animates.
However if I do:
function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1,
20,92,2, 200,200,1] :
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2,
29,29,1, 29,92,2,
200,200,1] : 0 ;
Where CS is my current sequence and Cam() contains the parameters for the
viewport animation.
And then if I do:
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
Where my function S(a,b,c,d), that is systematically used in my animation
without problems, also depends on $t.
And then do:
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
I see that VPX(CS) and VPRZ(CS) change with time as expected, but $vpt and
$vpr stay with the first calculated values until the end of the sequence.
What am I doing wrong?
Thanks.
jpmendes
--
View this message in context:
http://forum.openscad.org/Help-on-viewport-animation-tp16858.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Should CS be a parameter of Cam() perhaps?
On 31 March 2016 at 19:29, jpmendes <jpmendes54@gmail.com> wrote:
> I need some help on viewport animation.
>
> I'm currently making the animation of a CNC machine and all is going well
> except concerning the viewport animation. Lets see...
> At first I wrongly thought that I could pass parameters from modules to
> $vpr, $vpt and $vpd using $globals. As this is impossible, I tried using
> functions at top level to do the same.
>
> for instance if I do:
> $vpt=[100+300*MT(1),0,0];
> $vpr=[0,0,200*MT(1)];
> $vpd=1500;
> where MT(i) function is the relative time within animation sequence "i" and
> depends on $t, the viewport animates.
>
> However if I do:
>
> function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1,
> 20,92,2, 200,200,1] :
> CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2,
> 29,29,1, 29,92,2,
> 200,200,1] : 0 ;
>
> Where CS is my current sequence and Cam() contains the parameters for the
> viewport animation.
>
> And then if I do:
>
> function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
> function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
>
> Where my function S(a,b,c,d), that is systematically used in my animation
> without problems, also depends on $t.
>
> And then do:
>
> $vpt=[VPX(CS), 100, 100];
> $vpr=[0,0,VPRZ(CS)];
> $vpd=1500;
>
> echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
>
> I see that VPX(CS) and VPRZ(CS) change with time as expected, but $vpt and
> $vpr stay with the first calculated values until the end of the sequence.
>
> What am I doing wrong?
>
> Thanks.
>
> jpmendes
>
>
>
> --
> View this message in context:
> http://forum.openscad.org/Help-on-viewport-animation-tp16858.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
DM
doug moen
Thu, Mar 31, 2016 6:52 PM
check if you are assigning $vpt= more than once in your script. OpenSCAD
won't warn you about that, it will just ignore all but the last definition
of $vpt.
On 31 March 2016 at 14:29, jpmendes jpmendes54@gmail.com wrote:
I need some help on viewport animation.
I'm currently making the animation of a CNC machine and all is going well
except concerning the viewport animation. Lets see...
At first I wrongly thought that I could pass parameters from modules to
$vpr, $vpt and $vpd using $globals. As this is impossible, I tried using
functions at top level to do the same.
for instance if I do:
$vpt=[100+300MT(1),0,0];
$vpr=[0,0,200MT(1)];
$vpd=1500;
where MT(i) function is the relative time within animation sequence "i" and
depends on $t, the viewport animates.
However if I do:
function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1,
20,92,2, 200,200,1] :
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2,
29,29,1, 29,92,2,
200,200,1] : 0 ;
Where CS is my current sequence and Cam() contains the parameters for the
viewport animation.
And then if I do:
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
Where my function S(a,b,c,d), that is systematically used in my animation
without problems, also depends on $t.
And then do:
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
I see that VPX(CS) and VPRZ(CS) change with time as expected, but $vpt and
$vpr stay with the first calculated values until the end of the sequence.
What am I doing wrong?
Thanks.
jpmendes
--
View this message in context:
http://forum.openscad.org/Help-on-viewport-animation-tp16858.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
check if you are assigning $vpt= more than once in your script. OpenSCAD
won't warn you about that, it will just ignore all but the last definition
of $vpt.
On 31 March 2016 at 14:29, jpmendes <jpmendes54@gmail.com> wrote:
> I need some help on viewport animation.
>
> I'm currently making the animation of a CNC machine and all is going well
> except concerning the viewport animation. Lets see...
> At first I wrongly thought that I could pass parameters from modules to
> $vpr, $vpt and $vpd using $globals. As this is impossible, I tried using
> functions at top level to do the same.
>
> for instance if I do:
> $vpt=[100+300*MT(1),0,0];
> $vpr=[0,0,200*MT(1)];
> $vpd=1500;
> where MT(i) function is the relative time within animation sequence "i" and
> depends on $t, the viewport animates.
>
> However if I do:
>
> function Cam() = CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1,
> 20,92,2, 200,200,1] :
> CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2,
> 29,29,1, 29,92,2,
> 200,200,1] : 0 ;
>
> Where CS is my current sequence and Cam() contains the parameters for the
> viewport animation.
>
> And then if I do:
>
> function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
> function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
>
> Where my function S(a,b,c,d), that is systematically used in my animation
> without problems, also depends on $t.
>
> And then do:
>
> $vpt=[VPX(CS), 100, 100];
> $vpr=[0,0,VPRZ(CS)];
> $vpd=1500;
>
> echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
>
> I see that VPX(CS) and VPRZ(CS) change with time as expected, but $vpt and
> $vpr stay with the first calculated values until the end of the sequence.
>
> What am I doing wrong?
>
> Thanks.
>
> jpmendes
>
>
>
> --
> View this message in context:
> http://forum.openscad.org/Help-on-viewport-animation-tp16858.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
J
jpmendes
Thu, Mar 31, 2016 8:58 PM
@ Doug
Nope, there is only one place where $vp's are referenced.
@ nopehead
I tried Cam(CS) without success.
Thanks anyway
BTW this is a test sample of the two first sequences without the CNC, just
to speed up things. Although there are some adjustments to be done, that's
the idea.
anima_tst.mp4 http://forum.openscad.org/file/n16866/anima_tst.mp4
Another problem I'm facing is: for this simple animation, generating the
png's directly by checking "Dump Pictures" my file rate generation is about
1 second per picture. However if I use a script for generating the images
with about 4x the standard resolution, it takes about a minute per picture.
That means more than 2 days for my estimated 7500 steps animation.
Considering the inclusion of all the components in the animation maybe a
week will not be enough. The CNC is belt driven and I have to calculate the
belt deformation for each step, and it takes about 20 secs in my machine.
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16866.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@ Doug
Nope, there is only one place where $vp's are referenced.
@ nopehead
I tried Cam(CS) without success.
Thanks anyway
BTW this is a test sample of the two first sequences without the CNC, just
to speed up things. Although there are some adjustments to be done, that's
the idea.
anima_tst.mp4 <http://forum.openscad.org/file/n16866/anima_tst.mp4>
Another problem I'm facing is: for this simple animation, generating the
png's directly by checking "Dump Pictures" my file rate generation is about
1 second per picture. However if I use a script for generating the images
with about 4x the standard resolution, it takes about a minute per picture.
That means more than 2 days for my estimated 7500 steps animation.
Considering the inclusion of all the components in the animation maybe a
week will not be enough. The CNC is belt driven and I have to calculate the
belt deformation for each step, and it takes about 20 secs in my machine.
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16866.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Thu, Mar 31, 2016 9:15 PM
@jpmendes I'm happy to help out with rendering a sequence.
I have 16 cores, possibly more than one instance can be rendered at the same
time ?
Assuming you hve a time constraint....
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16867.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@jpmendes I'm happy to help out with rendering a sequence.
I have 16 cores, possibly more than one instance can be rendered at the same
time ?
Assuming you hve a time constraint....
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16867.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Thu, Mar 31, 2016 9:30 PM
I don't know what your S() function is but this dummy seems to produce
camera movement and the $vp variables do change.
sphere(10);
function Cam() =
CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1, 20,92,2, 200,200,1]
:
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2, 200,200,1]
: 0 ;
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
function S(a,b,c,d) = a + b + c + d + 10 * $t;
CS = 2;
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
echo($vpt, $vpr, $vpd);
On 31 March 2016 at 21:58, jpmendes jpmendes54@gmail.com wrote:
@ Doug
Nope, there is only one place where $vp's are referenced.
@ nopehead
I tried Cam(CS) without success.
Thanks anyway
BTW this is a test sample of the two first sequences without the CNC, just
to speed up things. Although there are some adjustments to be done, that's
the idea.
anima_tst.mp4 http://forum.openscad.org/file/n16866/anima_tst.mp4
Another problem I'm facing is: for this simple animation, generating the
png's directly by checking "Dump Pictures" my file rate generation is
about
1 second per picture. However if I use a script for generating the images
with about 4x the standard resolution, it takes about a minute per picture.
That means more than 2 days for my estimated 7500 steps animation.
Considering the inclusion of all the components in the animation maybe a
week will not be enough. The CNC is belt driven and I have to calculate the
belt deformation for each step, and it takes about 20 secs in my machine.
--
View this message in context:
http://forum.openscad.org/Help-on-viewport-animation-tp16858p16866.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I don't know what your S() function is but this dummy seems to produce
camera movement and the $vp variables do change.
sphere(10);
function Cam() =
CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1, 20,92,2, 200,200,1]
:
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2, 200,200,1]
: 0 ;
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
function S(a,b,c,d) = a + b + c + d + 10 * $t;
CS = 2;
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
echo($vpt, $vpr, $vpd);
On 31 March 2016 at 21:58, jpmendes <jpmendes54@gmail.com> wrote:
> @ Doug
> Nope, there is only one place where $vp's are referenced.
>
> @ nopehead
> I tried Cam(CS) without success.
>
> Thanks anyway
>
> BTW this is a test sample of the two first sequences without the CNC, just
> to speed up things. Although there are some adjustments to be done, that's
> the idea.
>
> anima_tst.mp4 <http://forum.openscad.org/file/n16866/anima_tst.mp4>
>
> Another problem I'm facing is: for this simple animation, generating the
> png's directly by checking "Dump Pictures" my file rate generation is
> about
> 1 second per picture. However if I use a script for generating the images
> with about 4x the standard resolution, it takes about a minute per picture.
> That means more than 2 days for my estimated 7500 steps animation.
> Considering the inclusion of all the components in the animation maybe a
> week will not be enough. The CNC is belt driven and I have to calculate the
> belt deformation for each step, and it takes about 20 secs in my machine.
>
>
>
>
> --
> View this message in context:
> http://forum.openscad.org/Help-on-viewport-animation-tp16858p16866.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
J
jpmendes
Thu, Mar 31, 2016 10:08 PM
@neon22
Thanks, I may consider the offer for the final render. Maybe I can use my
son's 6 core pc if he takes some days off, summer is comming ... :-). For
now I have my 11 year old, 2 cores Athlon 4200 only.
@nopehead
My S function is a bit straight forward. I intend to perfect it later. Now
what I'm trying to do is a simple animator that I can use whenever I need.
// S -Relative speed within the sequence time with movement inversion point
(perliminary).
// d - distance, s - relative speed, InvT - inversion point between 1 and 0.
function S(i,d,s,InvT) = (InvT==undef)? (dpow(MT(i),s)):
(MT(i)-InvT<0)? (dpow(-MT(i)+InvT,s)):
(d*pow(MT(i)-InvT,s));
// MT - relative time within the sequence time slot (1 --> 0)
function MT(i) = (T(i)-$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-$t): 0;
As you can see S() depends on $t through MT(i)
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16870.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@neon22
Thanks, I may consider the offer for the final render. Maybe I can use my
son's 6 core pc if he takes some days off, summer is comming ... :-). For
now I have my 11 year old, 2 cores Athlon 4200 only.
@nopehead
My S function is a bit straight forward. I intend to perfect it later. Now
what I'm trying to do is a simple animator that I can use whenever I need.
// S -Relative speed within the sequence time with movement inversion point
(perliminary).
// d - distance, s - relative speed, InvT - inversion point between 1 and 0.
function S(i,d,s,InvT) = (InvT==undef)? (d*pow(MT(i),s)):
(MT(i)-InvT<0)? (d*pow(-MT(i)+InvT,s)):
(d*pow(MT(i)-InvT,s));
// MT - relative time within the sequence time slot (1 --> 0)
function MT(i) = (T(i)-$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-$t): 0;
As you can see S() depends on $t through MT(i)
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16870.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
NH
nop head
Thu, Mar 31, 2016 10:23 PM
This moves:
sphere(10);
function Cam() =
CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1, 20,92,2, 200,200,1]
:
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2, 200,200,1]
: 0 ;
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
function S(a,b,c,d) = a + b + c + d + 10 * $t;
// d - distance, s - relative speed, InvT - inversion point between 1 and 0.
function S(i,d,s,InvT) = (InvT==undef)? (dpow(MT(i),s)):
(MT(i)-InvT<0)? (dpow(-MT(i)+InvT,s)):
(d*pow(MT(i)-InvT,s));
// MT - relative time within the sequence time slot (1 --> 0)
function MT(i) = $t;
CS = 2;
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
echo($vpt, $vpr, $vpd);
So I suspect your MT() function has a bug.
On 31 March 2016 at 23:08, jpmendes jpmendes54@gmail.com wrote:
@neon22
Thanks, I may consider the offer for the final render. Maybe I can use my
son's 6 core pc if he takes some days off, summer is comming ... :-). For
now I have my 11 year old, 2 cores Athlon 4200 only.
@nopehead
My S function is a bit straight forward. I intend to perfect it later. Now
what I'm trying to do is a simple animator that I can use whenever I need.
// S -Relative speed within the sequence time with movement inversion point
(perliminary).
// d - distance, s - relative speed, InvT - inversion point between 1 and
0.
function S(i,d,s,InvT) = (InvT==undef)? (dpow(MT(i),s)):
(MT(i)-InvT<0)? (dpow(-MT(i)+InvT,s)):
(d*pow(MT(i)-InvT,s));
// MT - relative time within the sequence time slot (1 --> 0)
function MT(i) = (T(i)-$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-$t): 0;
As you can see S() depends on $t through MT(i)
--
View this message in context:
http://forum.openscad.org/Help-on-viewport-animation-tp16858p16870.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
This moves:
sphere(10);
function Cam() =
CS==1 ? [10,200,1, 20,20,1, 20,20,1, 20,92,2, 20,29,1, 20,92,2, 200,200,1]
:
CS==2 ? [10,200,1, 20,20,1, 20,20,1, 29,92,2, 29,29,1, 29,92,2, 200,200,1]
: 0 ;
function VPX(CS)=Cam()[0]+S(CS,Cam()[1],Cam()[2],0);
function VPRZ(CS)=Cam()[15]+S(CS,Cam()[16],Cam()[17],0);
function S(a,b,c,d) = a + b + c + d + 10 * $t;
// d - distance, s - relative speed, InvT - inversion point between 1 and 0.
function S(i,d,s,InvT) = (InvT==undef)? (d*pow(MT(i),s)):
(MT(i)-InvT<0)? (d*pow(-MT(i)+InvT,s)):
(d*pow(MT(i)-InvT,s));
// MT - relative time within the sequence time slot (1 --> 0)
function MT(i) = $t;
CS = 2;
$vpt=[VPX(CS), 100, 100];
$vpr=[0,0,VPRZ(CS)];
$vpd=1500;
echo("Camera: ", Cam()[0],Cam()[1], Cam()[2],VPX(CS), VPRZ(CS));
echo($vpt, $vpr, $vpd);
So I suspect your MT() function has a bug.
On 31 March 2016 at 23:08, jpmendes <jpmendes54@gmail.com> wrote:
> @neon22
> Thanks, I may consider the offer for the final render. Maybe I can use my
> son's 6 core pc if he takes some days off, summer is comming ... :-). For
> now I have my 11 year old, 2 cores Athlon 4200 only.
>
> @nopehead
>
> My S function is a bit straight forward. I intend to perfect it later. Now
> what I'm trying to do is a simple animator that I can use whenever I need.
>
> // S -Relative speed within the sequence time with movement inversion point
> (perliminary).
> // d - distance, s - relative speed, InvT - inversion point between 1 and
> 0.
> function S(i,d,s,InvT) = (InvT==undef)? (d*pow(MT(i),s)):
> (MT(i)-InvT<0)? (d*pow(-MT(i)+InvT,s)):
> (d*pow(MT(i)-InvT,s));
>
> // MT - relative time within the sequence time slot (1 --> 0)
> function MT(i) = (T(i)-$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-$t): 0;
>
> As you can see S() depends on $t through MT(i)
>
>
>
>
>
>
>
> --
> View this message in context:
> http://forum.openscad.org/Help-on-viewport-animation-tp16858p16870.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
J
jpmendes
Thu, Mar 31, 2016 11:16 PM
Yes you are right MT() has a bug. Problem solved. But I cheated a bit.
My real MT(i) was:
function MT(i) = ($ST>1||$ST<0)? 0 : ($tst==0)? NT(i) : ($ST==undef)? 1 :
$ST;
and NT(i) is the MT(i) function I posted before.
function NT(i) = (T(i)-$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-$t): 0;
Since my variable $tst is set to 0, I replaced directly NT(i) with MT(i)
for posting simplification.
My MT(i) was a debugging help to test animation sequences without the
animation mode checked.
The problem is that I forgot that $ST is undef when I am not in test mode
and probably the evaluation of the expression is in such a way that $ST is
evaluated before $tst, and as a result MT(i) is always 1.
The reason for the globals was that I was hopping to pass values from
modules to the top level but that's not possible.
Thanks a lot for the help.
jpmendes
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16872.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Yes you are right MT() has a bug. Problem solved. But I cheated a bit.
My real MT(i) was:
function MT(i) = ($ST>1||$ST<0)? 0 : ($tst==0)? NT(i) : ($ST==undef)? 1 :
$ST;
and NT(i) is the MT(i) function I posted before.
function NT(i) = (T(i)-$t>=0)? (TTime/SeqTPlan[i-1])*(T(i)-$t): 0;
Since my variable $tst is set to 0, I replaced directly NT(i) with MT(i)
for posting simplification.
My MT(i) was a debugging help to test animation sequences without the
animation mode checked.
The problem is that I forgot that $ST is undef when I am not in test mode
and probably the evaluation of the expression is in such a way that $ST is
evaluated before $tst, and as a result MT(i) is always 1.
The reason for the globals was that I was hopping to pass values from
modules to the top level but that's not possible.
Thanks a lot for the help.
jpmendes
--
View this message in context: http://forum.openscad.org/Help-on-viewport-animation-tp16858p16872.html
Sent from the OpenSCAD mailing list archive at Nabble.com.