]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/arithmetic/cross_product.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
5 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
12 #include <geometry_test_common.hpp>
14 #include <boost/core/ignore_unused.hpp>
16 #include <boost/geometry/arithmetic/cross_product.hpp>
18 #include <boost/geometry/algorithms/assign.hpp>
20 #include <boost/geometry/geometries/point.hpp>
21 #include <boost/geometry/geometries/adapted/c_array.hpp>
22 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
23 #include <test_common/test_point.hpp>
30 bg::assign_values(p1
, 20, 30);
32 bg::assign_values(p2
, 45, 70);
33 P c
= bg::cross_product(p1
, p2
);
35 typedef typename
bg::coordinate_type
<P
>::type scalar_type
;
36 BOOST_CHECK_EQUAL(bg::get
<0>(c
), scalar_type(50));
43 bg::assign_values(p1
, 20, 30, 10);
45 bg::assign_values(p2
, 45, 70, 20);
46 P c
= bg::cross_product(p1
, p2
);
48 typedef typename
bg::coordinate_type
<P
>::type scalar_type
;
49 BOOST_CHECK_EQUAL(bg::get
<0>(c
), scalar_type(-100));
50 BOOST_CHECK_EQUAL(bg::get
<1>(c
), scalar_type(50));
51 BOOST_CHECK_EQUAL(bg::get
<2>(c
), scalar_type(50));
54 #ifdef TEST_FAIL_CROSS_PRODUCT
59 bg::assign_values(p1
, 20, 30, 10);
62 bg::assign_values(p2
, 45, 70, 20);
64 P c
= bg::cross_product(p1
, p2
);
65 boost::ignore_unused(c
);
69 int test_main(int, char* [])
71 test_2d
<bg::model::point
<int, 2, bg::cs::cartesian
> >();
72 test_2d
<bg::model::point
<float, 2, bg::cs::cartesian
> >();
73 test_2d
<bg::model::point
<double, 2, bg::cs::cartesian
> >();
75 test_3d
<bg::model::point
<int, 3, bg::cs::cartesian
> >();
76 test_3d
<bg::model::point
<float, 3, bg::cs::cartesian
> >();
77 test_3d
<bg::model::point
<double, 3, bg::cs::cartesian
> >();
79 #ifdef TEST_FAIL_CROSS_PRODUCT
80 test_4d
<bg::model::point
<int, 4, bg::cs::cartesian
> >();
81 test_4d
<bg::model::point
<float, 4, bg::cs::cartesian
> >();
82 test_4d
<bg::model::point
<double, 4, bg::cs::cartesian
> >();