Revision 8bd0e138ee70eb43357447735a7581a969eaf201 authored by Thomas Fischer on 04 October 2021, 13:23:29 UTC, committed by Dmitry Yu. Naumov on 05 October 2021, 11:26:07 UTC
1 parent 4e7fecf
TestParallel.cpp
/**
* @file TestParall.cpp
* @date Feb 26, 2014
*
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include <gtest/gtest.h>
#include "GeoLib/AnalyticalGeometry.h"
TEST(GeoLib, TestParallel)
{
// parallel vectors
Eigen::Vector3d v(0.0, 1.0, 2.0);
Eigen::Vector3d w(0.0, 2.0, 4.0);
EXPECT_TRUE(GeoLib::parallel(v, w));
EXPECT_TRUE(GeoLib::parallel(w, v));
v[1] = 0.0;
w[1] = 0.0;
EXPECT_TRUE(GeoLib::parallel(v, w));
EXPECT_TRUE(GeoLib::parallel(w, v));
// degenerate cases
v[2] = 0.0;
w[2] = 0.0;
EXPECT_FALSE(GeoLib::parallel(v, w));
EXPECT_FALSE(GeoLib::parallel(w, v));
w[2] = 0.1;
EXPECT_FALSE(GeoLib::parallel(v, w));
EXPECT_FALSE(GeoLib::parallel(w, v));
// non-parallel case
v[1] = 0.1;
EXPECT_FALSE(GeoLib::parallel(v, w));
EXPECT_FALSE(GeoLib::parallel(w, v));
// parallel vectors, opposite sense of direction
v[0] = 0.0;
v[1] = 1.0;
v[2] = 2.0;
w[0] = 0.0;
w[1] = -2.0;
w[2] = -4.0;
EXPECT_TRUE(GeoLib::parallel(v, w));
EXPECT_TRUE(GeoLib::parallel(w, v));
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...