~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/boolop/intern/BOP_MathUtils.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *
3
 
 *
4
 
 * ***** BEGIN GPL LICENSE BLOCK *****
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU General Public License
8
 
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software Foundation,
18
 
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 
 *
20
 
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21
 
 * All rights reserved.
22
 
 *
23
 
 * The Original Code is: all of this file.
24
 
 *
25
 
 * Contributor(s): Marc Freixas, Ken Hughes
26
 
 *
27
 
 * ***** END GPL LICENSE BLOCK *****
28
 
 */
29
 
 
30
 
/** \file boolop/intern/BOP_MathUtils.h
31
 
 *  \ingroup boolopintern
32
 
 */
33
 
 
34
 
 
35
 
#ifndef __BOP_MATHUTILS_H__
36
 
#define __BOP_MATHUTILS_H__
37
 
 
38
 
#include <math.h>
39
 
#include <float.h>
40
 
#include "MT_Point3.h"
41
 
#include "MT_Plane3.h"
42
 
 
43
 
/* define this to give better precision comparisons */
44
 
#define VAR_EPSILON
45
 
 
46
 
#ifndef VAR_EPSILON
47
 
const MT_Scalar BOP_EPSILON(1.0e-5);
48
 
#else
49
 
const MT_Scalar BOP_EPSILON(9.3132257461547852e-10);    /* ~= 2**-30 */
50
 
#endif
51
 
 
52
 
inline int BOP_sign(MT_Scalar x) {
53
 
    return x < 0.0 ? -1 : x > 0.0 ? 1 : 0;
54
 
}
55
 
inline MT_Scalar BOP_abs(MT_Scalar x) { return fabs(x); }
56
 
int BOP_comp(const MT_Scalar A, const MT_Scalar B);
57
 
int BOP_comp(const MT_Tuple3& A, const MT_Tuple3& B);
58
 
int BOP_comp0(const MT_Scalar A);
59
 
inline bool BOP_fuzzyZero(MT_Scalar x) { return BOP_comp0(x) == 0; }
60
 
int BOP_exactComp(const MT_Scalar A, const MT_Scalar B);
61
 
int BOP_exactComp(const MT_Tuple3& A, const MT_Tuple3& B);
62
 
bool BOP_between(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3);
63
 
bool BOP_collinear(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3);
64
 
bool BOP_convex(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3, 
65
 
                                const MT_Point3& p4);
66
 
int BOP_concave(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3, const MT_Point3& p4);
67
 
bool BOP_intersect(const MT_Vector3& vL1, const MT_Point3& pL1, const MT_Vector3& vL2, 
68
 
                                   const MT_Point3& pL2, MT_Point3& intersection);
69
 
bool BOP_getCircleCenter(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3, 
70
 
                                                 const MT_Point3& center);
71
 
bool BOP_isInsideCircle(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3, 
72
 
                                                const MT_Point3& p4, const MT_Point3& p5);
73
 
bool BOP_isInsideCircle(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3, 
74
 
                                                const MT_Point3& q);
75
 
MT_Scalar BOP_orientation(const MT_Plane3& p1, const MT_Plane3& p2);
76
 
int BOP_classify(const MT_Point3& p, const MT_Plane3& plane);
77
 
MT_Point3 BOP_intersectPlane(const MT_Plane3& plane, const MT_Point3& p1, const MT_Point3& p2);
78
 
bool BOP_containsPoint(const MT_Plane3& plane, const MT_Point3& point);
79
 
MT_Point3 BOP_4PointIntersect(const MT_Point3& p0, const MT_Point3& p1, const MT_Point3& p2, 
80
 
                                                          const MT_Point3& q);
81
 
MT_Scalar BOP_EpsilonDistance(const MT_Point3& p0, const MT_Point3& p1, const MT_Point3& q);
82
 
 
83
 
#endif