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/TIN_Viewsheds
03 July 2026, 12:54:31 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 3228d926579e0631b255e7478f24963a508637b4
    No releases to show
  • 911b845
  • /
  • Arr_extended_overlay_traits.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:274203cecc224458a773fa1794af24264678fb3e
origin badgedirectory badge
swh:1:dir:911b84528046c62ddd56c32905926748dd59791e
origin badgerevision badge
swh:1:rev:3228d926579e0631b255e7478f24963a508637b4
origin badgesnapshot badge
swh:1:snp:a61033758c7e06cfb67229206ddb2d2cfad7abd7

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: 3228d926579e0631b255e7478f24963a508637b4 authored by Gert Meijer on 06 May 2021, 03:42:18 UTC
Base code files push
Tip revision: 3228d92
Arr_extended_overlay_traits.h
#pragma once

namespace Viewshed
{
    template <class ArrangementA, class ArrangementB, class ArrangementR>
    class Arr_extended_overlay_traits
    {
    public:

        typedef typename ArrangementA::Vertex_const_handle    Vertex_handle_A;
        typedef typename ArrangementA::Halfedge_const_handle  Halfedge_handle_A;
        typedef typename ArrangementA::Face_const_handle      Face_handle_A;

        typedef typename ArrangementB::Vertex_const_handle    Vertex_handle_B;
        typedef typename ArrangementB::Halfedge_const_handle  Halfedge_handle_B;
        typedef typename ArrangementB::Face_const_handle      Face_handle_B;

        typedef typename ArrangementR::Vertex_handle          Vertex_handle_R;
        typedef typename ArrangementR::Halfedge_handle        Halfedge_handle_R;
        typedef typename ArrangementR::Face_handle            Face_handle_R;

        /*! Destructor. */
        virtual ~Arr_extended_overlay_traits()
        {}

        /*!
         * Create a vertex v that corresponds to the coinciding vertices v1 and v2.
         */
        virtual void create_vertex(Vertex_handle_A v1,
            Vertex_handle_B v2,
            Vertex_handle_R v) const
        {
            //std::cout << "new coinciding vertex" << std::endl;

            //Combine the face indices and representative boolean vectors while making sure the pairs keep the same order.
            //TODO Note: Convert to an actual pair?
            v->data().faceIndices.insert(v->data().faceIndices.end(), v1->data().faceIndices.begin(), v1->data().faceIndices.end());
            v->data().faceIndices.insert(v->data().faceIndices.end(), v2->data().faceIndices.begin(), v2->data().faceIndices.end());

            v->data().isRepresentative.insert(v->data().isRepresentative.end(), v1->data().isRepresentative.begin(), v1->data().isRepresentative.end());
            v->data().isRepresentative.insert(v->data().isRepresentative.end(), v2->data().isRepresentative.begin(), v2->data().isRepresentative.end());

            //Combine intersection maps into result vertex intersection map
            v->data().intersectionMap = v1->data().intersectionMap;
            for (const auto& kv : v2->data().intersectionMap)
            {
                for (const int faceIndex : kv.second)
                {
                    v->data().intersectionMap[kv.first].push_back(faceIndex);
                }
            }
        }

        /*!
         * Create a vertex v that matches v1, contained in the face f2.
         */
        virtual void create_vertex(Vertex_handle_A v1,
            Face_handle_B f2,
            Vertex_handle_R v) const
        {
            //std::cout << "new vertex in face 2" << std::endl;

            v->set_data(v1->data());
        }

        /*!
         * Create a vertex v that matches v1, which lies on the edge e2.
         */
        virtual void create_vertex(Vertex_handle_A v1,
            Halfedge_handle_B e2,
            Vertex_handle_R v) const
        {
            //std::cout << "new vertex on edge 2 inter map size" << v1->data().intersectionMap.size() << std::endl;
            //std::cout << "Edge faces: " << std::endl;
            //for (auto q : e2->data().faceIndices)
                //std::cout << q << std::endl;
            //for (auto q : e2->twin()->data().faceIndices)
                //std::cout << q << std::endl;

            v->set_data(v1->data());

            if (v->data().intersectionMap.size() > 0)
            {
                //This is an edge case where the original vertex that lies on the newly added edge is an intersection vertex.
                //Because it doesn't get handled as a new intersection but as a vertex in edge we cannot determine if one of the faces is adjacent to the face adjacent to the new edge.
                //So we just pair it with all known faces at this intersection point and we have to watch out that the triangles do not have a distance of 0 at the intersection point during the overlap procedure.
                //std::cout << "Adding intersection faces" << std::endl;
                std::vector<int> e2Faces;
                e2Faces.insert(e2Faces.end(), e2->data().faceIndices.begin(), e2->data().faceIndices.end());
                e2Faces.insert(e2Faces.end(), e2->twin()->data().faceIndices.begin(), e2->twin()->data().faceIndices.end());

                for (int faceIndex : e2Faces)
                {
                    for (auto& kv : v->data().intersectionMap)
                    {
                        v->data().intersectionMap[kv.first].push_back(faceIndex);
                        v->data().intersectionMap[faceIndex].push_back(kv.first);
                    }
                }
            }
        }

        /*!
         * Create a vertex v that matches v2, which lies on the edge e1.
         */
        virtual void create_vertex(Halfedge_handle_A e1,
            Vertex_handle_B v2,
            Vertex_handle_R v) const
        {
            //std::cout << "new vertex on edge 1 inter map size" << v2->data().intersectionMap.size() << std::endl;
            //std::cout << "Edge faces: " << std::endl;
            //for (auto q : e1->data().faceIndices)
                //std::cout << q << std::endl;
            //for (auto q : e1->twin()->data().faceIndices)
                //std::cout << q << std::endl;

            v->set_data(v2->data());

            if (v->data().intersectionMap.size() > 0)
            {
                //This is an edge case where the original vertex that lies on the newly added edge is an intersection vertex.
                //Because it doesn't get handled as a new intersection but as a vertex in edge we cannot determine if one of the faces is adjacent to the face adjacent to the new edge.
                //So we just pair it with all known faces at this intersection point and we have to watch out that the triangles do not have a distance of 0 at the intersection point during the overlap procedure.
                //std::cout << "Adding intersection faces" << std::endl;

                std::vector<int> e1Faces;
                e1Faces.insert(e1Faces.end(), e1->data().faceIndices.begin(), e1->data().faceIndices.end());
                e1Faces.insert(e1Faces.end(), e1->twin()->data().faceIndices.begin(), e1->twin()->data().faceIndices.end());

                for (int faceIndex : e1Faces)
                {
                    for (auto& kv : v->data().intersectionMap)
                    {
                        v->data().intersectionMap[kv.first].push_back(faceIndex);
                        v->data().intersectionMap[faceIndex].push_back(kv.first);
                    }
                }
            }
        }

        /*!
         * Create a vertex v that matches v2, contained in the face f1.
         */
        virtual void create_vertex(Face_handle_A f1,
            Vertex_handle_B v2,
            Vertex_handle_R v) const
        {
            //std::cout << "new vertex in face 1" << std::endl;

            v->set_data(v2->data());
        }

        /*!
         * Create a vertex v that matches the intersection on the edges e1 and e2.
         */
        virtual void create_vertex(Halfedge_handle_A e1,
            Halfedge_handle_B e2,
            Vertex_handle_R v) const
        {
            //std::cout << "new intersection vertex" << std::endl;

            //To reduce the amount of adjacent (but not intersecting) faces that will be handled as intersections later we add the intersection pairs in a dictionary.
            std::vector<int> e1Faces;
            e1Faces.insert(e1Faces.end(), e1->data().faceIndices.begin(), e1->data().faceIndices.end());
            e1Faces.insert(e1Faces.end(), e1->twin()->data().faceIndices.begin(), e1->twin()->data().faceIndices.end());

            std::vector<int> e2Faces;
            e2Faces.insert(e2Faces.end(), e2->data().faceIndices.begin(), e2->data().faceIndices.end());
            e2Faces.insert(e2Faces.end(), e2->twin()->data().faceIndices.begin(), e2->twin()->data().faceIndices.end());


            for (int faceIndexE1 : e1Faces)
            {
                for (int faceIndexE2 : e2Faces)
                {
                    v->data().intersectionMap[faceIndexE1].push_back(faceIndexE2);
                    v->data().intersectionMap[faceIndexE2].push_back(faceIndexE1);
                }
            }
        }

        /*!
         * Create an edge e that matches the overlap between e1 and e2.
         */
        virtual void create_edge(Halfedge_handle_A  e1,
            Halfedge_handle_B  e2,
            Halfedge_handle_R  e) const
        {
            //std::cout << "new overlap edge" << std::endl;

            e->data().faceIndices.insert(e->data().faceIndices.end(), e1->data().faceIndices.begin(), e1->data().faceIndices.end());
            e->data().faceIndices.insert(e->data().faceIndices.end(), e2->data().faceIndices.begin(), e2->data().faceIndices.end());

            e->twin()->data().faceIndices.insert(e->twin()->data().faceIndices.end(), e1->twin()->data().faceIndices.begin(), e1->twin()->data().faceIndices.end());
            e->twin()->data().faceIndices.insert(e->twin()->data().faceIndices.end(), e2->twin()->data().faceIndices.begin(), e2->twin()->data().faceIndices.end());
        }

        /*!
         * Create an edge e that matches the edge e1, contained in the face f2.
         */
        virtual void create_edge(Halfedge_handle_A  e1,
            Face_handle_B  f2,
            Halfedge_handle_R  e) const
        {
            //std::cout << "new edge in face 2" << std::endl;

            //Copy data from the old edge into the new edge
            e->set_data(e1->data());
            e->twin()->set_data(e1->twin()->data());
        }

        /*!
         * Create an edge e that matches the edge e2, contained in the face f1.
         */
        virtual void create_edge(Face_handle_A  f1,
            Halfedge_handle_B  e2,
            Halfedge_handle_R  e) const
        {
            //std::cout << "new edge in face 1" << std::endl;
            //Copy data from the old edge into the new edge
            e->set_data(e2->data());
            e->twin()->set_data(e2->twin()->data());

        }

        /*!
         * Create a face f that matches the overlapping region between f1 and f2.
         */
        virtual void create_face(Face_handle_A  f1,
            Face_handle_B  f2,
            Face_handle_R  f) const
        {
            //std::cout << "new face" << std::endl;

            //Copy face data from both faces into the new face
            f->data().faceIndices.insert(f->data().faceIndices.end(), f1->data().faceIndices.begin(), f1->data().faceIndices.end());
            f->data().faceIndices.insert(f->data().faceIndices.end(), f2->data().faceIndices.begin(), f2->data().faceIndices.end());

            std::sort(f->data().faceIndices.begin(), f->data().faceIndices.end());
        }

    };
}

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