Archive for 2014


Computing area of all facets in CGAL::Polyhedron_3

In this post I will show how to compute area of a facet in CGAL::Polyhedron_3.

ComputeFacetArea() Functor

ComputeFacetArea() is a thread-safe functor for computing the area of a given facet in a CGAL::Polyhedron_3. The facet must be a planar polygon with arbitrary number of sides. We need facet’s normal vector to compute it’s area. The facet normals must be be initialized using the ComputeFacetArea()’s constructor. The code for computing the facet normals is presented in this post: Computing normal of all facets in CGAL::Polyhedron_3.

Using ComputeFacetArea() Functor

Area of a facet f can be computed as double area = ComputeFacetArea(h);.

For most purposes, it is better to compute area of all facets once and cache them for later use. It is best to store the results in an associative container which associates the facet handle with the area. In the following example, I use PropertyMap which is a wrapper for std::set.

Downloads

ImportOBJ.h
PropertyMap.h
ComputeFacetNormal.h
ComputeFacetArea.h
TestComputeFacetArea.cpp
Venus.obj
ComputeFacetArea.zip


Computing normal of all vertices in CGAL::Polyhedron_3

In this post I will show how to compute normal vector at a vector in CGAL::Polyhedron_3.

ComputeVertexNormal() Functor

ComputeVertexNormal() is a thread-safe functor for computing the normal vector at a given vertex in a CGAL::Polyhedron_3. The normal vector at a vertex is the average of the normal vectors of all facets incident on the vertex. The facet normals must be be initialized using the ComputeVertexNormal()’s constructor. The code for computing the facet normals is presented in this post: Computing normal of all facets in CGAL::Polyhedron_3.

Using ComputeVertexNormal() Functor

Normal vector at a vertex v can be computed as Vector3 normal = ComputeVertexNormal(f); .

For most purposes, it is better to compute area of all facets once and cache them for later use. It is best to store the results in an associative container which associates the facet handle with the area. In the following example, I use PropertyMap which is a wrapper for std::set.

Downloads

ImportOBJ.h
PropertyMap.h
ComputeFacetNormal.h
ComputeVertexNormal.h
TestComputeVertexNormal.cpp
Venus.obj
ComputeVertexNormal.zip


Computing normal of all facets in CGAL::Polyhedron_3

In this post I will show how to compute normal vector of a facet in CGAL::Polyhedron_3.

ComputeFacetNormal() Functor

ComputeFacetNormal() is a thread-safe functor for computing the normal vector of a given facet in a CGAL::Polyhedron_3. The facet must be a planar polygon with arbitrary number of sides.

Using ComputeFacetNormal() Functor

Normal vector of a facet f can be computed as Vector3 normal = ComputeFacetNormal(f);.

For most purposes, it is better to compute area of all facets once and cache them for later use. It is best to store the results in an associative container which associates the facet handle with the area. In the following example, I use PropertyMap which is a wrapper for std::set.

Downloads

ImportOBJ.h
PropertyMap.h
ComputeFacetNormal.h
TestComputeFacetNormal.cpp
Venus.obj
ComputeFacetNormal.zip


Computing edge length of all half-edges in CGAL::Polyhedron_3

In this post I will show how to compute edge length for a half-edge in CGAL::Polyhedron_3.

ComputeEdgeLength() Functor

ComputeEdgeLength() is a thread-safe functor for computing the edge length of a given half-edge in a CGAL::Polyhedron_3.

Using ComputeEdgeLength() Functor

Edge length of a half-edge h can be computed as double length = ComputeEdgeLength(h);.

For most purposes, it is better to compute length of all half-edges once and cache them for later use. It is best to store the results in an associative container which associates the half-edge handle with the edge length. In the following example, I use PropertyMap which is a wrapper for std::set.

Downloads

ImportOBJ.h
PropertyMap.h
ComputeEdgeLength.h
TestComputeEdgeLength.cpp
Venus.obj
ImportOBJ.zip


Twenty years from now you will be more disappointed by the things you didn’t do than by the ones you did do. So throw off the bowlines, sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.
-Mark Twain


Wavefront OBJ reader for building CGAL::Polyhedron_3

CGAL provides high quality generic half-edge data structure for representing polyhedral surfaces as well as many algorithms for mesh processing. However, CGAL doesn’t have any in-build support for building a polyhedron from Wavefront OBJ or PLY file. The following code is a basic OBJ file loader which reads vertex coordinates and faces (can be polygons) from OBJ file. Note that it doesn’t read vertex normals, face normals, or texture coordinates. Code is well commented and should be fairly obvious.

importOBJ() Function

Using importOBJ()

Downloads

ImportOBJ.h
TestImportOBJ.cpp


Zea Stem l.s. – Amscope 50PC Prepared Slides

Zea stem lateral section (l.s.) is the 50th slide in the Amscope 50PC prepared slides. Zea is a genus of true grasses in the family Poaceae of which corn is a member.

Micrographs [07 June 2014]

Amscope 50PC Prepared Slides

This post lists all the micrographs I have done from the Amscope 50PC prepared slides.


Zea Stem c.s. – Amscope 50PC Prepared Slides

Zea stem cross section is the 49th slide in the Amscope 50PC prepared slides. Zea is a genus of true grasses in the family Poaceae of which corn is a member.

Micrographs [07 June 2014]

Amscope 50PC Prepared Slides

This post lists all the micrographs I have done from the Amscope 50PC prepared slides.


Coprinus Mushroom Set – Amscope 50PC Prepared Slides

Cross-section of Coprinus mushroom set is the fourth slide in the Amscope 50PC prepared slides. The Coprinus is a small genus of mushrooms consisting of Coprinus comatus (the shaggy mane) and several of its close relatives [1].

Micrographs

The circular ring in the center is the stem of the mushroom. The center white circle suggests that the stem is hollow from inside. The lines from the stem to the edge forms the cap of the mushroom.

References
  1. http://en.wikipedia.org/wiki/Coprinus
Amscope 50PC Prepared Slides

This post lists all the micrographs I have done from the Amscope 50PC prepared slides.


Cotton Stem – Amscope 50PC Prepared Slides

Cross-section of cotton stem is the fifth slide in the Amscope 50PC prepared slides.

Micrographs [12 April 2014]

Micrographs [28 July 2014]

Amscope 50PC Prepared Slides

This post lists all the micrographs I have done from the Amscope 50PC prepared slides.