RayTracer 1.0
Ray tracing is a technique used to generate realistic digital images by simulating the inverse path of light. Our goal is to create a program able to generate an image from a file describing the scene.
 
Loading...
Searching...
No Matches
Math::Vector3D Class Reference

#include <Math3D.hpp>

Public Member Functions

 Vector3D ()
 
 Vector3D (double x_, double y_, double z_)
 
double length () const
 
double dot (const Vector3D &o) const
 
Vector3D operator+ (const Vector3D &o) const
 
Vector3D operator- (const Vector3D &o) const
 
Vector3D operator* (double s) const
 
Vector3D operator/ (double s) const
 
Vector3Doperator+= (const Vector3D &o)
 
Vector3Doperator-= (const Vector3D &o)
 
Vector3Doperator*= (double s)
 
Vector3Doperator/= (double s)
 

Public Attributes

double x
 
double y
 
double z
 

Detailed Description

Definition at line 13 of file Math3D.hpp.

Constructor & Destructor Documentation

◆ Vector3D() [1/2]

Math::Vector3D::Vector3D ( )

Definition at line 10 of file Math3D.cpp.

10 : x(0), y(0), z(0)
11{}

References x, y, and z.

◆ Vector3D() [2/2]

Math::Vector3D::Vector3D ( double x_,
double y_,
double z_ )

Definition at line 13 of file Math3D.cpp.

13: x(x_), y(y_), z(z_) {}

References x, y, and z.

Member Function Documentation

◆ dot()

double Math::Vector3D::dot ( const Vector3D & o) const

Definition at line 20 of file Math3D.cpp.

21{
22 return x * o.x + y * o.y + z * o.z;
23}

References Vector3D(), x, y, and z.

◆ length()

double Math::Vector3D::length ( ) const

Definition at line 15 of file Math3D.cpp.

16{
17 return std::sqrt(x * x + y * y + z * z);
18}

References x, y, and z.

◆ operator*()

Math::Vector3D Math::Vector3D::operator* ( double s) const

Definition at line 35 of file Math3D.cpp.

36{
37 return Vector3D(x * s, y * s, z * s);
38}

References Vector3D(), x, y, and z.

◆ operator*=()

Math::Vector3D & Math::Vector3D::operator*= ( double s)

Definition at line 57 of file Math3D.cpp.

58{
59 x *= s; y *= s; z *= s;
60 return *this;
61}

References x, y, and z.

◆ operator+()

Math::Vector3D Math::Vector3D::operator+ ( const Vector3D & o) const

Definition at line 25 of file Math3D.cpp.

26{
27 return Vector3D(x + o.x, y + o.y, z + o.z);
28}

References Vector3D(), x, y, and z.

◆ operator+=()

Math::Vector3D & Math::Vector3D::operator+= ( const Vector3D & o)

Definition at line 45 of file Math3D.cpp.

46{
47 x += o.x; y += o.y; z += o.z;
48 return *this;
49}

References Vector3D(), x, y, and z.

◆ operator-()

Math::Vector3D Math::Vector3D::operator- ( const Vector3D & o) const

Definition at line 30 of file Math3D.cpp.

31{
32 return Vector3D(x - o.x, y - o.y, z - o.z);
33}

References Vector3D(), x, y, and z.

◆ operator-=()

Math::Vector3D & Math::Vector3D::operator-= ( const Vector3D & o)

Definition at line 51 of file Math3D.cpp.

52{
53 x -= o.x; y -= o.y; z -= o.z;
54 return *this;
55}

References Vector3D(), x, y, and z.

◆ operator/()

Math::Vector3D Math::Vector3D::operator/ ( double s) const

Definition at line 40 of file Math3D.cpp.

41{
42 return Vector3D(x / s, y / s, z / s);
43}

References Vector3D(), x, y, and z.

◆ operator/=()

Math::Vector3D & Math::Vector3D::operator/= ( double s)

Definition at line 63 of file Math3D.cpp.

64{
65 x /= s; y /= s; z /= s;
66 return *this;
67}

References x, y, and z.

Member Data Documentation

◆ x

double Math::Vector3D::x

Definition at line 15 of file Math3D.hpp.

◆ y

double Math::Vector3D::y

Definition at line 15 of file Math3D.hpp.

◆ z

double Math::Vector3D::z

Definition at line 15 of file Math3D.hpp.


The documentation for this class was generated from the following files: