POV-Ray : Newsgroups : povray.general : Bounding Box Within View Cone Server Time
2 Nov 2024 15:24:16 EDT (-0400)
  Bounding Box Within View Cone (Message 1 to 3 of 3)  
From: Mike H
Subject: Bounding Box Within View Cone
Date: 4 Mar 2004 23:22:57
Message: <404800a1$1@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?


Post a reply to this message

From: Slime
Subject: Re: Bounding Box Within View Cone
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

From: Mike H
Subject: Re: Bounding Box Within View Cone
Date: 6 Mar 2004 04:33:00
Message: <40499acc$1@news.povray.org>
Thanks a lot!


Post a reply to this message

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