TrueReality  v0.1.1912
Vec3f.cpp
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #include <trBase/Vec3f.h>
23 
24 #include <osg/Vec3d>
25 #include <trBase/Vec3d.h>
26 
27 // Specialize Vec3Impl to be Vec3f
28 #define Vec3Impl Vec3f
29 
30 namespace trBase
31 {
33  Vec3f::Vec3f(const osg::Vec3d &v)
34  : mVec(static_cast<double>(v.x()), static_cast<double>(v.y()), static_cast<double>(v.z()))
35  {
36  }
37 
39  void Vec3f::operator = (const Vec3d& v)
40  {
41  mVec[0] = static_cast<double>(v.X()); mVec[1] = static_cast<double>(v.Y()); mVec[2] = static_cast<double>(v.Z());
42  }
43 }
44 
45 // Now compile up Vector via Vec2Impl
46 #include "Vec3Impl.cpp"
value_type & Z()
Returns the Z component of the vector.
General purpose 3D double Vector.
Definition: Vec3d.h:47
osg::Vec3f mVec
Definition: Vec3f.h:343
void operator=(const Vec3f &v)
Set operator.
value_type & Y()
Returns the Y component of the vector.
Vec3f()
Default constructor.
value_type & X()
Returns the X component of the vector.