V3FIT
vector3d.hpp
1 //
2 // vector3d.hpp
3 // lgrid
4 //
5 // Created by Cianciosa, Mark R. on 2/7/16.
6 // Copyright © 2016 Cianciosa, Mark R. All rights reserved.
7 //
8 
9 #ifndef vector3d_hpp
10 #define vector3d_hpp
11 
12 #include <stdio.h>
13 
14 //------------------------------------------------------------------------------
18 //------------------------------------------------------------------------------
19 class vector3d {
20 public:
22  const double x;
24  const double y;
26  const double z;
27 
28  vector3d(const double x_, const double y_, const double z_);
29 
30  const double length() const;
31  const vector3d normalize() const;
32 
33  static const vector3d cross_product(const vector3d &v1, const vector3d &v2);
34  static const double dot_product(const vector3d &v1, const vector3d &v2);
35 };
36 
37 const vector3d operator+(const vector3d &v1, const vector3d &v2);
38 const vector3d operator-(const vector3d &v1, const vector3d &v2);
39 const vector3d operator/(const vector3d &v1, const double d);
40 
41 #endif /* vector3d_hpp */
vector3d::cross_product
static const vector3d cross_product(const vector3d &v1, const vector3d &v2)
Takes the cross product of two vectors.
Definition: vector3d.cpp:56
vector3d::vector3d
vector3d(const double x_, const double y_, const double z_)
vector3d constructor.
Definition: vector3d.cpp:21
vector3d
A vector.
Definition: vector3d.hpp:19
vector3d::x
const double x
x component.
Definition: vector3d.hpp:22
vector3d::dot_product
static const double dot_product(const vector3d &v1, const vector3d &v2)
Takes the doc product of two vectors.
Definition: vector3d.cpp:71
vector3d::normalize
const vector3d normalize() const
Normalize vector3d instance.
Definition: vector3d.cpp:43
vector3d::length
const double length() const
Length of a vector3d instance.
Definition: vector3d.cpp:32
vector3d::y
const double y
y component.
Definition: vector3d.hpp:24
vector3d::z
const double z
z component.
Definition: vector3d.hpp:26