POV-Ray : Newsgroups : povray.general : How can we check if an object is within another object? : Re: How can we check if an object is within another object? Server Time
20 Apr 2024 03:05:57 EDT (-0400)
  Re: How can we check if an object is within another object?  
From: William F Pokorny
Date: 12 Jun 2020 14:41:02
Message: <5ee3cc3e$1@news.povray.org>
On 6/12/20 1:31 PM, Bald Eagle wrote:
> 
> "Kima" <nomail@nomail> wrote:
> 
>> I want to draw the biggest sphere with the centre of <0,0,0> which can fit
>> within the inner part of the prism
> 
>> Is there a direct way to do so?
> 
> This would be the inscribed circle, or the inscribed sphere.
> You might be able to do it with a matrix, but I'm guessing.
> 
> You could do it numerically / computationally / algorithmically by taking sets
> of adjacent vertices, calculating the coordinates of the midpoint, and measuring
> the distance from the origin.   The minimum distance would give you what you
> want.
> 
> 
>> I need the CONDITION.
> 
> Do you just want to do an insidedness test?
> #if (inside (prism, point)) ....
> 
> If you want to have each sphere be fully inside the prism, construct a smaller
> test prism where the edges are closer to the origin by the radius of the
> spheres.   Test against that, and then render the spheres in the actual prism.
> 
> 
I don't think there is any general approach other than sampling.

As Bald Eagle suggested, inside prism tests around the circle after each 
growth/shrink.

Or you could fire of a sample set of trace()s from the circle origin 
outward (toward the prism's, circle containing, inside surface), taking 
the smallest ray length found as your circle's radius. No grow/shrink 
search with the latter approach.

Sampling though, so a perfectly inscribed you might not get...

Bill P.


Post a reply to this message

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