Normalize normalizes this plane normal vector and adjusts the constant. Note: will lead to a divide by zero if the plane is invalid. Returns pointer to this updated plane.
()
| 75 | // Note: will lead to a divide by zero if the plane is invalid. |
| 76 | // Returns pointer to this updated plane. |
| 77 | func (p *Plane) Normalize() *Plane { |
| 78 | |
| 79 | inverseNormalLength := 1.0 / p.normal.Length() |
| 80 | p.normal.MultiplyScalar(inverseNormalLength) |
| 81 | p.constant *= inverseNormalLength |
| 82 | return p |
| 83 | } |
| 84 | |
| 85 | // Negate negates this plane normal. |
| 86 | // Returns pointer to this updated plane. |
no test coverage detected