~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/eltopo/common/ccd_wrapper.h

  • 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
// ---------------------------------------------------------
 
2
//
 
3
//  ccd_wrapper.h
 
4
//  Tyson Brochu 2009
 
5
//
 
6
//  General interface for collision and intersection queries.
 
7
//
 
8
// ---------------------------------------------------------
 
9
 
 
10
 
 
11
#ifndef CCD_WRAPPER_H
 
12
#define CCD_WRAPPER_H
 
13
 
 
14
#include <vec.h>
 
15
 
 
16
 
 
17
// --------------------------------------------------------------------------------------------------
 
18
// 2D continuous collision detection
 
19
// --------------------------------------------------------------------------------------------------
 
20
 
 
21
// x0 is the point, x1-x2 is the segment. Take care to specify x1,x2 in sorted order of index!
 
22
bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t index0,
 
23
                             const Vec2d& x1, const Vec2d& xnew1, size_t index1,
 
24
                             const Vec2d& x2, const Vec2d& xnew2, size_t index2);
 
25
 
 
26
bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, size_t index0,
 
27
                             const Vec2d& x1, const Vec2d& xnew1, size_t index1,
 
28
                             const Vec2d& x2, const Vec2d& xnew2, size_t index2,
 
29
                             double& edge_alpha, Vec2d& normal, double& time, double& rel_disp);
 
30
 
 
31
// --------------------------------------------------------------------------------------------------
 
32
// 2D static intersection detection
 
33
// --------------------------------------------------------------------------------------------------
 
34
 
 
35
bool segment_segment_intersection(const Vec2d& x0, size_t index0, 
 
36
                                  const Vec2d& x1, size_t index1,
 
37
                                  const Vec2d& x2, size_t index2,
 
38
                                  const Vec2d& x3, size_t index3);
 
39
 
 
40
bool segment_segment_intersection(const Vec2d& x0, size_t index0, 
 
41
                                  const Vec2d& x1, size_t index1,
 
42
                                  const Vec2d& x2, size_t index2,
 
43
                                  const Vec2d& x3, size_t index3,
 
44
                                  double &s0, double& s2 );
 
45
 
 
46
// --------------------------------------------------------------------------------------------------
 
47
// 3D continuous collision detection
 
48
// --------------------------------------------------------------------------------------------------
 
49
 
 
50
// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
 
51
bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
 
52
                              const Vec3d& x1, const Vec3d& xnew1, size_t index1,
 
53
                              const Vec3d& x2, const Vec3d& xnew2, size_t index2,
 
54
                              const Vec3d& x3, const Vec3d& xnew3, size_t index3);
 
55
 
 
56
// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
 
57
// If there is a collision, returns true and sets bary1, bary2, bary3 to the barycentric coordinates of
 
58
// the collision point, sets normal to the collision point, t to the collision time, and the relative
 
59
// normal displacement (in terms of point 0 minus triangle 1-2-3)
 
60
bool point_triangle_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
 
61
                              const Vec3d& x1, const Vec3d& xnew1, size_t index1,
 
62
                              const Vec3d& x2, const Vec3d& xnew2, size_t index2,
 
63
                              const Vec3d& x3, const Vec3d& xnew3, size_t index3,
 
64
                              double& bary1, double& bary2, double& bary3,
 
65
                              Vec3d& normal,
 
66
                              double& relative_normal_displacement );
 
67
 
 
68
// x0-x1 and x2-x3 are the segments. Take care to specify x0,x1 and x2,x3 in sorted order of index!
 
69
bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
 
70
                               const Vec3d& x1, const Vec3d& xnew1, size_t index1,
 
71
                               const Vec3d& x2, const Vec3d& xnew2, size_t index2,
 
72
                               const Vec3d& x3, const Vec3d& xnew3, size_t index3);
 
73
 
 
74
// x0-x1 and x2-x3 are the segments. Take care to specify x0,x1 and x2,x3 in sorted order of index!
 
75
// If there is a collision, returns true and sets bary0 and bary2 to parts of the barycentric coordinates of
 
76
// the collision point, sets normal to the collision point, t to the collision time, and the relative
 
77
// normal displacement (in terms of edge 0-1 minus edge 2-3)
 
78
bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, size_t index0,
 
79
                               const Vec3d& x1, const Vec3d& xnew1, size_t index1,
 
80
                               const Vec3d& x2, const Vec3d& xnew2, size_t index2,
 
81
                               const Vec3d& x3, const Vec3d& xnew3, size_t index3,
 
82
                               double& bary0, double& bary2,
 
83
                               Vec3d& normal,
 
84
                               double& relative_normal_displacement );
 
85
 
 
86
 
 
87
// --------------------------------------------------------------------------------------------------
 
88
// 3D static intersection detection
 
89
// --------------------------------------------------------------------------------------------------
 
90
 
 
91
// x0-x1 is the segment and and x2-x3-x4 is the triangle.
 
92
bool segment_triangle_intersection(const Vec3d& x0, size_t index0,
 
93
                                   const Vec3d& x1, size_t index1,
 
94
                                   const Vec3d& x2, size_t index2,
 
95
                                   const Vec3d& x3, size_t index3,
 
96
                                   const Vec3d& x4, size_t index4,
 
97
                                   bool degenerate_counts_as_intersection,
 
98
                                   bool verbose = false );
 
99
 
 
100
bool segment_triangle_intersection(const Vec3d& x0, size_t index0,
 
101
                                   const Vec3d& x1, size_t index1,
 
102
                                   const Vec3d& x2, size_t index2,
 
103
                                   const Vec3d& x3, size_t index3,
 
104
                                   const Vec3d& x4, size_t index4,
 
105
                                   double& bary0, double& bary1, double& bary2, double& bary3, double& bary4,
 
106
                                   bool degenerate_counts_as_intersection,
 
107
                                   bool verbose = false );
 
108
 
 
109
 
 
110
// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
 
111
bool point_tetrahedron_intersection(const Vec3d& x0, size_t index0,
 
112
                                    const Vec3d& x1, size_t index1,
 
113
                                    const Vec3d& x2, size_t index2,
 
114
                                    const Vec3d& x3, size_t index3,
 
115
                                    const Vec3d& x4, size_t index4);
 
116
 
 
117
 
 
118
#endif
 
119