MEPP2 Project
FEVV
Operators
Geometry
triangle_rad_angle.hpp
Go to the documentation of this file.
1
// Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2
// All rights reserved.
3
//
4
// This file is part of MEPP2; you can redistribute it and/or modify
5
// it under the terms of the GNU Lesser General Public License as
6
// published by the Free Software Foundation; either version 3 of
7
// the License, or (at your option) any later version.
8
//
9
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11
#pragma once
12
13
#include "
FEVV/Wrappings/Geometry_traits.h
"
14
#include "
FEVV/Operators/Geometry/AngleOperations.hpp
"
15
#include "
FEVV/Tools/Math/MatrixOperations.hpp
"
// MACH_EPS_DOUBLE
16
17
namespace
FEVV
{
18
namespace
Operators {
19
namespace
Geometry {
30
template
<
typename
GeometryTraits >
31
inline
typename
GeometryTraits::Scalar
32
triangle_rad_angle
(
const
typename
GeometryTraits::Point
&a,
33
const
typename
GeometryTraits::Point
34
&b,
// the central point on which we compute the angle
35
const
typename
GeometryTraits::Point
&c,
36
const
GeometryTraits >)
37
{
38
typedef
typename
GeometryTraits::Vector
Vector
;
39
typedef
typename
GeometryTraits::Scalar Scalar;
40
Vector
ba(a[0] - b[0], a[1] - b[1], a[2] - b[2]),
41
bc(c[0] - b[0], c[1] - b[1], c[2] - b[2]);
42
Scalar lba = gt.length(ba), lbc = gt.length(bc);
43
44
if
(lba >
MACH_EPS_DOUBLE
)
45
ba = ba / lba;
46
else
47
ba = gt.NULL_VECTOR;
48
if
(lbc >
MACH_EPS_DOUBLE
)
49
bc = bc / lbc;
50
else
51
bc = gt.NULL_VECTOR;
52
53
Scalar cosabc = gt.dot_product(ba, bc);
54
55
return
FEVV::Operators::Geometry::acos
(cosabc);
56
}
57
58
}
// namespace Geometry
59
}
// namespace Operators
60
}
// namespace FEVV
Vector
AIFMesh::Vector Vector
Definition:
Graph_properties_aif.h:22
Point
AIFMesh::Point Point
Definition:
Graph_properties_aif.h:21
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition:
Assert.h:16
AngleOperations.hpp
MACH_EPS_DOUBLE
#define MACH_EPS_DOUBLE
Definition:
MatrixOperations.hpp:29
Geometry_traits.h
FEVV::DataStructures::AIF::AIFVector
Definition:
AIFProperties.h:173
FEVV::Operators::Geometry::acos
T acos(T cosine)
Safe call to the std::acos function.
Definition:
AngleOperations.hpp:64
FEVV::Operators::Geometry::triangle_rad_angle
GeometryTraits::Scalar triangle_rad_angle(const typename GeometryTraits::Point &a, const typename GeometryTraits::Point &b, const typename GeometryTraits::Point &c, const GeometryTraits >)
Compute the angle of a triangle (given by 3 points).
Definition:
triangle_rad_angle.hpp:32
MatrixOperations.hpp
Generated by
1.8.20