POV-Ray : Newsgroups : povray.newusers : Length of spline object changes during animation Server Time
30 Dec 2024 09:38:17 EST (-0500)
  Length of spline object changes during animation (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
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

From: Aj
Subject: Re: Length of spline object changes during animation
Date: 19 Sep 2022 02:50:00
Message: <web.632810da70f1e1be893f57de3d902b29@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> 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.

A tutorial to the Inverse Kinematics Neck will be very helpful as I am still a
beginner user.


Post a reply to this message

From: Bald Eagle
Subject: Re: Length of spline object changes during animation
Date: 19 Sep 2022 07:20:00
Message: <web.63284fee70f1e1be1f9dae3025979125@news.povray.org>
"Aj" <nomail@nomail> wrote:

> 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.

The problem here is that you need to be able to create a smooth spline that you
can calculate the length of.  And Cousin Ricky will tell you that calculating
the length of many mathematical curves with some sort of implicit or parametric
equation is - impossible.

What you'd probably need to do is find some numeric method to approximate the
length based on linear line segments (or just use a linear spline).  Then you'd
need a way to take the soft-robot control points and iteratively adjust their
positions so that they converge to a spline with a fixed length, while still
maintaining the overall correct pose of the character.

This is a raytracing forum, and the experience and expertise of the people here
is pretty random.
I would suggest that you take a good while to research approximating
curve/spline lengths, and contact people whose expertise this is.   There are
graduate students, engineers, professors, CG professionals, youtubers, bloggers,
and textbook authors who could give you advice and point you in the right
direction.

Try to find people who like a graphics or coding challenge.   Art of Code
(Martijn Steinrucker), Coding Train (Daniel Shiffman), Inigo Quilez (Shadertoy),
are all places I frequent to stretch my horizons and learn new and different
approaches to CG and coding problems.

Always look to see if anyone has already done this type of thing, albeit in a
different, seemingly unrelated field. You may find an academic paper, a textbook
chapter, a Graphics Gem article, or actual code posted on a website.   Don't aim
for perfect - you likely just need "good 'nuff".


Post a reply to this message

From: Thomas de Groot
Subject: Re: Length of spline object changes during animation
Date: 19 Sep 2022 08:13:10
Message: <63285cd6$1@news.povray.org>
Op 19-9-2022 om 08:48 schreef Aj:
> A tutorial to the Inverse Kinematics Neck will be very helpful as I am still a
> beginner user.
> 

What you need can be found here:

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

-- 
Thomas


Post a reply to this message

From: ingo
Subject: Re: Length of spline object changes during animation
Date: 19 Sep 2022 09:15:00
Message: <web.63286b0870f1e1be17bac71e8ffb8ce3@news.povray.org>
"Aj" <nomail@nomail> wrote:

> 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.

A possible way is to "resample" your found spline with n pieces of cylinder with
the same length. Think of a "swan neck" sphere-cylinder-sphere-cylinder-sphere
etc. All depends on the smoothness you strive for.

ingo


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

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