POV-Ray : Newsgroups : povray.general : Bounce vectors Server Time
29 Dec 2024 12:55:30 EST (-0500)
  Bounce vectors (Message 1 to 5 of 5)  
From: Some Yahoo
Subject: Bounce vectors
Date: 12 Jul 2011 22:57:20
Message: <4e1d0990$1@news.povray.org>
I'm looking for a way to calculate the bounce off the interior of a sphere...


I have a position, a velocity vector and my sphere is hollow and centered at the
origin.

I'm pretty sure that Velocity=-Velocity is not right, though in my head it seems
logical.


Post a reply to this message

From: Le Forgeron
Subject: Re: Bounce vectors
Date: 13 Jul 2011 04:55:08
Message: <4e1d5d6c$1@news.povray.org>
Le 13/07/2011 04:57, Some Yahoo nous fit lire :
> I'm looking for a way to calculate the bounce off the interior of a
> sphere...
> 
> 
> I have a position, a velocity vector and my sphere is hollow and
> centered at the origin.
> 
> I'm pretty sure that Velocity=-Velocity is not right, though in my head
> it seems logical.

Velocity := -Velocity is correct only when position & Velocity are
aligned (you came through the center of the sphere, you go back to it)

For other positions, you need to find the intersection point on the
sphere and mirror the velocity in regard to the normal of the sphere at
that point.


Post a reply to this message

From: Some Yahoo
Subject: Re: Bounce vectors
Date: 13 Jul 2011 19:03:56
Message: <4e1e245c$1@news.povray.org>
On 7/13/2011 1:55 AM, Le_Forgeron wrote:
> Le 13/07/2011 04:57, Some Yahoo nous fit lire :
>> I'm looking for a way to calculate the bounce off the interior of a
>> sphere...
>>
>>
>> I have a position, a velocity vector and my sphere is hollow and
>> centered at the origin.
>>
>> I'm pretty sure that Velocity=-Velocity is not right, though in my head
>> it seems logical.
>
> Velocity := -Velocity is correct only when position&  Velocity are
> aligned (you came through the center of the sphere, you go back to it)
>
> For other positions, you need to find the intersection point on the
> sphere and mirror the velocity in regard to the normal of the sphere at
> that point.

ok, lets pretend I failed 3D calculus...

Sphere is <0,0,0>,100

I can use VDist to see when the marbles hit  each marble has

position (vector)
velocity (vector)


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Bounce vectors
Date: 13 Jul 2011 19:57:50
Message: <4e1e30fe@news.povray.org>
Some Yahoo wrote:

> ok, lets pretend I failed 3D calculus...

that's no problem you only need linear algebra ;)

> Sphere is <0,0,0>,100

You can use the trace function to find the intersection point
of the precollision path with the target surface. This will also
give you the normal vector (of course, in the case of a hollow
sphere this will just point to the sphere center). Mirroring the
in vector with the surface normal gives you the (inverted) out
vector. Probably the easiest way to do the mirroring is to
rotate 180 degree about the normal using vaxis_rotate.


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Bounce vectors
Date: 14 Jul 2011 02:46:14
Message: <4e1e90b6$1@news.povray.org>
Some Yahoo wrote:
> On 7/13/2011 1:55 AM, Le_Forgeron wrote:
>> Le 13/07/2011 04:57, Some Yahoo nous fit lire :
>>> I'm looking for a way to calculate the bounce off the interior of a
>>> sphere...
>>>
>>>
>>> I have a position, a velocity vector and my sphere is hollow and
>>> centered at the origin.
>>>
>>> I'm pretty sure that Velocity=-Velocity is not right, though in my 
head
>>> it seems logical.
>>
>> Velocity := -Velocity is correct only when position&  Velocity are
>> aligned (you came through the center of the sphere, you go back to it)

>>
>> For other positions, you need to find the intersection point on the
>> sphere and mirror the velocity in regard to the normal of the sphere a
t
>> that point.
> 
> ok, lets pretend I failed 3D calculus...
> 
> Sphere is <0,0,0>,100
> 
> I can use VDist to see when the marbles hit  each marble has
> 
> position (vector)
> velocity (vector)
> 
	velocity - 2 * dot(velocity, normal) * normal

	Where:
- dot(a, b) := a.x*b.x + a.y*b.y + a.z*b.z is the dot product;
- normal := position / 100 is the unit normal at intersection.

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

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