Exemplo n.º 1
0
        // used to hash convex hull generation properties in a way that is robust to imprecision
        internal static uint GetStableHash(
            this ConvexHullGenerationParameters generationParameters,
            ConvexHullGenerationParameters hashedParameters,
            float tolerance = k_HashFloatTolerance
            )
        {
            var differences = new float3(
                generationParameters.BevelRadius - hashedParameters.BevelRadius,
                generationParameters.MinimumAngle - hashedParameters.MinimumAngle,
                generationParameters.SimplificationTolerance - hashedParameters.SimplificationTolerance
                );

            return(math.cmax(math.abs(differences)) < tolerance
                ? unchecked ((uint)hashedParameters.GetHashCode())
                : unchecked ((uint)generationParameters.GetHashCode()));
        }