POV-Ray : Newsgroups : povray.off-topic : discrete torque : Re: discrete torque Server Time
28 Jul 2024 12:22:13 EDT (-0400)
  Re: discrete torque  
From: Le Forgeron
Date: 25 Feb 2014 04:06:18
Message: <530c5d0a@news.povray.org>
Le 25/02/2014 08:28, Anton Sherwood a écrit :
> So there's this thing I want to do, simulating self-assembly of a few
> dozen parts.  The idea is that each part has a small number of nodes
> that are attracted to corresponding nodes on other parts.
> 
> To find its proper place, a part will generally have to be both
> translated and rotated.  Translation is easy: for each node there's a
> vector to its mate, and the part moves on each step by some fraction
> (probably half) of the average of these vectors.
> 
> Rotation is where I'm stuck.  The obvious metaphor is torque: cross that
> node-to-node translation vector with the center-to-node vector, and you
> get a torque vector, and all the torque vectors for each part can be
> averaged together ...
> 
> But wait, I don't want to give the part some angular momentum, I want it
> to *step* by the needed rotation.  I want a function that translates
> (pardon the pun) the sum of these pseudo-torque vectors into a rotation
> matrix -- and I never did study 3D rotation matrices.
> 
> So, have you done anything similar?
> 
You should move from 3x3 matrices (X,Y,Z, homogeneous coordinates) to
represent rotation to 4x4 matrices (weighted projective coordinates:
t,u,v,w ; with x=t/w, y=u/w and z=v/w) to represent all affine
transformations (rotation & translation (and more, but you did not talk
of them)).

From all your transformations (R & T), you compute the combination of
them all (M = R.T, if you apply first the rotation then the
translation), then you can use a linear interpolation to have the
various steps at constant momentum: for k between 0 and 1, the
transformation is k.M

You can even have acceleration or deceleration effect by keeping k
regularly spaced, but using a power of k to multiply M (the power could
be fractional like 1/2 for a square root, or 2... )
In fact, you might even have a mapping curve via a function f(k) as long
as f(0) -> 0, f(1)-> 1 and f(k)-> [0,1) for k in [0,1) : the
transformation would be f(k).M
the change of momentum would then be the first derivative of f().




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


Post a reply to this message

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