POV-Ray : Newsgroups : povray.newusers : curious: degenerate triangles and cameras Server Time
1 Nov 2024 12:22:34 EDT (-0400)
  curious: degenerate triangles and cameras (Message 1 to 7 of 7)  
From: joost 1972
Subject: curious: degenerate triangles and cameras
Date: 20 Feb 2009 08:10:00
Message: <web.499eaafe5952c0ab2a36ae330@news.povray.org>
Hi,

I have a two questions out of curiosity.

First, I've made a generic macro to create different kinds of roofs for houses
with round edges. Now I get a loads of degenerate triangles messages (please
remove...). Is this a problem? And why does povray simply not render a
degenerate triangle, while a degenerate cylinder causes an error and stop in
rendering altogether?

Secondly I was wondering if there is an option to choose different camera angles
like there is the pull down menu for choosing the resolutions. Now changing
camera angles involves editing the code constantly (adding and removing // in
my case).

Thanks, Joost


Post a reply to this message

From: Kenneth
Subject: Re: curious: degenerate triangles and cameras
Date: 21 Feb 2009 00:05:01
Message: <web.499f887226995c43f50167bc0@news.povray.org>
"joost_1972" <joo### [at] hotmailcom> wrote:
> Hi,
ther?
>
> Secondly I was wondering if there is an option to choose different camera angles
> like there is the pull down menu for choosing the resolutions. Now changing
> camera angles involves editing the code constantly (adding and removing // in
> my case).
>

I feel your pain. By the time I've finished constructing a scene, I probably
have ten to fifteen 'test' cameras, that I'm constantly commenting in and out.

As far as camera angles go, I guess the simplest solution would be to #declare
my_angle = **--whatever--* at the start of the scene, then plug my_angle into
your camera(s). You're probably looking for something in a pull-down menu (as
you said), but this would be the second-easiest trick.

You *could* add angle definitions into the 'Insert Menu'--it's just a folder
containing text files. Create a separate text file for each camera-angle you
want--just write a number in each text file, I guess--put those files in a
folder with an appropriate name (and number/letter--open the 'Insert Menu'
folder to see what I mean), then your folder should show up in the Insert Menu
pull-down, where you can choose the camera angle you want, and insert it into
your camera(s). I don't *think* you even have to delete the default camera angle
there; the inserted one (if it comes after the default one) will override it.

BTW, to look at the individual Insert Menu files using POV-Ray, choose *All
Files* from the open dialogue (as opposed to *POV-Ray Files*); otherwise it
looks like there's nothing there (at least on my Windows system) because they
are simple text files (.txt)

Ken W.


Post a reply to this message

From: Chris B
Subject: Re: curious: degenerate triangles and cameras
Date: 21 Feb 2009 04:25:01
Message: <499fc86d$1@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote in message 
news:web.499f887226995c43f50167bc0@news.povray.org...
> "joost_1972" <joo### [at] hotmailcom> wrote:
>>
>> Secondly I was wondering if there is an option to choose different camera 
>> angles
>> like there is the pull down menu for choosing the resolutions. Now 
>> changing
>> camera angles involves editing the code constantly (adding and removing 
>> // in
>> my case).
>>

Another alternative is to name the different camera positions you want to 
use in the scene and store the settings for each position (camera settings, 
lighting, variable settings etc.) in a little macro/switch statement using 
the strcmp function. You could put it in a separate file if you wish to keep 
your main scene file tidy. The added advantage of this is that you can set 
variables to perform functions in the scene, such as opening/closing doors 
or conditionally removing objects from the scene if they would otherwise 
block the camera. For example:

#include "myscene_cameras.inc"
MyCamera("Top")

Then "myscene_cameras.inc" would just contain the macro:

#macro MyCamera(CameraAngle)
  #switch (0)
  #case (strcmp(CameraAngle,"Front"))
    camera {location <0,1.8,-2> look_at <0,0,0> angle 110}
    light_source {<-10,10,-35>, rgb 1}
  #break
  #case (strcmp(CameraAngle,"Top"))
    camera {location <0,4.8,-0.001> look_at <0,0,0> angle 50}
    light_source {<-10,10,-35>, rgb 1}
  #break
  #case (strcmp(CameraAngle,"Inside"))
    camera {location <0,0,0.001> look_at <0,0,0> angle 180}
    light_source {<0,0,>, rgb 1}
  #break
  #else
    camera {location <-1,1,0> look_at <0,0.5,0> }
    light_source {<10,10,-35>, rgb 1}
  #end
#end

When you set up a new scene it's a quick job to copy the file and adjust the 
settings for that new scene.

Regards,
Chris B.


Post a reply to this message

From: Chris B
Subject: Re: curious: degenerate triangles and cameras
Date: 21 Feb 2009 04:48:30
Message: <499fcdee$1@news.povray.org>
"joost_1972" <joo### [at] hotmailcom> wrote in message 
news:web.499eaafe5952c0ab2a36ae330@news.povray.org...
>
> First, I've made a generic macro to create different kinds of roofs for 
> houses
> with round edges. Now I get a loads of degenerate triangles messages 
> (please
> remove...). Is this a problem? And why does povray simply not render a
> degenerate triangle, while a degenerate cylinder causes an error and stop 
> in
> rendering altogether?
>

This simply means that two or more points on those triangles are in the same 
place (or very close together). If you're generating the triangles, then you 
could add logic into your macro to avoid or suppress degenerate triangles, 
but I don't think they're a serious problem, so you could just live with the 
messages. I think it's just warning messages and that POV-Ray simply renders 
the scene without those 'invisible' triangles.

I'm only guessing why the behaviour is different for degenerate triangles 
and cylinders, but:
Maybe the logic behind causing degenerate cylinders to stop the render is 
because it could be difficult to determine what to show in the scene. 
Degenerate triangles are invisible points or lines. If the end points of a 
cylinder are the same, but it has a non-zero radius, would you show two 
coincident disks or nothing at all? Alternatively, maybe the logic is that 
degenerate cylinders are usually easy to find and fix, whereas, oftentimes 
triangular meshes are generated by other programs and the problem can be 
embedded in amongst masses of data, making it very much more difficult to 
find and fix.

Regards,
Chris B.


Post a reply to this message

From: joost 1972
Subject: Re: curious: degenerate triangles and cameras
Date: 21 Feb 2009 10:10:01
Message: <web.49a017f726995c432a36ae330@news.povray.org>
Thanks for the quick reply's and advices. I've made a macro with all my camera's
(of course using only one letter to assign a camera, I wouldn't want to be
caught typing more than necessary  ;-). It is indeed easier than having to
search for the right camera in my own list and then commenting it in and
another out. Having a pull-down menu next to resolutions is probably a step to
far (maybe for a next version of POV-ray, if it ever sees the light of day....)

Regarding the degenerate triangles, I can follow your reasoning. I also left the
messages for what they were at the moment, because using "if" with every
triangle that had a possibility of becoming degenerate, would cost me a load of
work.

Thanks again, Joost


Post a reply to this message

From: Cousin Ricky
Subject: Re: curious: degenerate triangles and cameras
Date: 12 Mar 2009 08:00:00
Message: <web.49b8f81226995c4385de7b680@news.povray.org>
"joost_1972" <joo### [at] hotmailcom> wrote:
>  And why does povray simply not render a
> degenerate triangle, while a degenerate cylinder causes an error and stop in
> rendering altogether?

The cylindrical axis is required to orient the discs that cap the cylinder.  The
axis, in turn, requires 2 distinct end points.  With a zero-length cylinder, the
discs cannot be oriented, leaving no way to know what to render.  My guess is
that the POV Team decided it improper to proceed under that circumstance.
Degenerate triangles do not have this problem.

> Secondly I was wondering if there is an option to choose different camera angles
> like there is the pull down menu for choosing the resolutions. Now changing
> camera angles involves editing the code constantly (adding and removing // in
> my case).

I use command-line arguments.  For your specific question, using it straight as
the camera angle will suffice.  In the scene file, set:

   #ifndef (Cam) #define Cam = 60; #end
   camera
   {  angle Cam
   }

Then on the command line, use (for example):

   declare=Cam=25

For a more general solution (which is what I invariably need), use something
like:

   #ifndef (Cam) #define Cam = 0; #end
   camera
   {  switch (Cam)
      #case (1) /*camera settings*/ #break
      #case (2) /*camera settings*/ #break
      #case (3) /*camera settings*/ #break
      ...
      #else /*camera settings*/ #break
      #end
   }


Post a reply to this message

From: clipka
Subject: Re: curious: degenerate triangles and cameras
Date: 12 Mar 2009 11:50:00
Message: <web.49b92e5026995c43f708085d0@news.povray.org>
"Cousin Ricky" <ric### [at] yahoocom> wrote:
> The cylindrical axis is required to orient the discs that cap the cylinder.  The
> axis, in turn, requires 2 distinct end points.  With a zero-length cylinder, the
> discs cannot be oriented, leaving no way to know what to render.  My guess is
> that the POV Team decided it improper to proceed under that circumstance.
> Degenerate triangles do not have this problem.

Yes, the reason is probably that a degenerate triangle *unambiguously* collapses
to a single infinitely thin line (or even a single point) which cannot be seen
from *any* angle, and therefore just ignoring it a perfect way to handle it.
The warning is just there to make the user aware, in case it was *not* intendet
that way.

A degenerate cylinder with non-zero radius, however, *should* be an infinitely
thin disk, which *should* be visible unless viewed edge-on, but cannot be
defined unambiguously using the define-by-endpoint approach of POV SDL.

The bottom line is that it is clear how a degenerate triangle should look like,
but not so for a degeenrate cylinder.


Post a reply to this message

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