POV-Ray : Newsgroups : povray.general : How to check if two objects have any intersection? : Re: How to check if two objects have any intersection? Server Time
24 Apr 2024 15:36:51 EDT (-0400)
  Re: How to check if two objects have any intersection?  
From: Bald Eagle
Date: 30 Jan 2020 17:40:00
Message: <web.5e335a3d78dd10884eec112d0@news.povray.org>
"Kima" <nomail@nomail> wrote:

> but apparently, trace return a vector, when if statement needs a numeric
> expression.

Well, since trace {} returns <0, 0, 0> as the surface normal if it misses the
object, then you can just add together the x, y, and z components of the vector
to give a scalar value.  Use abs() so nothing cancels out.

#declare TraceBool = abs(Normal.x)+abs(Normal.y)+abs(Normal.z);

http://news.povray.org/povray.binaries.tutorials/thread/%3Cweb.51f61e827603294573fc9ebb0%40news.povray.org%3E/

Gonna be tricky with CSG to look at the right place and get an accurate result.
If they are curves / algebraic surfaces, then I might see about doing the math
to see if there are any intersection points.

Just curious - what if you did:
intersection {
     ObjectA
     ObjectB
}
and computed the volume of the bounding box?

At the very least, if you're "scanning" with trace{}, then it would give you a
much smaller, and accurate volume to focus on.


Post a reply to this message

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