Isosurface.Sampler.Cuboid C# (CSharp) Method

Cuboid() public static method

public static Cuboid ( Vector2 pos ) : float
pos Vector2
return float
        public static float Cuboid(Vector2 pos)
        {
            float radius = (float)Resolution / 8.0f;
            Vector2 local = pos - new Vector2(Resolution / 2, Resolution / 2);
            Vector2 d = new Vector2(Math.Abs(local.X), Math.Abs(local.Y)) - new Vector2(radius, radius);
            float m = Math.Max(d.X, d.Y);
            Vector2 max = Vector2.Max(d, Vector2.Zero);
            return Math.Min(m, max.Length());
        }

Same methods

Sampler::Cuboid ( Vector3 pos ) : float
Sampler::Cuboid ( Vector3 pos, Vector3 radius ) : float
Sampler::Cuboid ( Vector3 pos, float radius ) : float