POV-Ray : Newsgroups : povray.binaries.images : Fat triangles : Re: Fat triangles Server Time
2 May 2024 03:36:23 EDT (-0400)
  Re: Fat triangles  
From: lelama
Date: 1 Jun 2018 05:30:00
Message: <web.5b111102532d7f8621263ef70@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> My naive take on this is just instantiate 3 spheres, put 3 cones in - that
> stretch between centers and have the appropriate radii on either end,  and then
> place 2 triangles stretching across the top and bottom center points of the
> spheres.
> This of course assumes that the spheres are coplanar with - let's say, the x-z
> plane.
>

Hi Bald Eagle,
Unfortunatly, the vertices of the triangles are not the top and bottom of the
shperes. This is the tricky part. I don't know if Jim had a simpler idea
but here is how I did proceed.

Preparation step in the plane. It is not too difficult find the equation of a
line tangent to two circles located on a horizontal line and above the circles.
Correspondingly, if you have  now two shperes in diementsion 3 with centers on
(0,0,0) and (x,0,0), basically the same computation gives you the equation of a
horizontal plane tangent to 2 spheres. Now you want the plane P2 tangent to
three spheres (above the spheres), not the horizontal plane P1 tangent to two
spheres. Note that  P2 is obtained from P1 by a rotation  around the axis Ox. We
normalize the equations of the planes and put them in the form ax+by+cz=1, ie
the constant is normalized to 1. With this normalization fixed, the roational
difference between P1 and P2 corresponds algebraically to the fact that P1 and
P2 have the same constant a in their equation. Since you know the coeffs of P1,
you have a formula for the a-coeff of P2.

One coefficient has been discovered using a pair of spheres. Since there are
three pairs of spheres that you can use, this finally gives completly the
coefficients of the plane tangent to the three spheres.


> I've been meaning to code up some of the more basic "here's where two lines
> intersect" type tools - but then some damned thing IRL always becomes higher
> priority.  :(

Many of these geometric tools (intersection of
lines,planes,projections,coordinate changes...) have been implemented
in Pycao ( my software to describe povray scenes with the python language). Feel
free to use it or to look at the code if you prefer the povray sdl language.
(This is a gpl license).


Post a reply to this message

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