POV-Ray : Newsgroups : povray.advanced-users : Calculate distance between point and viewport : Re: Calculate distance between point and viewport Server Time19 May 2024 13:58:02 EDT (-0400)
 Re: Calculate distance between point and viewport
 From: Mike Horvath Date: 23 Feb 2020 14:55:01 Message: <5e52d895@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#5e52d895%40news.povray.org",
"headline": "Re: Calculate distance between point and viewport",
"dateCreated": "2020-02-23T19:55:01+00:00",
"datePublished": "2020-02-23T19:55:01+00:00",
"author": {
"@type": "Person",
"name": "Mike Horvath"
}
}
On 2/23/2020 1:45 PM, Bald Eagle wrote:
>
> VDist(V1, V2). Compute the distance between two points.
> Parameters:
>
> V1, V2 = Input vectors.
>
> http://www.povray.org/documentation/view/3.7.1/459/
>
> So, you could either compute the distance between the Camera_Transform[ed]
> Camera_Location and Camera_LookAt, or since IIRC the default camera uses a
> projection plane one POV-unit away from the camera, you could normalize that and
> multiply it by the length of the Camera_Distance vector...
>

No, the first point is somewhere in space and is not connected to the
camera.

> Mike Horvath <mik### [at] gmailcom> wrote:
>> 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.
>
> Or you could use a Graphics Gems macro to actually calculate the shortest
> (perpendicular) distance between the (transformed) camera point and the
> (transformed) up-right plane.
>
>

The plane doesn't actually have to be the up-right plane exactly, but it
does need to be parallel to it and lie somewhere beyond the extents of
the model.

Mike
```