POV-Ray : Newsgroups : povray.advanced-users : triangle centers : Re: triangle centers Server Time
29 Jul 2024 00:30:59 EDT (-0400)
  Re: triangle centers  
From:
Date: 10 Jul 2003 22:30:26
Message: <3f0e2142$1@news.povray.org>
Hi David,

you interchanged the last two parameters:

   #macro InCircle(p1, p2, p3, cen, rad)

   InCircle(<...>, <...>, <...>, odfRadI, odfCenI)

Your InCenter calculkation is buggy; correct and much easier is this:

   #declare cen = (ln3*p1+ln2*p2+ln1*p3)/2/hPer;

The variables dr1, dr2, dr3, drb1, drb2 are not needed for this.
Here is a link to the formula:
http://mathforum.org/dr.math/faq/formulas/faq.ag2.html#twotriangles

Looking at the corners and the intersection of the circle and the
upper diagonal of

   object { odfBrace scale <1, 1, 0.01> }

with one of these cameras:

   camera { location -0.1*z look_at 0 translate 3.15*x }
   camera { location -0.1*z look_at 0 translate -3.15*y }
   camera { location -0.3*z look_at 0 translate 1.425*(x-y) }

I suppose you wanted these diagonals:

   box {
    < 0.00,-2.86-0.01*sqrt(2),-0.015>,< 2.85+0.01*sqrt(2),-2.86, 0.015>
    matrix <1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0>
    clipped_by { plane { y, 0 } }
   }
   box {
    < 0.01,-3.16,-0.015>,< 3.15,-3.16+0.01*sqrt(2), 0.015>
    matrix <1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0>
    clipped_by { plane { y, 0 } }
   }

or (much easier in my opinion):

   // a box to the right and below the line <0, -2.86>--<2.86, 0>
   box { -0.015*z, <sqrt(2*2.86*2.86), -0.01, 0.015>
     rotate 45*z

     translate -2.86*y
     }
   // a box to the left and above the line <0.01, -3.15>--<3.15, 0.01>
   box { -0.015*z, <sqrt(2*3.14*3.14), 0.01, 0.015>
     rotate 45*z

     translate <0.01, -3.15, 0>
     }

( sqrt(2*2.86*2.86) = distance(<0,-2.86>, <2.86,0>)
sqrt(2*3.14*3.14) = distance(<0.01,-3.15>, <3.15,-0.01>) )

   Sputnik

P.S. I suggest to use well-named variables instead of the constants:
   #declare Length = 3;
   #declare Offset = 0.15; // Length+Offset=3.15; Length-Offset=2.85
   #declare Thick = 0.01;
etc; then calculate everything else from this. This would make it VERY
easy to change the size and shape. A much bigger value for "Thick"
would help to check the correct alignment of all the elements, because
many errors would be easily visible. In your code, such a change would
require extensive re-calculation by hand; with a variable, POV-Ray does
the calculations, you only edit one declaration.


Post a reply to this message

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