POV-Ray : Newsgroups : povray.advanced-users : Calculate distance between point and viewport : Re: Calculate distance between point and viewport Server Time19 May 2024 14:21:22 EDT (-0400)
 Re: Calculate distance between point and viewport
 From: Bald Eagle Date: 23 Feb 2020 16:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.5e52ed3ddd9dce8e4eec112d0%40news.povray.org",
"headline": "Re: Calculate distance between point and viewport",
"dateCreated": "2020-02-23T21:25:00+00:00",
"datePublished": "2020-02-23T21:25:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
Mike Horvath <mik### [at] gmailcom> wrote:

> 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

OK - that's just the plane equation, IIRC: Ax+By+Cz-D = 0
Also in F. Lohmueller's analytical geometry include file (Insert Menu?)
and you just set the "offset" from the origin with D.
same as you'd do with plane {z, D}

Then you calculate the distance of the point from that plane.

http://news.povray.org/povray.binaries.images/message/%3Cweb.5880fc4d1652a4dcc437ac910%40news.povray.org%3E/#%3Cweb.588
0fc4d1652a4dcc437ac910%40news.povray.org%3E

> and lie somewhere beyond the extents of
> the model.

That's confusing, since usually the image projection plane is "in front of" all
the stuff - between the camera and the "model", not "beyond the extents" of it.

But I think the link gives you exactly what you need.
```