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

swh:1:snp:136874afdeced8f40934fc4a5f8b6a29cadc3556
  • Code
  • Branches (1)
  • Releases (0)
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    No releases to show
  • 4146b66
  • /
  • ccvt_mod
  • /
  • ccvt_point.h
Raw File Download
Permalinks

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
content badge Iframe embedding
swh:1:cnt:e1e5dcdf2a025f2c9d1635c453762dcc2e5f8218
directory badge Iframe embedding
swh:1:dir:e8991d1fe9e0261371ab75c2a29fbe09ca322f5b
revision badge
swh:1:rev:42ba8b5ee132682b7804c6f47a7e1b91d6d73c9d
snapshot badge
swh:1:snp:136874afdeced8f40934fc4a5f8b6a29cadc3556
Citations

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 42ba8b5ee132682b7804c6f47a7e1b91d6d73c9d authored by Jonàs Martínez on 26 February 2024, 12:21:49 UTC
Add Worley noise image 250x250 pixels
Tip revision: 42ba8b5
ccvt_point.h
/*
  Copyright (C) 2009 Michael Balzer (michael.balzer@gmail.com)

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CCVT_POINT_H
#define CCVT_POINT_H

#include <assert.h>
#include <list>
#include <vector>

namespace ccvt {

  struct Point2 {

    typedef std::list<Point2>     List;
    typedef std::vector<Point2>   Vector;

    Point2() 
      : x(0), y(0) {
    }

    Point2(const double x, const double y)
      :x(x), y(y) {
    }

    Point2(const Point2& p) 
      : x(p.x), y(p.y) {
    }

    inline const double operator[](const int i) const {
      assert(i == 0 || i == 1);
      if (i == 0) {
        return x;
      }
      return y;
    }

    inline double operator[](const int i) {
      assert(i == 0 || i == 1);
      if (i == 0) {
        return x;
      }
      return y;
    }

    double  x;
    double  y;

    static const int D = 2;

  };

  struct Point3 {

    typedef std::list<Point3>   List;
    typedef std::vector<Point3> Vector;

    Point3() 
      : x(0), y(0), z(0) {
    }

    Point3(const double x, const double y, const double z)
      : x(x), y(y), z(z) {
    }

    Point3(const Point3& p) 
      : x(p.x), y(p.y), z(p.z) {
    }

    inline const double operator[](const int i) const {
      assert(i == 0 || i == 1 || i == 2);
      if (i == 0) {
        return x;
      }
      if (i == 1) {
        return y;
      }
      return z;
    }

    inline double operator[](const int i) {
      assert(i == 0 || i == 1 || i == 2);
      if (i == 0) {
        return x;
      }
      if (i == 1) {
        return y;
      }
      return z;
    }

    double  x;
    double  y;
    double  z;

    static const int D = 3;

  };

  template<int d>
  struct Point {

    typedef std::list<Point>   List;
    typedef std::vector<Point> Vector;

    Point() {
      for (int i = 0; i < d; ++i) {
        coordinates[i] = 0.0;
      }
    }

    Point(const double coordinates[d]) {
      for (int i = 0; i < d; ++i) {
        this->coordinates[i] = coordinates[i];
      }
    }

    Point(const Point& p) {
      for (int i = 0; i < d; ++i) {
        coordinates[i] = p.coordinates[i];
      }
    }

    inline const double operator[](const int i) const {
      assert(i >= 0 && i < d);
      return coordinates[i];
    }

    inline double operator[](const int i) {
      assert(i >= 0 && i < d);
      return coordinates[i];
    }

    static const int D = d;

  private:

    double coordinates[d];

  };

}

#endif  // CCVT_POINT_H

back to top

Software Heritage — Copyright (C) 2015–2025, 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— Contact— JavaScript license information— Web API