POV-Ray : Newsgroups : povray.newusers : Length of spline object changes during animation Server Time
27 Dec 2024 11:45:01 EST (-0500)
  Length of spline object changes during animation (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: Aj
Subject: Length of spline object changes during animation
Date: 17 Aug 2022 10:40:00
Message: <web.62fcfd388783b6f6cb63c1d33d902b29@news.povray.org>
Hello everyone,

I am pretty new to povray and I have the following code, where I get the x,y,
and z coordinates of 6 different points from a simulation and then create a
sphere sweep through these points. But the problem is the length of this object
changes with time i.e. as the points move, the sphere sweep object appears to
change size. If you look at the picture attached then the white and green
objects appear to be of different lengths.

Any suggestion will be really helpful.

Here is my code:

"""
#include"colors.inc"
 camera {
  location <0,0,-1000>
  look_at <0,0,0>
   angle 22
  }
light_source { <100,100,-100>  color rgb<1,1,1> }
background {color rgb<0.0,0.0,0.0> }
#declare Scale = 3.11*< 4200,210,50 >;
#declare Radius = 10.9;
#declare P01 = Scale*<0,0,-14.2857>;
#declare P02 = Scale*<0,0,0.2>;
#declare P03 = Scale*<0,0,0.4>;
#declare P04 = Scale*<0,0,0.6>;
#declare P05 = Scale*<0,0,0.8>;
#declare P06 = Scale*<0,0,1>;
#declare Thing = union{




  sphere_sweep {
  b_spline
  6,
   P01,Radius,
   P02,Radius,
   P03,Radius,
   P04,Radius,
   P05,Radius,
   P06,Radius
  tolerance 0.1
  texture{ pigment{ color rgb<0.69,0.99,0.15>}
  finish { phong 1
   ambient 0.3
 }
 }


 }
rotate<-90,0,0>
}
 #declare Thing_max = max_extent(Thing);
 #declare Thing_min = min_extent(Thing);
 #declare Thing_centre = (max_extent(Thing) + min_extent(Thing))/2;
sphere{Thing_centre, 1.5 pigment{rgb<1,0,0>} rotate<0,360*clock,0>}


object{Thing rotate<0,360*clock,0>}



#declare Scale =  3.11*< 4200,210,2>;

#declare P001 = 3.11*< 4200,210,50>*<0,0,-20.2857>;
#declare P002 = Scale*<8.6101e-11,-9.0312e-10,0.2>;
#declare P003 = Scale*<0.0025215,-0.030611,0.39763>;
#declare P004 = Scale*<0.0025633,-0.079185,0.59164>;
#declare P005 = Scale*<-0.0050769,-0.14013,0.78198>;
#declare P006 = Scale*<-0.012717,-0.20107,0.97231>;
#declare Thing2 = sphere_sweep {




  b_spline
  6,
   P001,Radius,
   P002,Radius,
   P003,Radius,
   P004,Radius,
   P005,Radius,
   P006,Radius
  tolerance 0.1
  texture{ pigment{ color rgb<1,1,1>}
  finish { phong 1
   ambient 0.3
 }
 }


 }
object{Thing2 rotate<-90,0,0> translate <0,-3,0>}

"""


I have been trying to do something like shown in this video:

https://www.cosseratrods.org/videos/RALvideos/Case2-front_view_web.mp4


Post a reply to this message


Attachments:
Download 'pyel1.png' (15 KB)

Preview of image 'pyel1.png'
pyel1.png


 

From: Alain Martel
Subject: Re: Length of spline object changes during animation
Date: 17 Aug 2022 11:30:00
Message: <62fd0978$1@news.povray.org>
Le 2022-08-17 à 10:37, Aj a écrit :
> Hello everyone,
> 
> I am pretty new to povray and I have the following code, where I get the x,y,
> and z coordinates of 6 different points from a simulation and then create a
> sphere sweep through these points. But the problem is the length of this object
> changes with time i.e. as the points move, the sphere sweep object appears to
> change size. If you look at the picture attached then the white and green
> objects appear to be of different lengths.
> 
> Any suggestion will be really helpful.
> 

They appear to be of different length because they ARE of different length.

You should try the inverse kynetic neck (ot IKN) macro that was 
published in one of the news groups. It takes two end points, a 
stiffness parameter at both ends, a twist value at each end, and a total 
length as input. It returns a spline of the correct length connecting 
the end points, or an error message if the end points are to far apart.


Post a reply to this message

From: jr
Subject: Re: Length of spline object changes during animation
Date: 17 Aug 2022 11:55:00
Message: <web.62fd0e8c70f1e1beecf5a77b6cde94f1@news.povray.org>
hi,

Alain Martel <kua### [at] videotronca> wrote:

> > ...
> You should try the inverse kynetic neck (ot IKN) macro that was
> published in one of the news groups.

<http://news.povray.org/XnsA9BDC915FAF25seed7%40news.povray.org>


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: Length of spline object changes during animation
Date: 17 Aug 2022 15:20:00
Message: <web.62fd3f2970f1e1be1f9dae3025979125@news.povray.org>
"Aj" <nomail@nomail> wrote:
> Hello everyone,
>
> I am pretty new to povray and I have the following code, where I get the x,y,
> and z coordinates of 6 different points from a simulation and then create a
> sphere sweep through these points. But the problem is the length of this object
> changes with time i.e. as the points move, the sphere sweep object appears to
> change size. If you look at the picture attached then the white and green
> objects appear to be of different lengths.
>
> Any suggestion will be really helpful.


> I have been trying to do something like shown in this video:
>
> https://www.cosseratrods.org/videos/RALvideos/Case2-front_view_web.mp4

So, without any real idea what's going on, an in the absence of any detailed
explanation, I'll speculate that you're trying to model some kind of
semi-flexible/stretchable filament that's supposed to move around based on some
kind of movement of the endpoint, or a physical particle system (your
"simulation").

So,

Either all of your <x, y, z> data is coming straight from the simulation, or

You need to calculate the (approximate) length of your spline, and then after
moving the control points, find some way to jimmy them so that you're preserving
the overall length within some constraints as defined by the elasticity of the
filament, etc. before rendering the next frame of the animation.   And that sure
doesn't sound trivial.


Post a reply to this message

From: jr
Subject: Re: Length of spline object changes during animation
Date: 17 Aug 2022 18:10:00
Message: <web.62fd65fc70f1e1beecf5a77b6cde94f1@news.povray.org>
hi,

"Aj" <nomail@nomail> wrote:
> I am pretty new to povray and I have the following code, ...

as you're "new", I take the liberty of a couple of remarks regarding the code.


> Here is my code:

first off, it's good that you've posted an example, always helpful, I think.

when rendering a scene, it pays to read povray's warnings (and pay heed ;-)).
your code should have a '#version' (often the first instruction in the scene),
and a 'global_settings' with 'assumed_gamma'.  the newer version also likes an
'emission 0' when you use 'ambient' in the finish.

your 'union' is meant to include the sphere?  (the program warns about needing
two or more objects)

try to keep things .. simple, eg there are "better" places to apply the 'Scale',
once.

since you're dealing with collections/lists of points/coords, consider using one
or more arrays to store those.  you could then, for instance, write a loop
inside the 'sphere_sweep' declaration to "fill in" the points.  (less
duplication and editing)


> I have been trying to do something like shown in this video:

nice.  hope the "Inverse Kinematics" AM pointed out will help to "get you
there".


regards, jr.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Length of spline object changes during animation
Date: 18 Aug 2022 02:28:27
Message: <62fddc0b$1@news.povray.org>
Op 17/08/2022 om 17:29 schreef Alain Martel:
> You should try the inverse kynetic neck (ot IKN) macro that was 
> published in one of the news groups. It takes two end points, a 
> stiffness parameter at both ends, a twist value at each end, and a total 
> length as input. It returns a spline of the correct length connecting 
> the end points, or an error message if the end points are to far apart.

I think that the macro mentioned here is by Rune Johansen, and can be 
found at this page:

https://runevision.com/3d/include/

-- 
Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: Length of spline object changes during animation
Date: 18 Aug 2022 02:50:52
Message: <62fde14c$1@news.povray.org>
As the mind appears to be sluggish today, I just remembered Tim Nikias' 
work:

https://www.nolights.de/downloads.html

Look for the Cubic Bezier-Spline section (but his other macros are worth 
investigating too, just out of curiosity).

-- 
Thomas


Post a reply to this message

From: jr
Subject: Re: Length of spline object changes during animation
Date: 18 Aug 2022 13:20:00
Message: <web.62fe747a70f1e1beecf5a77b6cde94f1@news.povray.org>
hi,

Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 17/08/2022 om 17:29 schreef Alain Martel:
> > You should try the inverse kynetic neck (ot IKN) macro ...
> I think that the macro mentioned here is by Rune Johansen, ...

ah, thanks.  I had assumed Alain meant ingo's work.  (I'm "too young" ;-) to
remember that far back)  (serious website)


regards, jr.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Length of spline object changes during animation
Date: 19 Aug 2022 03:52:07
Message: <62ff4127$1@news.povray.org>
Op 18-8-2022 om 19:18 schreef jr:
> hi,
> 
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> Op 17/08/2022 om 17:29 schreef Alain Martel:
>>> You should try the inverse kynetic neck (ot IKN) macro ...
>> I think that the macro mentioned here is by Rune Johansen, ...
> 
> ah, thanks.  I had assumed Alain meant ingo's work.  (I'm "too young" ;-) to
> remember that far back)  (serious website)
> 

<grin> Happily, I have a kind of database which 'remembers' for me.

-- 
Thomas


Post a reply to this message

From: Aj
Subject: Re: Length of spline object changes during animation
Date: 19 Sep 2022 02:10:00
Message: <web.632806c770f1e1be893f57de3d902b29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Aj" <nomail@nomail> wrote:
> > Hello everyone,
> >
> > I am pretty new to povray and I have the following code, where I get the x,y,
> > and z coordinates of 6 different points from a simulation and then create a
> > sphere sweep through these points. But the problem is the length of this object
> > changes with time i.e. as the points move, the sphere sweep object appears to
> > change size. If you look at the picture attached then the white and green
> > objects appear to be of different lengths.
> >
> > Any suggestion will be really helpful.
>
>
> > I have been trying to do something like shown in this video:
> >
> > https://www.cosseratrods.org/videos/RALvideos/Case2-front_view_web.mp4
>
> So, without any real idea what's going on, an in the absence of any detailed
> explanation, I'll speculate that you're trying to model some kind of
> semi-flexible/stretchable filament that's supposed to move around based on some
> kind of movement of the endpoint, or a physical particle system (your
> "simulation").
>
> So,
>
> Either all of your <x, y, z> data is coming straight from the simulation, or
>
> You need to calculate the (approximate) length of your spline, and then after
> moving the control points, find some way to jimmy them so that you're preserving
> the overall length within some constraints as defined by the elasticity of the
> filament, etc. before rendering the next frame of the animation.   And that sure
> doesn't sound trivial.


Thank you for taking the time to go through the problem.
So basically the < x, y, z > coordinates are coming from a numerically simulated
soft robot and the entire shape of the robot changes over time. So I was trying
to create a spline through these points that move in the 3d space. I agree that
the splines will be of different lengths depending on the location of control
points but this is what I am trying to fix. As the spline represents a soft
robot that is capable of only changing its shape keeping the length constant.
I hope this clears some of your doubts.


Post a reply to this message

Goto Latest 10 Messages Next 4 Messages >>>

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