IMP
2.0.0
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
Triangle3D.h
Go to the documentation of this file.
1
/**
2
* \file IMP/algebra/Triangle3D.h
3
* \brief simple implementation of a triangle in 3D
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*/
7
8
#ifndef IMPALGEBRA_TRIANGLE_3D_H
9
#define IMPALGEBRA_TRIANGLE_3D_H
10
11
#include "
Vector3D.h
"
12
#include "
Transformation3D.h
"
13
#include "
ReferenceFrame3D.h
"
14
#include "
algebra_macros.h
"
15
#include "
GeometricPrimitiveD.h
"
16
#include <iostream>
17
#include "
constants.h
"
18
19
20
IMPALGEBRA_BEGIN_NAMESPACE
21
/**
22
\geometry
23
*/
24
class
IMPALGEBRAEXPORT
Triangle3D
:
public
GeometricPrimitiveD
<3>
25
{
26
public
:
27
Triangle3D
(){}
28
//! The passed points must not be colinear
29
Triangle3D
(
const
Vector3D
&p1,
const
Vector3D
&p2,
const
Vector3D
&p3);
30
//! Get the start=0/end=1 point of the segment
31
const
Vector3D
&
get_point
(
unsigned
int
i)
const
{
32
IMP_USAGE_CHECK
(i<3,
"invalid point index"
);
33
return
p_[i];
34
}
35
IMP_SHOWABLE_INLINE
(
Triangle3D
, out <<
"("
<< p_[0] <<
", "
36
<< p_[1] <<
", "
<< p_[2] <<
")"
);
37
Floats
get_edge_lengths()
const
;
38
private
:
39
Vector3D
p_[3];
40
};
41
42
IMP_VALUES
(
Triangle3D
,
Triangle3Ds
);
43
44
//! Return the largest triangle defined by 3 points from the input
45
/** \relatesalso Triangle3D */
46
IMPALGEBRAEXPORT
Triangle3D
get_largest_triangle
(
const
Vector3Ds
&points);
47
48
//! Return a transformation between two triangles
49
IMPALGEBRAEXPORT
Transformation3D
50
get_transformation_from_first_triangle_to_second
(
51
Triangle3D
first_tri,
Triangle3D
second_tri);
52
//! Return true if the three points are co-linear
53
IMPALGEBRAEXPORT
bool
54
get_are_colinear
(
55
const
Vector3D
&p1,
const
Vector3D
&p2,
const
Vector3D
&p3);
56
57
IMPALGEBRA_END_NAMESPACE
58
59
#endif
/* IMPALGEBRA_TRIANGLE_3D_H */