/* * Vector3.h * RVO2-3D Library * * Copyright 2008 University of North Carolina at Chapel Hill * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Please send all bug reports to <[email protected]>. * * The authors may be contacted via: * * Jur van den Berg, Stephen J. Guy, Jamie Snape, Ming C. Lin, Dinesh Manocha * Dept. of Computer Science * 201 S. Columbia St. * Frederick P. Brooks, Jr. Computer Science Bldg. * Chapel Hill, N.C. 27599-3175 * United States of America * * <https://gamma.cs.unc.edu/RVO2/> */ /** * \file Vector3.h * \brief Contains the Vector3 class. */ #ifndef RVO3D_VECTOR3_H_ #define RVO3D_VECTOR3_H_ #include <cmath> #include <cstddef> #include <ostream> namespace RVO3D { /** * \brief Defines a three-dimensional vector. */ class Vector3 { … }; /** * \relates Vector3 * \brief Computes the scalar multiplication of the specified three-dimensional vector with the specified scalar value. * \param scalar The scalar value with which the scalar multiplication should be computed. * \param vector The three-dimensional vector with which the scalar multiplication should be computed. * \return The scalar multiplication of the three-dimensional vector with the scalar value. */ inline Vector3 operator*(float scalar, const Vector3 &vector) { … } /** * \relates Vector3 * \brief Computes the cross product of the specified three-dimensional vectors. * \param vector1 The first vector with which the cross product should be computed. * \param vector2 The second vector with which the cross product should be computed. * \return The cross product of the two specified vectors. */ inline Vector3 cross(const Vector3 &vector1, const Vector3 &vector2) { … } /** * \relates Vector3 * \brief Inserts the specified three-dimensional vector into the specified output stream. * \param os The output stream into which the three-dimensional vector should be inserted. * \param vector The three-dimensional vector which to insert into the output stream. * \return A reference to the output stream. */ inline std::ostream &operator<<(std::ostream &os, const Vector3 &vector) { … } /** * \relates Vector3 * \brief Computes the length of a specified three-dimensional vector. * \param vector The three-dimensional vector whose length is to be computed. * \return The length of the three-dimensional vector. */ inline float abs(const Vector3 &vector) { … } /** * \relates Vector3 * \brief Computes the squared length of a specified three-dimensional vector. * \param vector The three-dimensional vector whose squared length is to be computed. * \return The squared length of the three-dimensional vector. */ inline float absSq(const Vector3 &vector) { … } /** * \relates Vector3 * \brief Computes the normalization of the specified three-dimensional vector. * \param vector The three-dimensional vector whose normalization is to be computed. * \return The normalization of the three-dimensional vector. */ inline Vector3 normalize(const Vector3 &vector) { … } } #endif