|
![](/i/fill.gif) |
Chrisir wrote:
>
> Hello,
>
> I have a small mathematical question here.
>
> (Please note: This is a completely different question than my last one, it just
> sounds similar ;-)
>
http://news.povray.org/povray.animations/thread/%3Cweb.4d6a542c8f7061ba22dbc4580%40news.povray.org%3E/
> )
>
>
> How can I calculate a 3D-Point C based on two other A and B?
>
> The situation is as follows:
>
> I have a Marble with the center C. I want to calculate this 3D-Center as CX, CY,
> CZ (Marble Radius R).
>
> The Marble runs on a track that consists of two small thin parallel wires. The
> Marble is running between them, because their distance is a little smaller than
> 2R.
> Like this:
> http://www.youtube.com/watch?v=me1D1WZ0yNM
>
> Anyway. Let's say the Marble is on the track and rolling. Continuously I will
> have to calculate CX, CY, CZ during the animation.
>
> The Marble is touching the left wire at point A (AX,AY,AZ) and the right wire at
> a point B (BX,BY,BZ).
>
> Let's assume the wires go parallel towards Z. Thus AX would be a little smaller
> than BX and AY = BY (Height, the Marble is above the wires and has a higher
> Y-value) and AZ = BZ (depth).
>
> C would then be:
> CX = (AX + BX) / 2 (in the middle between the wires)
> CY = AY + R - 0.3 (or so, depending on how deep the Marble is between the wires)
> CZ = AZ.
>
> When the Marble rolls, the Z-values increase.
>
> But the wires of course do curves and loopings and spirals and so on.
>
> So the situation is always different and AX<>BX and AY<>BY and AZ<>BZ. So the
> calculation of C is more difficult.
>
> I am looking for a general formular that would be the solution for
> CX=
> CY=
> CZ=
>
> based on A and B.
>
> The point C would always be in a right angle above the wires. Or, in a looping,
> inside the looping, under the wires. Where my maths fail me.
>
> All help is appreciated.
>
>
> Thank you so much!
>
> Chris
>
>
> P.S.
> I could write a lot more about this. Actually, it would be cooler to have a
> physics-engine that simulates the Marble-Position based on my wires but it has
> to be done via a formula for now.
> At the moment my problem is that the Marble is above the wires or is cutting
> through the wires which looks bad in my animation.
>
>
With
W1 = vector point of wire 1
W2 = vector point of wire 2
Wr = radius of wires
R = radius of marble
looking for: MCP = marble Center vector point
Cp= (W1+W2)/2 , center point
L=vlenght(Cp-W1);
Cv= VPerp_To_Vector(Cp-W1), this when added to the Center point
is a Perpendicular line between W1,W2
H= sqrt(pow(Wr+R,2)-pow(L,2)) height along the Perpendicular line
between W1,W2
MCP=H*Cv+Cp; Done!
If I understand your problem this should do it.
The VPerp_To_Vector(Cp-W1) has the left handed right handed crap. So
if Cv is pointed in the wrong direction change (Cp-W1) to (W1-Cp)
Have fun!
Post a reply to this message
|
![](/i/fill.gif) |