POV-Ray : Newsgroups : povray.unofficial.patches : OBJECT IDEA : Re: OBJECT IDEA Server Time
5 Jul 2024 14:27:19 EDT (-0400)
  Re: OBJECT IDEA  
From: Le Forgeron
Date: 10 Jul 2002 13:47:26
Message: <3D2C6D06.5E44F486@free.fr>
Thorsten Froehlich wrote:
> 
> In article <3d2bca3e$1@news.povray.org> , "Majukatur"
> <maj### [at] hotmailcom> wrote:
> 
> > Well, this object not is a mesh of triangles, is a curve defined by 3 points
> > and its normal vectors, it is not an aproximation. There is an equation that
> > have all this characteristics, not is a mesh of triangles, is a mesh of
> > patchs, and it is easy to write this kind of meshes MANUALLY, for example,
> > you need only 4 "triangles" to describe an sphere, with normal meshes you
> > need hundreds of triangles. For describe ANY ellipse you need only 12
> > "triangles".
> 
> Why build a sphere out of triangles if you can just use the sphere object in
> POV-Ray?  Sounds like reinventing the wheel to me...
> 
>     Thorsten

By 3 points and 3 normals (only direction, with the same constraints that
is now on smooth_triangle (normals go to the same side)), how many spheres go through
?
If you are lucky, one; else none.
Problem is that most of the time, you will be unlucky (at least due to computational
errors but not only). 
This is because the center of the sphere should be at the intersection
of the three lines made by the normals and points. and there is no reason for theses
lines to intersect, even two by two. There is in fact no reason that two of them be
in any common plane.

Another approach with a sphere might be to use a mapping from the first point&normal
to always be a well know point on the sphere (such as the intersection of x axis with
the unit sphere) and then, using only the normals informations, placing the second and
third points of a geodesic triangle (additional contrainte for the second point should
be added also, so that it lies in the xOy plane for instance).
Then you will need to compute a transformation matrix (3 points give 3 points, so that
should be easy) and perform the intersection test against the geodesic triangle on
the unit sphere (as well as the normal computation).

Problems are:
Any two normals should not even be parallel (whereas currently it is possible with
smooth_triangle)
The three normals must ABSOLUTELY define a free base of 3D space 
And of course, the triangle must not be degenerated (or flat)

So it's not that easy to do by hand! At least the parser must be very strict.

Additional caveat: 
- the matrix found may be dependent on the order of the points,
which might end up that an ABC triangle is not identical to a ACB, 
or even a BCA triangle!!! [I need a mathematician here !!]
- Computation of the intersection with the geodesic triangle is not
straight ahead. The third point has far too much freedom, from a programmer
point of view! The hit on the sphere is easy (copy&paste from current sphere object)
but then the only hope I could see is to express the normal in the base of the 
three triangle normales, if any coefficient is negative, it's outside of the geodesic
triangle.

Rendering time (per triangle) is probably fine, but I'm afraid of optimisation,
because bounding the curved_triangle is probably not easy to do exactly
(bounding of unit sphere transformed by the inverse matrix is the best I can imagine,
and it leaves a lot of false positives).

I'm not sure, given the additional contraints and all the trouble,
 that this new object is forth its developpement. 
Could you come with some (basic) scenes/objects, which are not already covered
by the existings objects ? (the sphere was a bad example !)
-- 
Non Sine Numine
http://grimbert.cjb.net/
Etiquette is for those with no breeding;
fashion for those with no taste.


Post a reply to this message

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