-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmathLib3D.h
72 lines (66 loc) · 2.26 KB
/
mathLib3D.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* Do not edit this file. Do not submit changes to this file.
*
* We will mark your submission with this original copy of the mathLib3D.h.
* Modifications will not even be seen by the course staff.
*
* If you edit this file you may receive an automatic zero on this assignment.
*
* If the compiler gave you an error message pointing at this file then it
* means that your source file is not correctly implementing this header file.
*
* Your task is ONLY to produce mathLib2D.cpp by implementing these class and
* function prototypes below.
*
* For folks already familiar with C++:
* We have deliberately avoided dealing with pointers and references in this
* assignment. You are free to use these in future assignments. This header
* file must remain the same however. For those interested, we are not worried
* about the possible performance hit from C++'s "copy semantics". The compiler
* is very good at optimizing these operations. Furthermore, we have settled on
* float instead of double or type parameters. This choice is sufficient for
* the course but you are again free to do what you wish in future assignments.
*/
#ifndef MATHLIB_3D_H
#define MATHLIB_3D_H
class Point3D {
public:
Point3D();
Point3D(float inX, float inY, float inZ);
float mX;
float mY;
float mZ;
void multiply(float scalar);
void minus(float scalar);
void plus(float scalar);
void multiply(float x, float y, float z);
void minus(float x, float y, float z);
void plus(float x, float y, float z);
float distanceTo(Point3D other);
float fastDistanceTo(Point3D other);
void set(float x, float y, float z);
};
class Vec3D {
public:
Vec3D();
Vec3D(float inX, float inY, float inZ);
float mX;
float mY;
float mZ;
float length();
Vec3D normalize();
void multiply(float scalar);
void minus(float scalar);
void plus(float scalar);
void multiply(Vec3D vec);
void minus(Vec3D vec);
void plus(Vec3D vec);
void multiply(float x, float y, float z);
void minus(float x, float y, float z);
void plus(float x, float y, float z);
void set(float x, float y, float z);
Vec3D neg();
Point3D movePoint(Point3D source);
static Vec3D createVector(Point3D p1, Point3D p2);
};
#endif