2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2016-08-11 00:30:29 +03:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-10-04 02:35:52 +03:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2016-08-11 00:30:29 +03:00
|
|
|
#include "BSPTree.h"
|
|
|
|
#include "Polygon.h"
|
2016-10-04 02:35:52 +03:00
|
|
|
#include "PolygonTestUtils.h"
|
2016-08-11 00:30:29 +03:00
|
|
|
|
|
|
|
#include <deque>
|
2017-04-04 04:15:48 +03:00
|
|
|
#include <list>
|
2016-08-11 00:30:29 +03:00
|
|
|
|
2016-10-04 02:35:52 +03:00
|
|
|
using namespace mozilla::gfx;
|
|
|
|
using namespace mozilla::layers;
|
2017-02-05 20:50:00 +03:00
|
|
|
typedef mozilla::gfx::Polygon MozPolygon;
|
2016-08-11 00:30:29 +03:00
|
|
|
|
2016-09-17 02:03:32 +03:00
|
|
|
namespace {
|
2016-08-11 00:30:29 +03:00
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
static void RunTest(std::deque<MozPolygon> aPolygons,
|
|
|
|
std::deque<MozPolygon> aExpected)
|
2016-08-11 00:30:29 +03:00
|
|
|
{
|
2017-04-10 17:35:56 +03:00
|
|
|
std::list<LayerPolygon> layers;
|
2017-02-05 20:50:00 +03:00
|
|
|
for (MozPolygon& polygon : aPolygons) {
|
2018-05-30 22:15:35 +03:00
|
|
|
layers.push_back(LayerPolygon(nullptr, std::move(polygon)));
|
2016-09-17 02:03:32 +03:00
|
|
|
}
|
2016-08-11 00:30:29 +03:00
|
|
|
|
2016-09-17 02:03:32 +03:00
|
|
|
const BSPTree tree(layers);
|
|
|
|
const nsTArray<LayerPolygon> order = tree.GetDrawOrder();
|
|
|
|
|
|
|
|
EXPECT_EQ(aExpected.size(), order.Length());
|
2016-08-11 00:30:29 +03:00
|
|
|
|
|
|
|
for (size_t i = 0; i < order.Length(); ++i) {
|
2016-09-17 02:03:32 +03:00
|
|
|
EXPECT_TRUE(aExpected[i] == *order[i].geometry);
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-17 02:03:32 +03:00
|
|
|
} // namespace
|
|
|
|
|
2016-08-11 00:30:29 +03:00
|
|
|
|
|
|
|
TEST(BSPTree, SameNode)
|
|
|
|
{
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 0.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 0.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
::RunTest(polygons, polygons);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, OneChild)
|
|
|
|
{
|
2017-02-05 20:50:00 +03:00
|
|
|
const MozPolygon p1 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 0.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const MozPolygon p2 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 1.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
};
|
|
|
|
|
2016-09-17 02:03:32 +03:00
|
|
|
::RunTest({p1, p2}, {p1, p2});
|
|
|
|
::RunTest({p2, p1}, {p1, p2});
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
|
2016-10-04 02:35:52 +03:00
|
|
|
TEST(BSPTree, SharedEdge1)
|
|
|
|
{
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p1 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p2 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(2.0f, 2.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(2.0f, 0.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
::RunTest({p1, p2}, {p1, p2});
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, SharedEdge2)
|
|
|
|
{
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p1 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p2 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(2.0f, 2.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(2.0f, 0.0f, 0.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
::RunTest({p1, p2}, {p2, p1});
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, SplitSharedEdge)
|
|
|
|
{
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p1 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p2 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 0.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(1.0f, 0.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f)
|
2016-10-04 02:35:52 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
::RunTest({p1, p2}, expected);
|
|
|
|
}
|
|
|
|
|
2016-08-11 00:30:29 +03:00
|
|
|
TEST(BSPTree, SplitSimple1)
|
|
|
|
{
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p1 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 1.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon p2 {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 1.0f, 0.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 1.0f, 0.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 0.5f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.5f, 1.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 1.0f, 0.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
|
|
|
p1,
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.0f, 0.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.0f, 2.0f, 1.0f),
|
|
|
|
Point4D(1.0f, 0.5f, 1.0f, 1.0f),
|
|
|
|
Point4D(0.0f, 0.5f, 1.0f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
::RunTest({p1, p2}, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, SplitSimple2) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, -5.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, 5.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, -5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, NoSplit1) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 10.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 0.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 0.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 10.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 10.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 0.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 0.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 10.00000f, -5.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 10.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 0.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 0.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 10.00000f, 5.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 10.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 0.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 0.00000f, -5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 10.00000f, -5.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 10.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 0.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 0.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 10.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 10.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 0.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 0.00000f, 5.00000f, 1.0f),
|
|
|
|
Point4D(10.00000f, 10.00000f, 5.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, NoSplit2) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 5.00000f, -15.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, -15.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, -10.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, -10.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(0.00000f, 5.00000f, -15.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, -15.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, -5.00000f, -10.00000f, 1.0f),
|
|
|
|
Point4D(0.00000f, 5.00000f, -10.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-5.00000f, -5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(-5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, 5.00000f, 0.00000f, 1.0f),
|
|
|
|
Point4D(5.00000f, -5.00000f, 0.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate0degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate20degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
|
|
|
|
Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
|
|
|
|
Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate40degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate60degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate80degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
|
|
|
|
Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
|
|
|
|
Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate100degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate120degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.73200f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate140degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
|
|
|
|
Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
|
|
|
|
Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate160degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate180degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate200degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
|
|
|
|
Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
|
|
|
|
Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate220degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate240degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -0.73200f, -2.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(0.00010f, 0.73210f, 2.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.26793f, 0.73210f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.26793f, 0.73210f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate260degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
|
|
|
|
Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(-0.00000f, -2.56340f, 1.19540f, 1.0f),
|
|
|
|
Point4D(0.00010f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.56350f, -1.19530f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate280degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, -1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 2.73210f, -0.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 0.73210f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, -2.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-2.00000f, -1.26783f, -0.73200f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(2.00000f, 1.73210f, 1.00010f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.26783f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate300degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, 0.73210f, -2.73200f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.73210f, 0.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -0.73200f, 2.73210f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.73200f, -0.73200f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 1.73210f, -0.99990f, 1.0f),
|
|
|
|
Point4D(2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -1.73200f, 1.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 1.73210f, -0.99990f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate320degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
|
|
|
|
Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -1.19530f, -2.56340f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.56350f, -1.19530f, 1.0f),
|
|
|
|
Point4D(0.00010f, 1.19540f, 2.56350f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.56340f, 1.19540f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.68410f, -1.87930f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.68400f, 1.87940f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.68410f, -1.87930f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate340degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(BSPTree, TwoPlaneIntersectRotate360degrees) {
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> polygons {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-05 20:50:00 +03:00
|
|
|
const std::deque<MozPolygon> expected {
|
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(-0.00000f, -2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(-0.00000f, 2.00000f, -2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, 2.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(0.00010f, -2.00000f, 2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
},
|
2017-02-05 20:50:00 +03:00
|
|
|
MozPolygon {
|
2017-04-04 04:15:48 +03:00
|
|
|
Point4D(2.00000f, 0.00010f, -2.00000f, 1.0f),
|
|
|
|
Point4D(2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, -0.00000f, 2.00000f, 1.0f),
|
|
|
|
Point4D(-2.00000f, 0.00010f, -2.00000f, 1.0f)
|
2016-08-11 00:30:29 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
::RunTest(polygons, expected);
|
2016-08-16 21:01:06 +03:00
|
|
|
}
|