MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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);
55 MLCSO_EXPORT void computeAreaAndCenterOfGravity(const std::vector<Vector3>& points, const Vector3& normal,
59
62 MLCSO_EXPORT inline int floorToInt(const double x)
63 {
64#if defined(WIN32) && !defined(_WIN64)
65 const double floored_x = floor(x);
66 int n;
68 __asm fistp dword ptr n;
69 return n;
70#else
71 return static_cast<int>(floor(x));
72#endif
73 }
74
77 MLCSO_EXPORT inline int ceilToInt(const double x)
78 {
79#if defined(WIN32) && !defined(_WIN64)
80 const double ceiled_x = ceil(x);
81 int n;
83 __asm fistp dword ptr n;
84 return n;
85#else
86 return static_cast<int>(ceil(x));
87#endif
88 }
89
93 const Vector3& succPos);
94}; // namespace CSOMath
95
97
#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.
double ceil(T value)
double floor(T value)
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:62
MLCSO_EXPORT double computeArea(const std::vector< Vector3 > &points, const Vector3 &normal)
Computes the area of the polygon that is 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:77
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.