~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/carve/include/carve/vertex_decl.hpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Begin License:
 
2
// Copyright (C) 2006-2011 Tobias Sargeant (tobias.sargeant@gmail.com).
 
3
// All rights reserved.
 
4
//
 
5
// This file is part of the Carve CSG Library (http://carve-csg.com/)
 
6
//
 
7
// This file may be used under the terms of the GNU General Public
 
8
// License version 2.0 as published by the Free Software Foundation
 
9
// and appearing in the file LICENSE.GPL2 included in the packaging of
 
10
// this file.
 
11
//
 
12
// This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
 
13
// INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
 
14
// A PARTICULAR PURPOSE.
 
15
// End:
 
16
 
 
17
 
 
18
#pragma once
 
19
 
 
20
#include <carve/carve.hpp>
 
21
 
 
22
#include <carve/geom2d.hpp>
 
23
#include <carve/vector.hpp>
 
24
#include <carve/matrix.hpp>
 
25
#include <carve/geom3d.hpp>
 
26
#include <carve/aabb.hpp>
 
27
#include <carve/tag.hpp>
 
28
 
 
29
#include <vector>
 
30
#include <list>
 
31
#include <map>
 
32
 
 
33
namespace carve {
 
34
  namespace poly {
 
35
 
 
36
 
 
37
 
 
38
    struct Object;
 
39
 
 
40
 
 
41
 
 
42
    template<unsigned ndim>
 
43
    class Vertex : public tagable {
 
44
    public:
 
45
      typedef carve::geom::vector<ndim> vector_t;
 
46
      typedef Object obj_t;
 
47
 
 
48
      vector_t v;
 
49
      obj_t *owner;
 
50
 
 
51
      Vertex() : tagable(), v() {
 
52
      }
 
53
 
 
54
      ~Vertex() {
 
55
      }
 
56
 
 
57
      Vertex(const vector_t &_v) : tagable(), v(_v) {
 
58
      }
 
59
    };
 
60
 
 
61
 
 
62
 
 
63
    struct hash_vertex_ptr {
 
64
      template<unsigned ndim>
 
65
      size_t operator()(const Vertex<ndim> * const &v) const {
 
66
        return (size_t)v;
 
67
      }
 
68
 
 
69
      template<unsigned ndim>
 
70
      size_t operator()(const std::pair<const Vertex<ndim> *, const Vertex<ndim> *> &v) const {
 
71
        size_t r = (size_t)v.first;
 
72
        size_t s = (size_t)v.second;
 
73
        return r ^ ((s >> 16) | (s << 16));
 
74
      }
 
75
 
 
76
    };
 
77
 
 
78
 
 
79
 
 
80
    template<unsigned ndim>
 
81
    double distance(const Vertex<ndim> *v1, const Vertex<ndim> *v2) {
 
82
      return distance(v1->v, v2->v);
 
83
    }
 
84
 
 
85
    template<unsigned ndim>
 
86
    double distance(const Vertex<ndim> &v1, const Vertex<ndim> &v2) {
 
87
      return distance(v1.v, v2.v);
 
88
    }
 
89
 
 
90
    struct vec_adapt_vertex_ref {
 
91
      template<unsigned ndim>
 
92
      const typename Vertex<ndim>::vector_t &operator()(const Vertex<ndim> &v) const { return v.v; }
 
93
 
 
94
      template<unsigned ndim>
 
95
      typename Vertex<ndim>::vector_t &operator()(Vertex<ndim> &v) const { return v.v; }
 
96
    };
 
97
 
 
98
 
 
99
 
 
100
    struct vec_adapt_vertex_ptr {
 
101
      template<unsigned ndim>
 
102
      const typename Vertex<ndim>::vector_t &operator()(const Vertex<ndim> *v) const { return v->v; }
 
103
 
 
104
      template<unsigned ndim>
 
105
      typename Vertex<ndim>::vector_t &operator()(Vertex<ndim> *v) const { return v->v; }
 
106
    };
 
107
 
 
108
 
 
109
 
 
110
  }
 
111
}