POV-Ray : Newsgroups : povray.programming : Different Objects : Re: Different Objects Server Time
25 Apr 2024 17:58:55 EDT (-0400)
  Re: Different Objects  
From: Le Forgeron
Date: 29 Jul 2014 05:27:24
Message: <53d768fc@news.povray.org>
On 29/07/2014 11:05, bakom wrote:
> FractRacer <lg.### [at] gmailcom> wrote:
>> Le 29/07/2014 05:08, bakom a écrit :
>>> I want to convert BRL-CAD's arb5 model's vertices into POV-ray's vertices, so I
>>> am looking into easiest way for doing it.
>>>
>>
>> You can export your model in *.stl and use the stl2pov converter
>>
>> http://rsmith.home.xs4all.nl/software/py-stl-stl2pov.html
>>
> 
> Its ok, I tried this. But actually I am making a converter for BRL-CAD i.e.
> g-pov which converts BRL-CAD's .g database models directly into POV-ray models.
> I want easiest ways so that if model in BRL-CAD is formed by 5 vertices (take it
> as example) then it can be converted in POV-ray models by using those vertices.
> 

If you are not afraid of coincident surface, your object is not textured
with transparency and you do not need inside test, you can use mesh (or
rather mesh2 format) to generate the full set of triangles between all
the vertices.
It's just brute force combinations.

mesh2{
 vertex_vectors {
   5,
   ... // your 5 vertices coordinates here
   }
 face_indices {
   10,
   <0,1,2>,
   <0,1,3>,
   <0,1,4>,
   <0,2,3>,
   <0,2,4>,
   <0,3,4>,
   <1,2,3>,
   <1,2,4>,
   <1,3,4>,
   <2,3,4>
 }
// texture as usual
}

For N vertices, the number of face is N!/((N-3)!*3!) . (aka C(N,3) )
4 -> 4, 5-> 10, 6-> 20, 7-> 35.
You can use three loops to automatically generate the face indices,
according to N.

If you want a smarter transformation, you need to detect external
coplanar set of more than three points and choose a method to split the
polygon in triangles.

-- 
IQ of crossposters with FU: 100 / (number of groups)
IQ of crossposters without FU: 100 / (1 + number of groups)
IQ of multiposters: 100 / ( (number of groups) * (number of groups))


Post a reply to this message

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