POV-Ray : Newsgroups : povray.general : Calculate 3D-Point based on two other : Calculate 3D-Point based on two other Server Time
29 Jul 2024 14:11:14 EDT (-0400)
  Calculate 3D-Point based on two other  
From: Chrisir
Date: 8 Mar 2011 12:10:01
Message: <web.4d7662a2f7703718ce9a42b60@news.povray.org>
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.


Post a reply to this message

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