We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7852a2 commit 75a81e5Copy full SHA for 75a81e5
godot-core/src/builtin/plane.rs
@@ -214,10 +214,20 @@ impl Plane {
214
self.normal.dot(point) > self.d
215
}
216
217
- /// Returns a normalized copy of the plane.
+ /// Returns a copy of the plane with its `normal` and `d` scaled to the unit length.
218
+ ///
219
+ /// A `normal` length of `0.0` would return a plane with its `normal` and `d` being `Vector3::ZERO`
220
+ /// and `0.0` respectively.
221
#[inline]
222
pub fn normalized(self) -> Self {
- Plane::new(self.normal.normalized(), self.d)
223
+ let length: real = self.normal.length();
224
+ if length == 0.0 {
225
+ return Plane {
226
+ normal: Vector3::ZERO,
227
+ d: 0.0,
228
+ };
229
+ }
230
+ Plane::new(self.normal.normalized(), self.d / length)
231
232
233
/// Returns the orthogonal projection of `point` to the plane.
0 commit comments