POV-Ray : Newsgroups : povray.general : How can we check if an object is within another object? : How can we check if an object is within another object? Server Time
19 Apr 2024 13:28:56 EDT (-0400)
  How can we check if an object is within another object?  
From: Kima
Date: 12 Jun 2020 10:40:00
Message: <web.5ee39371fd9c2fa8ecc0fada0@news.povray.org>
Consider this prism

  prism {
    linear_sweep
    cubic_spline
    0, 1, 18,
    <3,-5>, <3,5>, <-5,0>, <3, -5>, <3,5>, <-5,0>,
    <2,-4>, <2,4>, <-4,0>, <2,-4>, <2,4>, <-4,0>,
    <1,-3>, <1,3>, <-3,0>, <1, -3>, <1,3>, <-3,0>
    pigment { color rgb<0,1,0> }
  }

I want to draw the biggest sphere with the centre of <0,0,0> which can fit
within the inner part of the prism (not the whole prism; and then, min_extent
and max_extent are useless here).

Is there a direct way to do so?

I came with an idea to check a set of spheres in a loop,

  #local i = 0.1;
  #while(i<1000)
    #if(CONDITION)
      sphere{<0,0,0>,1.8 pigment{color rgb<1,1,1>}}
      #break
    #end
  #local i = i+0.1;
  #end

I need the CONDITION.

Since we should run this test in a loop, the performance is of utmost
importance.

Note that y-axis is not important here. We can draw the prism from -1000 to 1000
and find the biggest sphere, which is not visible from outside.


Post a reply to this message

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