POV-Ray : Newsgroups : povray.programming : Explanation of source code Server Time 2 Dec 2023 23:02:47 EST (-0500)
 Explanation of source code (Message 1 to 3 of 3)
 From: queercore Subject: Explanation of source code Date: 8 Apr 2009 20:15:01 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.49dd3d09768cb580672cb3f90%40news.povray.org",
"headline": "Explanation of source code",
"dateCreated": "2009-04-09T00:15:01+00:00",
"datePublished": "2009-04-09T00:15:01+00:00",
"author": {
"@type": "Person",
"name": "queercore"
}
}
Hi,

These are the normals and distances of the planes that define the 3D viewing
volume. Where is the origin of these vectors? Is it in the middle of the
projection plane?

const VECTOR VIEW_VX1 = {-0.8944271910, 0.0, -0.4472135955};
const VECTOR VIEW_VX2 = { 0.8944271910, 0.0, -0.4472135955};
const VECTOR VIEW_VY1 = {0.0, -0.8944271910, -0.4472135955};
const VECTOR VIEW_VY2 = {0.0,  0.8944271910, -0.4472135955};
const DBL VIEW_DX1 = 0.4472135955;
const DBL VIEW_DX2 = 0.4472135955;
const DBL VIEW_DY1 = 0.4472135955;
const DBL VIEW_DY2 = 0.4472135955;
```
 From: Thorsten Froehlich Subject: Re: Explanation of source code Date: 9 Apr 2009 01:19:29 Message: <49dd8561@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#49dd8561%40news.povray.org",
"headline": "Re: Explanation of source code",
"dateCreated": "2009-04-09T05:19:29+00:00",
"datePublished": "2009-04-09T05:19:29+00:00",
"author": {
"@type": "Person",
"name": "Thorsten Froehlich"
}
}
May I suggest you check out the books listed in the documentation for
understanding the algorithms used in POV-Ray? It is not like the algorithms
were conjured up by the POV-Team from thin air ;-) Well, actually some were,
but that is another story...

There is plenty of other ray-tracing literature out there, too. If you need
well-annotated ray-tracing source code, I would recommend the book
"Physically Based Rendering", which explains pretty must everything there is
necessary to know.

Grown source code like that in POV-Ray is not particularly suited to learn
the basics of ray-tracing. Books are much better for that :-)

Thorsten, POV-Team
```
 From: queercore Subject: Re: Explanation of source code Date: 9 Apr 2009 17:50:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.49de6c76c27d963d286d253e0%40news.povray.org",
"headline": "Re: Explanation of source code",
"dateCreated": "2009-04-09T21:50:00+00:00",
"datePublished": "2009-04-09T21:50:00+00:00",
"author": {
"@type": "Person",
"name": "queercore"
}
}
Thorsten Froehlich <tho### [at] trfde> wrote:
> May I suggest you check out the books listed in the documentation for
> understanding the algorithms used in POV-Ray? It is not like the algorithms
> were conjured up by the POV-Team from thin air ;-) Well, actually some were,
> but that is another story...
>
> There is plenty of other ray-tracing literature out there, too. If you need
> well-annotated ray-tracing source code, I would recommend the book
> "Physically Based Rendering", which explains pretty must everything there is
> necessary to know.
>
> Grown source code like that in POV-Ray is not particularly suited to learn
> the basics of ray-tracing. Books are much better for that :-)
>
>  Thorsten, POV-Team

Thanks for your suggestion. Actually I am trying to study the version 3.6.0 of
POV-ray for windows for my undergraduate thesis and I know the basics of ray
tracing already. I am afraid I do not have much time to go through all the
suggested reading because my deadline to submit the thesis is very near. I have
read other books and online materials. I was able to understand many of the
algorithms. My appologies for bothering you with my simple questions but it
would help me greatly if you answer the question. I have spent quite a lot of
time trying to figure it out.

My question is, these are the defined values of left, right, top and bottom
plane normals and distances for polygon clipping.

/* Planes for 3d-clipping. */

const VECTOR VIEW_VX1 = {-0.8944271910, 0.0, -0.4472135955};
const VECTOR VIEW_VX2 = { 0.8944271910, 0.0, -0.4472135955};
const VECTOR VIEW_VY1 = {0.0, -0.8944271910, -0.4472135955};
const VECTOR VIEW_VY2 = {0.0,  0.8944271910, -0.4472135955};
const DBL VIEW_DX1 = 0.4472135955;
const DBL VIEW_DX2 = 0.4472135955;
const DBL VIEW_DY1 = 0.4472135955;
const DBL VIEW_DY2 = 0.4472135955;

They are passed to Clip_Polygon to clip the sides of bounding volumes when all
of its points are not inside the viewing volume. I understood the clipping
algorithm but, where is the origin of these vectors? I think it is in the
middle of the projection plane.

I have to draw pictures to explain the algorithm. So, please answer the
question.
```