POV-Ray : Newsgroups : povray.advanced-users : Calculate distance between point and viewport : Calculate distance between point and viewport Server Time
29 Nov 2022 18:59:01 EST (-0500)
  Calculate distance between point and viewport  
From: Mike Horvath
Date: 23 Feb 2020 13:01:04
Message: <5e52bde0$1@news.povray.org>
How do I calculate the distance between a point and the camera? Except, 
I am using an orthographic camera, so I really need the distance between 
a point and the plane formed by the camera's up and right vectors. 
Here's my camera definition. Thanks.


Mike



#declare Camera_Diagonal	= cosd(45);
#declare Camera_Aspect		= image_height / image_width;
#declare Camera_Width		= 10240;	// was 7680 * 4/3
#declare Camera_Vertical	= 225;		// was 225
#declare Camera_Horizontal	= 30;
#declare Camera_Distance	= Camera_Width;
#declare Camera_Up			= -y * Camera_Diagonal * Camera_Width * Camera_Aspect;
#declare Camera_Right		= +x * Camera_Diagonal * Camera_Width;
#declare Camera_Location	= -z * Camera_Distance;
#declare Camera_Direction	= +z * Camera_Distance;
#declare Camera_LookAt		= Camera_Location + Camera_Direction;
#declare Camera_Rotate		= <-Camera_Horizontal,Camera_Vertical,0,>;
#declare Camera_Scale		= 4;
#declare Camera_Translate	= <0,0,0>;
#declare Camera_Transform = transform
{
	rotate		Camera_Rotate
	scale		Camera_Scale
	translate	Camera_Translate
}

camera
{
	orthographic
	up			Camera_Up
	right		Camera_Right
	location	Camera_Location
	direction	Camera_Direction
	transform {Camera_Transform}
}

#declare Camera_Location	= vtransform(Camera_Location,Camera_Transform);
#declare Camera_LookAt		= vtransform(Camera_LookAt,Camera_Transform);


Post a reply to this message

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