POV-Ray : Newsgroups : povray.general : Megapov intersection points : Re: Megapov intersection points Server Time
26 Apr 2024 21:31:58 EDT (-0400)
  Re: Megapov intersection points  
From: Bald Eagle
Date: 10 Feb 2019 16:05:00
Message: <web.5c609108912c710e765e06870@news.povray.org>
"muyu" <lsy### [at] gmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > "muyu" <lsy### [at] gmailcom> wrote:
> > > I would like extract the coordinates (X, Y, Z) of all the intersection points in
> > > the image.

[Here's my newbie woeful misunderstanding thread:
http://news.povray.org/povray.general/thread/%3C520fb859%241%40news.povray.org%3E/
    ]

I would like to get the
coordinates of the each pixel in the rendered image, corresponding to the
shortest interaction point

"Shortest interaction point" ...
Like, the point on the surface of the sphere that is closest to one of the
planes of the box...?


I tend to use code from Graphics Gems for that sort of thing,
http://www.realtimerendering.com/resources/GraphicsGems/category.html

I used some of that here:
http://news.povray.org/povray.binaries.images/thread/%3Cweb.587ce3fc782d1af2c437ac910%40news.povray.org%3E/?mtop=415328


Here's a thing on trace() that I did around 5 years ago:
http://news.povray.org/povray.binaries.tutorials/thread/%3Cweb.51f61e827603294573fc9ebb0%40news.povray.org%3E/

plus there is some explanation in the documentation and the wiki

http://wiki.povray.org/content/Documentation:Tutorial_Section_3.9#Calculating_the_closest_intersection


Here's the entry from the "[F1] Help"

trace(OBJECT_IDENTIFIER, A, B, [VECTOR_IDENTIFIER]). trace helps you finding the
exact location of a ray intersecting with an object's surface. It traces a ray
beginning at the point A in the direction specified by the vector B. If the ray
hits the specified object, this function returns the coordinate where the ray
intersected the object. If not, it returns <0,0,0>. If a fourth parameter in the
form of a vector identifier is provided, the normal of the object at the
intersection point (not including any normal perturbations due to textures) is
stored into that vector. If no intersection was found, the normal vector is
reset to <0,0,0>.

Note: Checking the normal vector for <0,0,0> is the only reliable way to
determine whether an intersection has actually occurred, intersections can and
do occur anywhere, including at <0,0,0>.

Example:

#declare MySphere = sphere { <0, 0, 0>, 1 }
#declare Norm = <0, 0, 0>;
#declare Start = <1, 1, 1>;
#declare Inter=
trace ( MySphere, Start, <0, 0, 0>-Start, Norm );

object {
  MySphere
  texture {
    pigment { rgb 1}
    }
  }

#if (vlength(Norm)!=0)
cylinder {
  Inter, Inter+Norm, .1
  texture {
    pigment {color red 1}
    }
  }
#end


Post a reply to this message

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