Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] [Bug] Polyhedron_traits_with_normals_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] [Bug] Polyhedron_traits_with_normals_3


Chronological Thread 
  • From: Mohamed Yousef <>
  • To:
  • Subject: Re: [cgal-discuss] [Bug] Polyhedron_traits_with_normals_3
  • Date: Tue, 13 Jul 2010 15:24:02 +0300
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=P+0n8FgQ8q7U+c8z4Fy8gfOcv1M/V8ArnJwTmtNJyOOAk0Gq7285xR1Al2DkFg39oF oftkdtFisKrIfRsDZD+gOGF904ztVZkbCgbIHH7mg+cLElCh1JelFkOAevW/8uaEu6dM WEh2P4HMvxuVuBnL/GZpgrkzvTN3jxPFY7wj0=

is this still not considered bug ? what is the current status now

Thanks,

On 8 July 2010 23:47, Mohamed Yousef <> wrote:


On 8 July 2010 11:57, Sebastien Loriot (GeometryFactory) <sloriot.ml@gmail.com> wrote:

Mohttps://mail.google.com/mail/?hl=ar&shva=1#inbox/129ad8d0ec704d3fhamed Yousef wrote:
suppose we want to define a Polyhedron that has the plane support , depending on Polyhedron_traits_with_
normals_3 as traits , we would do

typedef CGAL::Exact_predicates_inexact_constructions_kernel  Kernel;
typedef CGAL::Polyhedron_traits_with_normals_3<Kernel>        Traits;
typedef CGAL::Polyhedron_3<Traits>                                       Polyhedron;

and then use Polyhedron normally , the problem is our Polyhedron now lacks many things already been in Kernel (in fact everything but Point_3 and Plane_3 ) this hindered me and i found the solution used elsewhere in cgal is to inherit the specilizing kernel , thus you are adding to it
In which context? the kernel is still available using Polyhedron::Traits::Kernel.


this is true if I'm the only user of it , but the problem becomes clear when we hook Polyhedron_traits_with_normals_3 into other parts of a cgal puzzle , parts assuming this as a standard behavior
specifically i faced the problem when trying to use Polyhedron_traits_with_normals_3 with the parametrization package

 
Please provide a minimal example that highlighting your problem. If We
cannot reproduce a bug it is hard to correct.


take for example the first example of the parametrization package, modified to use Polyhedron_traits_with_normals_3 , it will refuse compiling asking for FT , which isn't here as Polyhedron traits doesn't have (because it doesn't inherit from it's kernel )


#include <CGAL/Polyhedron_traits_with_normals_3.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Parameterization_polyhedron_adaptor_3.h>
#include <CGAL/parameterize.h>

#include <iostream>
#include <fstream>


// ----------------------------------------------------------------------------
// Private types
// ----------------------------------------------------------------------------

typedef CGAL::Cartesian<double>             Kernel;

typedef CGAL::Polyhedron_traits_with_normals_3<Kernel>        Traits;
typedef CGAL::Polyhedron_3<Traits>                            Polyhedron;

// ----------------------------------------------------------------------------
// main()
// ----------------------------------------------------------------------------

int main(int argc, char * argv[])
{
    std::cerr << "PARAMETERIZATION" << std::endl;
    std::cerr << "  Floater parameterization" << std::endl;
    std::cerr << "  Circle border" << std::endl;
    std::cerr << "  OpenNL solver" << std::endl;

    //***************************************
    // decode parameters
    //***************************************

    if (argc-1 != 1)
    {
        std::cerr << "Usage: " << argv[0] << " input_file.off" << std::endl;
        return(EXIT_FAILURE);
    }

    // File name is:
    const char* input_filename  = argv[1];

    //***************************************
    // Read the mesh
    //***************************************

    // Read the mesh
    std::ifstream stream(input_filename);
    Polyhedron mesh;
    stream >> mesh;
    if(!stream || !mesh.is_valid() || mesh.empty())
    {
        std::cerr << "Error: cannot read OFF file " << input_filename << std::endl;
        return EXIT_FAILURE;
    }

    //***************************************
    // Create Polyhedron adaptor
    // Note: no cutting => we support only
    // meshes that are topological disks
    //***************************************

    typedef CGAL::Parameterization_polyhedron_adaptor_3<Polyhedron>
                                            Parameterization_polyhedron_adaptor;
    Parameterization_polyhedron_adaptor mesh_adaptor(mesh);

    //***************************************
    // Floater Mean Value Coordinates parameterization
    // (defaults are circular border and OpenNL solver)
    //***************************************

    typedef CGAL::Parameterizer_traits_3<Parameterization_polyhedron_adaptor>
                                            Parameterizer;  // Type that defines the error codes

    Parameterizer::Error_code err = CGAL::parameterize(mesh_adaptor);
    switch(err) {
    case Parameterizer::OK: // Success
        break;
    case Parameterizer::ERROR_EMPTY_MESH: // Input mesh not supported
    case Parameterizer::ERROR_NON_TRIANGULAR_MESH:  
    case Parameterizer::ERROR_NO_TOPOLOGICAL_DISC:    
    case Parameterizer::ERROR_BORDER_TOO_SHORT:   
        std::cerr << "Input mesh not supported: " << Parameterizer::get_error_message(err) << std::endl;
        return EXIT_FAILURE;
        break;
    default: // Error
        std::cerr << "Error: " << Parameterizer::get_error_message(err) << std::endl;
        return EXIT_FAILURE;
        break;
    };

    //***************************************
    // Output
    //***************************************

    // Raw output: dump (u,v) pairs
    Polyhedron::Vertex_const_iterator pVertex;
    for (pVertex = mesh.vertices_begin();
        pVertex != mesh.vertices_end();
        pVertex++)
    {
        // (u,v) pair is stored in any halfedge
        double u = mesh_adaptor.info(pVertex->halfedge())->uv().x();
        double v = mesh_adaptor.info(pVertex->halfedge())->uv().y();
        std::cout << "(u,v) = (" << u << "," << v << ")" << std::endl;
    }

    return EXIT_SUCCESS;

}


On 8 July 2010 10:08, Sebastien Loriot (GeometryFactory) <sloriot.ml <http://sloriot.ml>@gmail.com <http://gmail.com>> wrote:

   Sorry but I still don't get your point.

   The activation of the plane support is done within a class model of
   PolyhedronItems_3.

   http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Polyhedron_ref/Concept_PolyhedronItems_3.html#Cross_link_anchor_1096

   Can you please state clearly what you would like to do.

   S.


   Mohamed Yousef wrote:

       simply if you want to use it as usual to extend a kernel by
       adding plane support , you will lack all additional things the
       kernel provides

       the way for this to go (done in other traits , every where in
       cgal ) is to inherit from specializing kernel , thus you have
       your kernel with additional support of plane

       Regards,
       Mohamed Yousef

       On 8 July 2010 08:52, Sebastien Loriot (GeometryFactory)
       <sloriot.ml <http://sloriot.ml> <http://sloriot.ml>@gmail.com

       <http://gmail.com> <http://gmail.com>> wrote:

          Mohamed Yousef wrote:

              Hello,

              i think the class "Polyhedron_traits_with_normals_3" should
              inherit from Kernel_

              Thanks,


          Reading the documentation I see no reason why it should.
          The concept PolyhedronTraits_3 is quite simple and
          Polyhedron_traits_with_normals_3 seems to be a model of it.

          What leads you to think there is a bug?

          S.

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




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




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






Archive powered by MHonArc 2.6.16.

Top of Page