Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/GTMeijer/Prickliness
10 August 2026, 22:39:23 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 7d1d9c1c9d76fee0d09beff2396006f8754e8613
    No releases to show
  • c360f8c
  • /
  • DrawPrickliness.h
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:799a8d39c32a7786b1d8d56c7fe5436d973a02e6
origin badgedirectory badge
swh:1:dir:c360f8c5b838bfe88910d26aad151dee69f69364
origin badgerevision badge
swh:1:rev:7d1d9c1c9d76fee0d09beff2396006f8754e8613
origin badgesnapshot badge
swh:1:snp:f98118b47019c7c99d3f8ca36e76fdf56e9f5b39

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 7d1d9c1c9d76fee0d09beff2396006f8754e8613 authored by Gert Meijer on 06 May 2021, 03:23:18 UTC
Base code files push
Tip revision: 7d1d9c1
DrawPrickliness.h
#ifndef CGAL_DRAW_PRICKLINESS_H
#define CGAL_DRAW_PRICKLINESS_H

#include <CGAL/Qt/Basic_viewer_qt.h>

#ifdef CGAL_USE_BASIC_VIEWER

//#include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Random.h>

namespace Prickliness
{

    // Viewer class for Arr
    class PricklyArrangementViewerQt : public CGAL::Basic_viewer_qt
    {
        typedef CGAL::Basic_viewer_qt Base;

    public:
        /// Construct the viewer.
        /// @param a_a the arrangement to view
        /// @param title the title of the window
        /// @param anofaces if true, do not draw faces (faces are not computed; this can be
        ///        usefull for very big object where this time could be long)
        PricklyArrangementViewerQt(QWidget* parent,
            const Arrangement_2& a_arr,
            int maxPrickliness,
            Vector_3 pricklyDirection,
            const char* title = "Prickliness Arrangement Viewer",
            bool anofaces = false) :
            // First draw: vertices; edges, faces; multi-color; no inverse normal
            Base(parent, title, true, true, true, false, false),
            arr(a_arr),
            m_nofaces(anofaces),
            maxPrickliness(maxPrickliness),
            pricklyDirection(pricklyDirection)
        {
            compute_elements();
        }

    protected:

        void compute_face(Arrangement_2::Face_const_handle fh)
        {
            if (fh->is_unbounded())
            {
                return;
            }

            int shade = 255;
            if (fh->data().localMaximaCount != -1)
            {
                shade = 255 - (int)(255.0 * ((double)fh->data().localMaximaCount / (double)maxPrickliness));
            }

            CGAL::Color c(shade, shade, shade);

            face_begin(c);
            
            auto edgeCirculator = fh->outer_ccb();
            auto startEdgeCirc = fh->outer_ccb();

            //Circle along the edges and add the vertices to the draw face
            do
            {
                add_point_in_face(edgeCirculator->source()->point());
            } while (++edgeCirculator != startEdgeCirc);


            face_end();
        }
        void compute_elements()
        {
            clear();

            // Draw the arrangement faces.
            Arrangement_2::Face_const_iterator fit;
            for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit)
            {
                //Only draw finite faces
                if (!fit->is_unbounded() && !fit->is_fictitious() && fit->has_outer_ccb())
                {
                    if (fit->data().localMaximaCount != -1)
                    {
                        compute_face(fit);
                    }
                }
            }

            // Draw the arrangement edges.
            CGAL::Color edgeColor(0, 0, 0);
            Arrangement_2::Edge_const_iterator eit;
            for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit)
            {

                if (!eit->is_fictitious() && !eit->curve().is_ray())
                {
                    if (eit->face()->data().localMaximaCount != -1 || eit->twin()->face()->data().localMaximaCount != -1)
                    {
                        add_segment(eit->source()->point(), eit->target()->point(), edgeColor);
                    }
                }
            }

            //// Draw the arrangement vertices.
            //Arrangement_2::Vertex_const_iterator vit;
            //for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit)
            //{
            //    add_point(vit->point());
            //}
        }

        virtual void keyPressEvent(QKeyEvent* e)
        {
            Base::keyPressEvent(e);
        }

    protected:
        const Arrangement_2& arr;
        bool m_nofaces;
        int maxPrickliness;
        Vector_3 pricklyDirection;
    };


    inline void DrawPrickliness(const Arrangement_2& a_arr,
        int maxPrickliness,
        Vector_3 pricklyDirection,
        const char* title = "Prickliness Arrangement Viewer",
        bool nofill = false)
    {
#if defined(CGAL_TEST_SUITE)
        bool cgal_test_suite = true;
#else
        bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE");
#endif

        if (!cgal_test_suite)
        {
            int argc = 1;
            const char* argv[2] = { "arr_viewer","\0" };
            QApplication app(argc, const_cast<char**>(argv));
            PricklyArrangementViewerQt mainwindow(app.activeWindow(), a_arr, maxPrickliness, pricklyDirection, title);
            mainwindow.show();
            app.exec();
        }
    }

} // End namespace CGAL

#endif // CGAL_DRAW_PRICKLINESS_H

#endif // CGAL_DRAW_LCC_H

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API