本文整理汇总了C++中vector3::length方法的典型用法代码示例。如果您正苦于以下问题:C++ vector3::length方法的具体用法?C++ vector3::length怎么用?C++ vector3::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector3
的用法示例。
在下文中一共展示了vector3::length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetData
//! Implements <a href="http://qsar.sourceforge.net/dicts/blue-obelisk/index.xhtml#calculateOrthogonalisationMatrix">blue-obelisk:calculateOrthogonalisationMatrix</a>
void OBUnitCell::SetData(const vector3 v1, const vector3 v2, const vector3 v3)
{
matrix3x3 m (v1, v2, v3);
_mOrtho.FillOrth(vectorAngle(v2,v3), // alpha
vectorAngle(v1,v3), // beta
vectorAngle(v1,v2), // gamma
v1.length(), // a
v2.length(), // b
v3.length()); // c
_mOrient = m.transpose() * _mOrtho.inverse();
_spaceGroup = NULL;
_spaceGroupName = "";
_lattice = OBUnitCell::Undefined;
}
示例2:
quaternion<Real> quaternion<Real>::buildRotation(const vector3<Real> &axis, Real angle)
{
HASSERT(isAbout(1, axis.length()));
Real sina2 = (Real)sin(0.5 * angle);
return quaternion<Real>((Real)cos(0.5 * angle), axis.x * sina2, axis.y * sina2, axis.z * sina2);
}
示例3: 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));