Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Another Polyhedra question

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Another Polyhedra question


Chronological Thread 
  • From: Martin Baeker <>
  • To:
  • Subject: Re: [cgal-discuss] Another Polyhedra question
  • Date: Wed, 17 Mar 2010 08:12:06 +0100 (CET)
  • Organization: Institut fuer Werkstoffe TU Braunschweig

Hi Priyank,

thanks for the mail. I'm a bit confused, though, because the manual
states that a Polyhedron consists of halfedges - what exactly do you
mean by loosing half-edge information? I can write a polyhedron to an
off and read it back in - so far, it seems that I only loose on
additional information like the plane - I presume, I'll loose
everything that is marked as optional in the Polyhedron_3-section
"Types for Tagging Optional Features"

BTW, why do you write a renderer? Isn't there is a QT-renderer
available (it is for Nef-Polyhedra), or is yours more powerful? In
that case, I'd be interested in having a look...

Thanks,

Martin.



Hi Martin,

Im new to CGAL myself and playing with polyhedron for an algorithm that I am trying to implement. So, take my advise with a pinch of salt!

From what I understand, when you write a polyhedron to a .off file and read it back in..I think you loose out on the half-edge data structure information. Now, if you don't need the half-edge data structure later on, its okay to use .off format. But, if you want to really use the half edge information later on, you will have to come up with a file format (or maybe already exists out there that is geared towards half-edge ds). Eitherways, I am writing a small renderer for polyhedron, and if you want I can share the code with you when I'm done with it. Its in Qt, so that should take care of cross-platform issues.

Hope that helped some.
/Priyank

On 3/16/2010 7:48 AM, Martin Baeker wrote:
Hi Andreas,

thanks for the answer - so it seems the only way to do it is to
actually cycle over all the vertices of the facet and create a plane
from that? I still do not really understand why there is no standard
function doing this, but surely I can program it myself.

Thanks again,

Martin.



Hello Martin,

If I understand it right, you would expect that the plane
equation gets recomputed when the off file is loaded.

I don't see that this is supported by the off file format: http://www.geomview.org/docs/oogltour.html

Also it would not make sense, that CGAL computes the plane
equation after loading, as you could not have computed
it when you wrote it, or have stored yet another plane.

One solution would be to have an eoff format
( I just come up with this name, with the 'e'
standing for extended), which writes/reads whatever
information added to vertices and faces to the stream.

best regards,

andreas

On 16/03/2010 11:43, Martin Baeker wrote:
Dear all,

I'm getting a bit desperate while trying to work with Polyhedra-stuff.

The manual says that I can access the plane that belongs to a facet with
Plane_3& f.plane () if Supports_facet_plane == CGAL::Tag_true

However, I do not understand how this really works.

When I create a Polyhedron, e.g., with the make_cube_3-routine that is
provided in the examples, I can access the plane corresponding to each
facet without problems.
However, when I write this Polyhedron to an off-file and read it in
again, I cannot access its planes anymore.

Here is a simple test program to show this:

void do_stuff(Polyhedron & pcube)
{
for (Halfedge_iterator h=pcube.halfedges_begin(); h !=
pcube.halfedges_end(); ++h)
{
Facet face=*(h->facet());
std::cout << face.plane().orthogonal_vector() << std::endl;
}
}

int main() {
Polyhedron pcube;
make_cube_3(pcube);
std::ofstream os1("poly2.off" ) ;
os1 << pcube ;
os1.close();
do_stuff(pcube);
std::cout << "\n";
Polyhedron pcube2;
std::ifstream is1("poly2.off" ) ;
is1 >> pcube2;
do_stuff(pcube2);
}

The output for pcube is correct; for pcube2, all orthogonal vectors are
output as 0/1 0/1 0/1.


Is there a way to make sure that I can always access the plane
belonging to a facet? If not, why not? Could I do it by just taking
three points from the facet and create a plane with them?


Any help will be greatly appreciated,

Martin.





Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
e-mail
<>


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss



Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
e-mail
<>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss



Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
e-mail
<>


Archive powered by MHonArc 2.6.16.

Top of Page