:orphan: .. **************************************************************************** .. CUI .. .. The Advanced Framework for Simulation, Integration, and Modeling (AFSIM) .. .. The use, dissemination or disclosure of data in this file is subject to .. limitation or restriction. See accompanying README and LICENSE for details. .. **************************************************************************** Vec3 ---- .. class:: Vec3 inherits Object :constructible: :cloneable: :class:`Vec3` provides storage of a 3d vector, and related methods to manipulate them. Static Methods ============== .. method:: static Vec3 Construct(double x, double y, double z) Returns a new Vec3 with the value {x,y,z} .. method:: static Vec3 Add(Vec3 a, Vec3 b) Returns *a + b* .. method:: static Vec3 Subtract(Vec3 a, Vec3 b) Returns *a - b* .. method:: static double Dot(Vec3 a, Vec3 b) Returns the dot product of a . b = a.x * b.x + a.y * b.y + a.z * b.z .. method:: static Vec3 Cross(Vec3 a, Vec3 b) Returns the cross product of a x b = { a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x} .. method:: static double AngleWith(Vec3 a, Vec3 b) Returns the angle in degrees between *a* and *b* Methods ======= .. method:: double X() double Y() double Z() Returns the first, second, and third components respectively. .. method:: double Get(int index) Returns the *index* component where *index* is in [0,2]. .. method:: double Magnitude() Returns the magnitude or length of the vector. .. method:: double MagnitudeSquared() Returns the square of the magnitude or length of the vector. .. method:: Vec3 Normal() Returns a copy of the vector in normalized form, magnitude of 1. .. method:: double Normalize() Changes this vector to normal form, same as Scale(1.0/Magnitude). Returns the magnitude of the vector before normalizing. .. method:: void Scale(double scale) Multiplies each component of the vector by *scale*. .. method:: void Negate() Negates the vector. Effectively the same as scaling the vector by -1, resulting in a vector of the same magnitude but opposite in direction. .. method:: void Set(double X, double Y, double Z) void SetX(double X) void SetY(double Y) void SetZ(double Z) Sets the values of one or all components.