Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Reinecke
ducc
Commits
025e08dd
Commit
025e08dd
authored
May 29, 2020
by
Martin Reinecke
Browse files
improve namespace handling; build a single shared object
parent
afad44ed
Pipeline
#75770
failed with stages
in 7 minutes and 8 seconds
Changes
24
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cxxbase.cc
0 → 100644
View file @
025e08dd
#include
"mr_util/infra/system.cc"
#include
"mr_util/infra/string_utils.cc"
#include
"mr_util/infra/threading.cc"
#include
"mr_util/math/pointing.cc"
#include
"mr_util/math/geom_utils.cc"
#include
"mr_util/sharp/sharp.cc"
#include
"mr_util/sharp/sharp_almhelpers.cc"
#include
"mr_util/sharp/sharp_core.cc"
#include
"mr_util/sharp/sharp_ylmgen.cc"
#include
"mr_util/sharp/sharp_geomhelpers.cc"
#include
"mr_util/healpix/healpix_tables.cc"
#include
"mr_util/healpix/healpix_base.cc"
#include
<pybind11/pybind11.h>
#include
"pysharp/pysharp.cc"
#include
"pypocketfft/pypocketfft.cc"
#include
"pyinterpol_ng/pyinterpol_ng.cc"
#include
"nifty_gridder/nifty_gridder.cc"
#include
"pyHealpix/pyHealpix.cc"
using
namespace
mr
;
PYBIND11_MODULE
(
cxxbase1
,
m
)
{
add_pypocketfft
(
m
);
add_pysharp
(
m
);
add_pyinterpol_ng
(
m
);
add_nifty_gridder
(
m
);
add_pyHealpix
(
m
);
}
nifty_gridder/nifty_gridder.cc
View file @
025e08dd
...
...
@@ -24,14 +24,16 @@
#include
"mr_util/bindings/pybind_utils.h"
#include
"gridder_cxx.h"
namespace
mr
{
namespace
detail_nifty_gridder
{
using
namespace
std
;
using
namespace
gridder
;
using
namespace
mr
;
namespace
py
=
pybind11
;
namespace
{
auto
None
=
py
::
none
();
template
<
typename
T
>
py
::
array
ms2dirty_general2
(
const
py
::
array
&
uvw_
,
...
...
@@ -192,11 +194,10 @@ py::array Pydirty2ms(const py::array &uvw,
verbosity
);
}
}
// unnamed namespace
PYBIND11_MODULE
(
nifty_gridder
,
m
)
void
add_nifty_gridder
(
py
::
module
&
msup
)
{
using
namespace
pybind11
::
literals
;
auto
m
=
msup
.
def_submodule
(
"nifty_gridder"
);
m
.
def
(
"ms2dirty"
,
&
Pyms2dirty
,
ms2dirty_DS
,
"uvw"
_a
,
"freq"
_a
,
"ms"
_a
,
"wgt"
_a
=
None
,
"npix_x"
_a
,
"npix_y"
_a
,
"pixsize_x"
_a
,
"pixsize_y"
_a
,
...
...
@@ -211,3 +212,9 @@ PYBIND11_MODULE(nifty_gridder, m)
"wgt"
_a
=
None
,
"pixsize_x"
_a
,
"pixsize_y"
_a
,
"nu"
_a
,
"nv"
_a
,
"epsilon"
_a
,
"do_wstacking"
_a
=
false
,
"nthreads"
_a
=
1
,
"verbosity"
_a
=
0
);
}
}
using
detail_nifty_gridder
::
add_nifty_gridder
;
}
pyHealpix/pyHealpix.cc
View file @
025e08dd
...
...
@@ -39,13 +39,15 @@
#include
"mr_util/math/geom_utils.h"
#include
"mr_util/bindings/pybind_utils.h"
namespace
mr
{
namespace
detail_pyHealpix
{
using
namespace
std
;
using
namespace
mr
;
namespace
py
=
pybind11
;
namespace
{
using
shape_t
=
fmav_info
::
shape_t
;
template
<
size_t
nd1
,
size_t
nd2
>
shape_t
repl_dim
(
const
shape_t
&
s
,
...
...
@@ -343,12 +345,10 @@ that their last dimension is removed.
The employed algorithm is highly accurate, even for angles close to 0 or pi.
)"""
;
}
// unnamed namespace
PYBIND11_MODULE
(
pyHealpix
,
m
)
void
add_pyHealpix
(
py
::
module
&
msup
)
{
using
namespace
pybind11
::
literals
;
auto
m
=
msup
.
def_submodule
(
"pyHealpix"
);
m
.
doc
()
=
pyHealpix_DS
;
py
::
class_
<
Pyhpbase
>
(
m
,
"Healpix_Base"
)
...
...
@@ -382,3 +382,9 @@ PYBIND11_MODULE(pyHealpix, m)
m
.
def
(
"vec2ang"
,
&
vec2ang
,
vec2ang_DS
,
"vec"
_a
);
m
.
def
(
"v_angle"
,
&
local_v_angle
,
v_angle_DS
,
"v1"
_a
,
"v2"
_a
);
}
}
using
detail_pyHealpix
::
add_pyHealpix
;
}
pyinterpol_ng/pyinterpol_ng.cc
View file @
025e08dd
...
...
@@ -7,13 +7,15 @@
#include
<pybind11/numpy.h>
#include
"interpol_ng.h"
namespace
mr
{
namespace
detail_pyinterpol_ng
{
using
namespace
std
;
using
namespace
mr
;
namespace
py
=
pybind11
;
namespace
{
template
<
typename
T
>
class
PyInterpolator
:
public
Interpolator
<
T
>
{
protected:
...
...
@@ -232,11 +234,10 @@ Notes
- must be the last call to the object
)"""
;
}
// unnamed namespace
PYBIND11_MODULE
(
pyinterpol_ng
,
m
)
void
add_pyinterpol_ng
(
py
::
module
&
msup
)
{
using
namespace
pybind11
::
literals
;
auto
m
=
msup
.
def_submodule
(
"pyinterpol_ng"
);
m
.
doc
()
=
pyinterpol_ng_DS
;
...
...
@@ -268,3 +269,9 @@ PYBIND11_MODULE(pyinterpol_ng, m)
#endif
m
.
def
(
"epsilon_guess"
,
&
epsilon_guess
,
"support"
_a
,
"ofactor"
_a
);
}
}
using
detail_pyinterpol_ng
::
add_pyinterpol_ng
;
}
pypocketfft/pypocketfft.cc
View file @
025e08dd
...
...
@@ -19,6 +19,10 @@
#include
"mr_util/math/fft.h"
#include
"mr_util/bindings/pybind_utils.h"
namespace
mr
{
namespace
detail_pypocketfft
{
namespace
{
using
shape_t
=
mr
::
fmav_info
::
shape_t
;
...
...
@@ -645,10 +649,10 @@ out : int
}
// unnamed namespace
PYBIND11_MODULE
(
pypocketfft
,
m
)
void
add_pypocketfft
(
py
::
module
&
msup
)
{
using
namespace
pybind11
::
literals
;
auto
m
=
msup
.
def_submodule
(
"pypocketfft"
);
m
.
doc
()
=
pypocketfft_DS
;
m
.
def
(
"c2c"
,
c2c
,
c2c_DS
,
"a"
_a
,
"axes"
_a
=
None
,
"forward"
_a
=
true
,
"inorm"
_a
=
0
,
"out"
_a
=
None
,
"nthreads"
_a
=
1
);
...
...
@@ -671,3 +675,9 @@ PYBIND11_MODULE(pypocketfft, m)
{{
"good_size"
,
good_size
,
METH_VARARGS
,
good_size_DS
},
{
0
,
0
,
0
,
0
}};
PyModule_AddFunctions
(
m
.
ptr
(),
good_size_meth
);
}
}
using
detail_pypocketfft
::
add_pypocketfft
;
}
pysharp/pysharp.cc
View file @
025e08dd
...
...
@@ -42,13 +42,15 @@
#include
"mr_util/math/constants.h"
#include
"mr_util/bindings/pybind_utils.h"
namespace
mr
{
namespace
detail_pysharp
{
using
namespace
std
;
using
namespace
mr
;
namespace
py
=
pybind11
;
namespace
{
using
a_d
=
py
::
array_t
<
double
>
;
using
a_d_c
=
py
::
array_t
<
double
,
py
::
array
::
c_style
|
py
::
array
::
forcecast
>
;
using
a_c_c
=
py
::
array_t
<
complex
<
double
>
,
...
...
@@ -266,12 +268,10 @@ py::array py_upsample_to_cc(const py::array &in, size_t nrings_out, bool has_np,
return
move
(
out
);
}
}
// unnamed namespace
PYBIND11_MODULE
(
pysharp
,
m
)
void
add_pysharp
(
py
::
module
&
msup
)
{
using
namespace
pybind11
::
literals
;
auto
m
=
msup
.
def_submodule
(
"pysharp"
);
m
.
doc
()
=
pysharp_DS
;
py
::
class_
<
py_sharpjob
<
double
>>
(
m
,
"sharpjob_d"
)
...
...
@@ -303,3 +303,10 @@ PYBIND11_MODULE(pysharp, m)
m
.
def
(
"upsample_to_cc"
,
&
py_upsample_to_cc
,
"in"
_a
,
"nrings_out"
_a
,
"has_np"
_a
,
"has_sp"
_a
,
"out"
_a
=
py
::
none
());
}
}
using
detail_pysharp
::
add_pysharp
;
}
setup.py
View file @
025e08dd
...
...
@@ -29,154 +29,20 @@ elif sys.platform == 'win32':
extra_compile_args
=
[
'/Ox'
,
'/EHsc'
,
'/std:c++17'
]
else
:
extra_compile_args
+=
[
'-Wfatal-errors'
,
'-Wfloat-conversion'
,
'-W'
,
'-Wall'
,
'-Wstrict-aliasing=2'
,
'-Wwrite-strings'
,
'-Wredundant-decls'
,
'-Woverloaded-virtual'
,
'-Wcast-qual'
,
'-Wcast-align'
,
'-Wpointer-arith'
]
python_module_link_args
+=
[
'-march=native'
,
'-Wl,-rpath,$ORIGIN'
,
'-s'
]
python_module_link_args
+=
[
'-march=native'
,
'-Wl,-rpath,$ORIGIN'
,
'-s'
]
# if you don't want debugging info, add "-s" to python_module_link_args
def
get_extension_modules
():
return
[
Extension
(
pkgname
+
'.pypocketfft'
,
return
[
Extension
(
pkgname
,
language
=
'c++'
,
sources
=
[
'pypocketfft/pypocketfft.cc'
,
'src/mr_util/infra/threading.cc'
],
depends
=
[
'src/mr_util/infra/useful_macros.h'
,
'src/mr_util/math/fft.h'
,
'src/mr_util/math/fft1d.h'
,
'src/mr_util/infra/mav.h'
,
'src/mr_util/infra/threading.h'
,
'src/mr_util/infra/aligned_array.h'
,
'src/mr_util/infra/simd.h'
,
'src/mr_util/math/cmplx.h'
,
'src/mr_util/math/unity_roots.h'
,
'src/mr_util/infra/error_handling.h'
,
'src/mr_util/bindings/pybind_utils.h'
,
'setup.py'
],
sources
=
[
'cxxbase.cc'
],
depends
=
[],
include_dirs
=
include_dirs
,
define_macros
=
define_macros
,
extra_compile_args
=
extra_compile_args
,
extra_link_args
=
python_module_link_args
),
Extension
(
pkgname
+
'.pysharp'
,
language
=
'c++'
,
sources
=
[
'pysharp/pysharp.cc'
,
'src/mr_util/infra/threading.cc'
,
'src/mr_util/infra/string_utils.cc'
,
'src/mr_util/sharp/sharp.cc'
,
'src/mr_util/sharp/sharp_core.cc'
,
'src/mr_util/sharp/sharp_geomhelpers.cc'
,
'src/mr_util/sharp/sharp_almhelpers.cc'
,
'src/mr_util/sharp/sharp_ylmgen.cc'
],
depends
=
[
'src/mr_util/fft1d.h'
,
'src/mr_util/fft.h'
,
'src/mr_util/infra/threading.h'
,
'src/mr_util/infra/mav.h'
,
'src/mr_util/math_utils.h'
,
'src/mr_util/infra/aligned_array.h'
,
'src/mr_util/math/gl_integrator.h'
,
'src/mr_util/infra/simd.h'
,
'src/mr_util/math/cmplx.h'
,
'src/mr_util/infra/string_utils.h'
,
'src/mr_util/infra/timers.h'
,
'src/mr_util/math/constants.h'
,
'src/mr_util/math/unity_roots.h'
,
'src/mr_util/infra/error_handling.h'
,
'src/mr_util/infra/useful_macros.h'
,
'src/mr_util/bindings/pybind_utils.h'
,
'src/mr_util/sharp/sharp.h'
,
'src/mr_util/sharp/sharp_internal.h'
,
'src/mr_util/sharp/sharp_geomhelpers.h'
,
'src/mr_util/sharp/sharp_almhelpers.h'
'setup.py'
],
include_dirs
=
include_dirs
,
define_macros
=
define_macros
,
extra_compile_args
=
extra_compile_args
,
extra_link_args
=
python_module_link_args
),
Extension
(
pkgname
+
'.pyHealpix'
,
language
=
'c++'
,
sources
=
[
'pyHealpix/pyHealpix.cc'
,
'src/mr_util/math/geom_utils.cc'
,
'src/mr_util/math/pointing.cc'
,
'src/mr_util/infra/string_utils.cc'
,
'src/mr_util/math/space_filling.cc'
,
'src/mr_util/healpix/healpix_base.cc'
,
'src/mr_util/healpix/healpix_tables.cc'
],
depends
=
[
'src/mr_util/infra/mav.h'
,
'src/mr_util/math/math_utils.h'
,
'src/mr_util/math/space_filling.h'
,
'src/mr_util/math/rangeset.h'
,
'src/mr_util/infra/string_utils.h'
,
'src/mr_util/math/geom_utils.h'
,
'src/mr_util/math/pointing.h'
,
'src/mr_util/math/vec3.h'
,
'src/mr_util/math/constants.h'
,
'src/mr_util/infra/error_handling.h'
,
'src/mr_util/healpix/healpix_base.h'
,
'src/mr_util/healpix/healpix_tables.h'
,
'src/mr_util/bindings/pybind_utils.h'
,
'setup.py'
],
include_dirs
=
include_dirs
,
define_macros
=
define_macros
,
extra_compile_args
=
extra_compile_args
,
extra_link_args
=
python_module_link_args
),
Extension
(
pkgname
+
'.nifty_gridder'
,
sources
=
[
'nifty_gridder/nifty_gridder.cc'
,
'src/mr_util/infra/threading.cc'
],
depends
=
[
'src/mr_util/infra/useful_macros.h'
,
'src/mr_util/math/constants.h'
,
'src/mr_util/math/gl_integrator.h'
,
'src/mr_util/infra/error_handling.h'
,
'src/mr_util/math/fft.h'
,
'src/mr_util/math/fft1d.h'
,
'src/mr_util/infra/threading.h'
,
'src/mr_util/infra/aligned_array.h'
,
'src/mr_util/infra/simd.h'
,
'src/mr_util/infra/mav.h'
,
'src/mr_util/math/cmplx.h'
,
'src/mr_util/math/unity_roots.h'
,
'src/mr_util/math/es_kernel.h'
,
'src/mr_util/bindings/pybind_utils.h'
,
'nifty_gridder/gridder_cxx.h'
,
'setup.py'
],
include_dirs
=
include_dirs
+
[
'./nifty_gridder'
],
extra_compile_args
=
extra_compile_args
,
extra_link_args
=
python_module_link_args
),
Extension
(
pkgname
+
'.pyinterpol_ng'
,
language
=
'c++'
,
sources
=
[
'pyinterpol_ng/pyinterpol_ng.cc'
,
'src/mr_util/infra/threading.cc'
,
'src/mr_util/sharp/sharp.cc'
,
'src/mr_util/sharp/sharp_core.cc'
,
'src/mr_util/sharp/sharp_geomhelpers.cc'
,
'src/mr_util/sharp/sharp_almhelpers.cc'
,
'src/mr_util/sharp/sharp_ylmgen.cc'
],
depends
=
[
'src/mr_util/math/fft1d.h'
,
'src/mr_util/math/fft.h'
,
'src/mr_util/infra/threading.h'
,
'src/mr_util/infra/mav.h'
,
'src/mr_util/math/math_utils.h'
,
'src/mr_util/infra/aligned_array.h'
,
'src/mr_util/math/gl_integrator.h'
,
'src/mr_util/infra/simd.h'
,
'src/mr_util/math/cmplx.h'
,
'src/mr_util/infra/string_utils.h'
,
'src/mr_util/infra/timers.h'
,
'src/mr_util/math/constants.h'
,
'src/mr_util/math/unity_roots.h'
,
'src/mr_util/math/es_kernel.h'
,
'src/mr_util/infra/error_handling.h'
,
'src/mr_util/infra/useful_macros.h'
,
'src/mr_util/bindings/pybind_utils.h'
,
'src/mr_util/sharp/sharp.h'
,
'src/mr_util/sharp/sharp_internal.h'
,
'src/mr_util/sharp/sharp_geomhelpers.h'
,
'src/mr_util/sharp/sharp_almhelpers.h'
,
'setup.py'
,
'pyinterpol_ng/interpol_ng.h'
,
'pyinterpol_ng/alm.h'
],
include_dirs
=
include_dirs
+
[
'./pyinterpol_ng'
],
define_macros
=
define_macros
,
extra_compile_args
=
extra_compile_args
,
extra_link_args
=
python_module_link_args
),
]
]
setup
(
name
=
pkgname
,
...
...
src/mr_util/healpix/healpix_base.cc
View file @
025e08dd
...
...
@@ -35,12 +35,12 @@
#include
"mr_util/infra/mav.h"
#include
"mr_util/math/space_filling.h"
using
namespace
std
;
namespace
mr
{
namespace
detail_healpix
{
using
namespace
std
;
namespace
{
template
<
typename
T
>
inline
T
spread
(
int
v
);
...
...
src/mr_util/healpix/healpix_base.h
View file @
025e08dd
...
...
@@ -166,7 +166,7 @@ template<typename I> class T_Healpix_Base: public Healpix_Tables
double
phi
=
safe_atan2
(
vec
.
y
,
vec
.
x
);
double
nz
=
vec
.
z
*
xl
;
if
(
std
::
abs
(
nz
)
>
0.99
)
return
loc2pix
(
nz
,
phi
,
sqrt
(
vec
.
x
*
vec
.
x
+
vec
.
y
*
vec
.
y
)
*
xl
,
true
);
return
loc2pix
(
nz
,
phi
,
std
::
sqrt
(
vec
.
x
*
vec
.
x
+
vec
.
y
*
vec
.
y
)
*
xl
,
true
);
else
return
loc2pix
(
nz
,
phi
,
0
,
false
);
}
...
...
src/mr_util/healpix/healpix_tables.cc
View file @
025e08dd
...
...
@@ -33,12 +33,12 @@
#include
"mr_util/infra/string_utils.h"
#include
"mr_util/infra/error_handling.h"
using
namespace
std
;
namespace
mr
{
namespace
detail_healpix
{
using
namespace
std
;
const
nside_dummy
SET_NSIDE
=
nside_dummy
();
Ordering_Scheme
string2HealpixScheme
(
const
string
&
inp
)
...
...
src/mr_util/infra/simd.h
View file @
025e08dd
...
...
@@ -418,6 +418,16 @@ using detail_simd::sqrt;
using
detail_simd
::
any_of
;
using
detail_simd
::
none_of
;
using
detail_simd
::
all_of
;
// since we are explicitly introducing a few names that are also available in
// std::, we need to import them from std::as well, otherwise name resolution
// can fail in certain circumstances.
using
std
::
abs
;
using
std
::
sqrt
;
using
std
::
max
;
}
#endif
src/mr_util/infra/string_utils.cc
View file @
025e08dd
...
...
@@ -40,10 +40,12 @@
#include
"mr_util/infra/string_utils.h"
#include
"mr_util/infra/error_handling.h"
using
namespace
std
;
namespace
mr
{
namespace
detail_string_utils
{
using
namespace
std
;
string
trim
(
const
string
&
orig
)
{
string
::
size_type
p1
=
orig
.
find_first_not_of
(
"
\t
"
);
...
...
@@ -330,4 +332,4 @@ void parse_words_from_file (const string &filename, vector<string> &words)
}
}
}
}
}
src/mr_util/infra/string_utils.h
View file @
025e08dd
...
...
@@ -27,6 +27,8 @@
namespace
mr
{
namespace
detail_string_utils
{
/*! \defgroup stringutilsgroup String handling helper functions */
/*! \{ */
...
...
@@ -113,4 +115,19 @@ void parse_words_from_file (const std::string &filename,
}
using
detail_string_utils
::
trim
;
using
detail_string_utils
::
intToString
;
using
detail_string_utils
::
dataToString
;
using
detail_string_utils
::
stringToData
;
using
detail_string_utils
::
parse_file
;
using
detail_string_utils
::
parse_cmdline_classic
;
using
detail_string_utils
::
parse_cmdline_equalsign
;
using
detail_string_utils
::
equal_nocase
;
using
detail_string_utils
::
tolower
;
using
detail_string_utils
::
split
;
using
detail_string_utils
::
tokenize
;
using
detail_string_utils
::
parse_words_from_file
;
}
#endif
src/mr_util/infra/system.cc
View file @
025e08dd
...
...
@@ -28,11 +28,11 @@
#include
"mr_util/infra/system.h"
#include
"mr_util/infra/string_utils.h"
using
namespace
std
;
namespace
mr
{
namespace
{
namespace
detail_system
{
using
namespace
std
;
string
fileToString
(
const
string
&
fname
)
{
...
...
@@ -51,8 +51,6 @@ template<typename T> T find(const string &s, const string &pattern)
return
stringToData
<
T
>
(
it
->
str
(
1
));
}
}
// unnamed namespace
size_t
getProcessInfo
(
const
string
&
quantity
)
{
string
text
=
fileToString
(
"/proc/self/status"
);
...
...
@@ -73,4 +71,4 @@ size_t usable_memory()
return
MemTotal
-
Committed
;
}
}
}
}
src/mr_util/infra/system.h
View file @
025e08dd
...
...
@@ -27,10 +27,18 @@
namespace
mr
{
namespace
detail_system
{
std
::
size_t
getProcessInfo
(
const
std
::
string
&
quantity
);
std
::
size_t
getMemInfo
(
const
std
::
string
&
quantity
);
std
::
size_t
usable_memory
();
}
using
detail_system
::
getProcessInfo
;
using
detail_system
::
getMemInfo
;
using
detail_system
::
usable_memory
;
}
#endif
src/mr_util/math/es_kernel.h
View file @
025e08dd
...
...
@@ -63,7 +63,6 @@ class ES_Kernel
template
<
typename
T
>
T
operator
()(
T
v
)
const
{
using
std
::
sqrt
;
auto
tmp
=
(
1
-
v
)
*
(
1
+
v
);
auto
tmp2
=
tmp
>=
0
;
return
tmp2
*
exp
(
T
(
beta
)
*
(
sqrt
(
tmp
*
tmp2
)
-
1
));
...
...
src/mr_util/math/geom_utils.cc
View file @
025e08dd
...
...
@@ -30,10 +30,12 @@
#include
"mr_util/math/geom_utils.h"
#include
"mr_util/infra/error_handling.h"
using
namespace
std
;
namespace
mr
{
namespace
detail_geom_utils
{
using
namespace
std
;
namespace
{
void
get_circle
(
const
vector
<
vec3
>
&
point
,
size_t
q1
,
size_t
q2
,
vec3
&
center
,
...
...
@@ -74,4 +76,4 @@ void find_enclosing_circle (const vector<vec3> &point, vec3 ¢er,
get_circle
(
point
,
i
,
center
,
cosrad
);
}
}
}
}
src/mr_util/math/geom_utils.h
View file @
025e08dd
...
...
@@ -34,11 +34,14 @@
#define MRUTIL_GEOM_UTILS_H
#include
<vector>
#include
<cmath>
#include
"mr_util/math/math_utils.h"
#include
"mr_util/math/vec3.h"
namespace
mr
{
namespace
detail_geom_utils
{
/*! Returns the orientation when looking from point \a loc on the unit
sphere in the direction \a dir. \a loc must be normalized. The result
ranges from -pi to pi, is 0 for North and pi/2 for West, i.e. the angle
...
...
@@ -69,7 +72,7 @@ inline double v_angle (const vec3 &v1, const vec3 &v2)
inline
double
cosdist_zphi
(
double
z1
,
double
phi1
,
double
z2
,
double
phi2
)
{
using
namespace
std
;
return
z1
*
z2
+
cos
(
phi1
-
phi2
)
*
sqrt
((
1.
-
z1
*
z1
)
*
(
1.
-
z2
*
z2
));
return
z1
*
z2
+
cos
(
phi1
-
phi2
)
*
std
::
sqrt
((
1.
-
z1
*
z1
)
*
(
1.
-
z2
*
z2
));
}
/*! Finds the smallest enclosing cone for a point set on the sphere according to
...
...
@@ -81,4 +84,11 @@ void find_enclosing_circle (const std::vector<vec3> &point, vec3 ¢er,
}
using
detail_geom_utils
::
orientation
;
using
detail_geom_utils
::
v_angle
;
using
detail_geom_utils
::
cosdist_zphi
;
using
detail_geom_utils
::
find_enclosing_circle
;
}
#endif
src/mr_util/math/vec3.h
View file @
025e08dd
...
...
@@ -84,7 +84,7 @@ template<typename T>class vec3_t
/*! Returns the length of the vector. */
T
Length
()
const
{
return
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
);
}
{
return
std
::
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
);
}