MeVisLab Toolbox Reference
CSOMath.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
17
18#pragma once
19
20
21#include "MLCSOIncludes.h"
22#include "CSOBase/CSO.h"
26
27#include <mlRotation.h>
28
30
32
36namespace CSOMath
37{
38
39 const double smallNumber = 10e-10;
40
42 MLCSO_EXPORT double computeArea(const std::vector<Vector3>& points, const Vector3& normal);
53 MLCSO_EXPORT void computeAreaAndCenterOfGravity(const std::vector<Vector3>& points, const Vector3& normal, const Vector3& centerPoint, double& area, Vector3& centerOfGravity);
56
59 MLCSO_EXPORT inline int floorToInt(const double x)
60 {
61#if defined(WIN32) && !defined(_WIN64)
62 const double floored_x = floor(x);
63 int n;
65 __asm fistp dword ptr n;
66 return n;
67#else
68 return static_cast<int>(floor(x));
69#endif
70 }
71
74 MLCSO_EXPORT inline int ceilToInt(const double x)
75 {
76#if defined(WIN32) && !defined(_WIN64)
77 const double ceiled_x = ceil(x);
78 int n;
80 __asm fistp dword ptr n;
81 return n;
82#else
83 return static_cast<int>(ceil(x));
84#endif
85 }
86
89 MLCSO_EXPORT double computeDirectionDotProduct(const Vector3& predPos, const Vector3& middlePos, const Vector3& succPos);
90};
91
93
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLCSO_EXPORT size_t getHashKeyForMatrix4(const ml::Matrix4 &matrix)
Returns a hash key for a given matrix.
MLCSO_EXPORT int floorToInt(const double x)
Returns the floored double value as an integer.
Definition CSOMath.h:59
MLCSO_EXPORT double computeArea(const std::vector< Vector3 > &points, const Vector3 &normal)
Computes the area of the polygon, given as a list of points.
const double smallNumber
Definition CSOMath.h:39
MLCSO_EXPORT int ceilToInt(const double x)
Returns the ceiled double value as an integer.
Definition CSOMath.h:74
MLCSO_EXPORT void computeAreaAndCenterOfGravity(const std::vector< Vector3 > &points, const Vector3 &normal, const Vector3 &centerPoint, double &area, Vector3 &centerOfGravity)
MLCSO_EXPORT double computeDirectionDotProduct(const Vector3 &predPos, const Vector3 &middlePos, const Vector3 &succPos)
Computes and returns the dot product of the direction vectors of pred-middle and middle-succ.