|
1 | | -// Copyright (c) 2021 Ichiro ITS |
| 1 | +// Copyright (c) 2021 ICHIRO ITS |
2 | 2 | // |
3 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | 4 | // of this software and associated documentation files (the "Software"), to deal |
@@ -30,32 +30,32 @@ struct Point3 |
30 | 30 | Point3(double x, double y, double z); |
31 | 31 | Point3(const Point3 & point); |
32 | 32 |
|
33 | | - Point3 & operator=(Point3 & point); |
34 | | - Point3 & operator+=(Point3 & point); |
35 | | - Point3 & operator-=(Point3 & point); |
| 33 | + Point3 & operator=(const Point3 & point); |
| 34 | + Point3 & operator+=(const Point3 & point); |
| 35 | + Point3 & operator-=(const Point3 & point); |
36 | 36 |
|
37 | 37 | Point3 & operator+=(double value); |
38 | 38 | Point3 & operator-=(double value); |
39 | 39 | Point3 & operator*=(double value); |
40 | 40 | Point3 & operator/=(double value); |
41 | 41 |
|
42 | | - Point3 operator+(Point3 & point); |
43 | | - Point3 operator-(Point3 & point); |
| 42 | + Point3 operator+(const Point3 & point) const; |
| 43 | + Point3 operator-(const Point3 & point) const; |
44 | 44 |
|
45 | | - Point3 operator+(double value); |
46 | | - Point3 operator-(double value); |
47 | | - Point3 operator*(double value); |
48 | | - Point3 operator/(double value); |
| 45 | + Point3 operator+(double value) const; |
| 46 | + Point3 operator-(double value) const; |
| 47 | + Point3 operator*(double value) const; |
| 48 | + Point3 operator/(double value) const; |
49 | 49 |
|
50 | | - static double distance_between(Point3 & point_a, Point3 & point_b); |
51 | | - static double angle_between(Point3 & point_a, Point3 & point_b); |
52 | | - static double dot_product(Point3 & point_a, Point3 & point_b); |
53 | | - static double cross_product(Point3 & point_a, Point3 & point_b); |
| 50 | + static double distance_between(const Point3 & point_a, const Point3 & point_b); |
| 51 | + static double angle_between(const Point3 & point_a, const Point3 & point_b); |
| 52 | + static double dot_product(const Point3 & point_a, const Point3 & point_b); |
| 53 | + static double cross_product(const Point3 & point_a, const Point3 & point_b); |
54 | 54 |
|
55 | | - double magnitude(); |
56 | | - double direction(); |
| 55 | + double magnitude() const; |
| 56 | + double direction() const; |
57 | 57 |
|
58 | | - Point3 normalize(); |
| 58 | + Point3 normalize() const; |
59 | 59 |
|
60 | 60 | double x; |
61 | 61 | double y; |
|
0 commit comments