public void Update(Vector2 pointOfReference, Vector2 point, Vector2 normal) { bool isNormalSameAsPrevious = MathUtils.AreComponentsEqual(this.normal, normal); if (isNormalSameAsPrevious && MathUtils.AreComponentsEqual(this.referencePoint, pointOfReference) && MathUtils.AreComponentsEqual(this.point, point)) { return; } this.point = point; this.referencePoint = pointOfReference; this.distanceFromReferencePoint = pointOfReference.y - point.y; if (!isNormalSameAsPrevious) { this.normal = normal; this.tangent = MathUtils.PerpendicularClockwise(normal); this.slope = MathUtils.AngleFromXAxis(this.tangent); } }