本文整理汇总了C++中vector3::manhattan_length方法的典型用法代码示例。如果您正苦于以下问题:C++ vector3::manhattan_length方法的具体用法?C++ vector3::manhattan_length怎么用?C++ vector3::manhattan_length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector3
的用法示例。
在下文中一共展示了vector3::manhattan_length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK
// MathGP Library
// Copyright (c) 2012-2016 Borislav Stanimirov
//
// See the LICENSE.txt file, included in this
// distribution for details about the copyright
#include "mathgp_test.h"
using namespace mathgp;
TESTCASE("vector_geometry")
{
vector3 a = vector3::coord(0, 1, 0);
CHECK(close(a.length(), 1.f, mathgp::constants<float>::EPSILON()));
CHECK(a.length_sq() == 1.f);
CHECK(a.manhattan_length() == 1.f);
vector3 b = vector3::coord(1, 2, 3);
CHECK(close(b.length(), 3.741657387f, mathgp::constants<float>::EPSILON()));
CHECK(b.length_sq() == 14.f);
CHECK(b.manhattan_length() == 6.f);
CHECK(close(distance(a, b), 3.31662479f, mathgp::constants<float>::EPSILON()));
CHECK(distance_sq(a, b) == 11.f);
CHECK(manhattan_distance(a, b) == 5.f);
a = vector3::coord(0, 1, 0);
b = vector3::coord(1, 0, 0);
CHECK(orthogonal(a, b));