Skip to content

Commit 21782a0

Browse files
committed
add const
1 parent 943d50a commit 21782a0

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

include/threepp/math/Triangle.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ namespace threepp {
5151

5252
[[nodiscard]] float getArea() const;
5353

54-
void getMidpoint(Vector3& target);
54+
void getMidpoint(Vector3& target) const;
5555

56-
void getNormal(Vector3& target);
56+
void getNormal(Vector3& target) const;
5757

58-
void getBarycoord(Vector3& point, Vector3& target);
58+
void getBarycoord(Vector3& point, Vector3& target) const;
5959

60-
void getUV(const Vector3& point, const Vector2& uv1, const Vector2& uv2, const Vector2& uv3, Vector2& target);
60+
void getUV(const Vector3& point, const Vector2& uv1, const Vector2& uv2, const Vector2& uv3, Vector2& target) const;
6161

62-
bool containsPoint(const Vector3& point);
62+
[[nodiscard]] bool containsPoint(const Vector3& point) const;
6363

64-
bool isFrontFacing(const Vector3& direction);
64+
[[nodiscard]] bool isFrontFacing(const Vector3& direction) const;
6565

66-
void closestPointToPoint(const Vector3& p, Vector3& target);
66+
void closestPointToPoint(const Vector3& p, Vector3& target) const;
6767

6868
private:
6969
Vector3 a_{};

src/threepp/math/Triangle.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,37 +123,37 @@ float Triangle::getArea() const {
123123
return _v0.cross(_v1).length() * 0.5f;
124124
}
125125

126-
void Triangle::getMidpoint(Vector3& target) {
126+
void Triangle::getMidpoint(Vector3& target) const {
127127

128128
target.addVectors(this->a_, this->b_).add(this->c_).multiplyScalar(1.0f / 3);
129129
}
130130

131-
void Triangle::getNormal(Vector3& target) {
131+
void Triangle::getNormal(Vector3& target) const {
132132

133133
return getNormal(this->a_, this->b_, this->c_, target);
134134
}
135135

136-
void Triangle::getBarycoord(Vector3& point, Vector3& target) {
136+
void Triangle::getBarycoord(Vector3& point, Vector3& target) const {
137137

138138
return getBarycoord(point, this->a_, this->b_, this->c_, target);
139139
}
140140

141-
void Triangle::getUV(const Vector3& point, const Vector2& uv1, const Vector2& uv2, const Vector2& uv3, Vector2& target) {
141+
void Triangle::getUV(const Vector3& point, const Vector2& uv1, const Vector2& uv2, const Vector2& uv3, Vector2& target) const {
142142

143143
return getUV(point, this->a_, this->b_, this->c_, uv1, uv2, uv3, target);
144144
}
145145

146-
bool Triangle::containsPoint(const Vector3& point) {
146+
bool Triangle::containsPoint(const Vector3& point) const {
147147

148148
return containsPoint(point, this->a_, this->b_, this->c_);
149149
}
150150

151-
bool Triangle::isFrontFacing(const Vector3& direction) {
151+
bool Triangle::isFrontFacing(const Vector3& direction) const {
152152

153153
return isFrontFacing(this->a_, this->b_, this->c_, direction);
154154
}
155155

156-
void Triangle::closestPointToPoint(const Vector3& p, Vector3& target) {
156+
void Triangle::closestPointToPoint(const Vector3& p, Vector3& target) const {
157157

158158
const auto a = this->a_, b = this->b_, c = this->c_;
159159
float v, w;

0 commit comments

Comments
 (0)