POV-Ray : Newsgroups : povray.general : Bounding Box Within View Cone : Re: Bounding Box Within View Cone Server Time
2 Nov 2024 13:19:27 EDT (-0400)
  Re: Bounding Box Within View Cone  
From: Slime
Date: 5 Mar 2004 23:43:00
Message: <404956d4@news.povray.org>
> Could anyone describe to me a method of checking if an object's bounding
> box can be found within the camera's view cone?

A quick check could work like this (untested code):

#declare cameraConeAngle = 30.0; // you'll have to figure this value out on
your own
#declare cameraPosition = <1,2,3>; // enter camera position
#declare cameraLookAt = <4,5,6>; // enter camera's look_at point

#declare cameraDir = cameraLookAt - CameraPosition;

#macro isPointVisible(point)
#declare returnvalue = false;

#if (acos(vdot(point - cameraPosition, cameraDir)) <= cameraConeAngle)
#declare returnvalue = true;
#end

returnvalue
#end


Then just use the isPointVisible macro on each corner of the object's
bounding box.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

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